aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume_checking.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/storage/volume_checking.go')
-rw-r--r--weed/storage/volume_checking.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/weed/storage/volume_checking.go b/weed/storage/volume_checking.go
index 8d63c39c1..b76933083 100644
--- a/weed/storage/volume_checking.go
+++ b/weed/storage/volume_checking.go
@@ -2,6 +2,7 @@ package storage
import (
"fmt"
+ "github.com/chrislusf/seaweedfs/weed/storage/super_block"
"io"
"os"
@@ -148,3 +149,18 @@ func verifyDeletedNeedleIntegrity(datFile backend.BackendStorageFile, v needle.V
}
return n.AppendAtNs, err
}
+
+func (v *Volume) checkIdxFile() error {
+ datFileSize, _, err := v.DataBackend.GetStat()
+ if err != nil {
+ return fmt.Errorf("get stat %s: %v", v.FileName(".dat"), err)
+ }
+ if datFileSize <= super_block.SuperBlockSize {
+ return nil
+ }
+ indexFileName := v.FileName(".idx")
+ if util.FileExists(indexFileName) {
+ return nil
+ }
+ return fmt.Errorf("idx file %s does not exists", indexFileName)
+}