diff options
| -rw-r--r-- | weed/filesys/wfs.go | 2 | ||||
| -rw-r--r-- | weed/replication/sink/filersink/filer_sink.go | 2 | ||||
| -rw-r--r-- | weed/s3api/s3api_object_handlers.go | 2 | ||||
| -rw-r--r-- | weed/storage/volume_checking.go | 16 | ||||
| -rw-r--r-- | weed/storage/volume_loading.go | 4 | ||||
| -rw-r--r-- | weed/util/bounded_tree/bounded_tree.go | 7 |
6 files changed, 24 insertions, 9 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index 9443bc0bf..b41d76cd6 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -3,8 +3,8 @@ package filesys import ( "context" "fmt" - "github.com/chrislusf/seaweedfs/weed/storage" "github.com/chrislusf/seaweedfs/weed/filer" + "github.com/chrislusf/seaweedfs/weed/storage" "github.com/chrislusf/seaweedfs/weed/wdclient" "math" "os" diff --git a/weed/replication/sink/filersink/filer_sink.go b/weed/replication/sink/filersink/filer_sink.go index 9960634f6..509f75116 100644 --- a/weed/replication/sink/filersink/filer_sink.go +++ b/weed/replication/sink/filersink/filer_sink.go @@ -25,7 +25,7 @@ type FilerSink struct { replication string collection string ttlSec int32 - diskType string + diskType string dataCenter string grpcDialOption grpc.DialOption address string diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index c9e124328..4c408110a 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -223,7 +223,7 @@ func (s3a *S3ApiServer) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *h } -func doDeleteEmptyDirectories(client filer_pb.SeaweedFilerClient, directoriesWithDeletion map[string]int) (newDirectoriesWithDeletion map[string]int){ +func doDeleteEmptyDirectories(client filer_pb.SeaweedFilerClient, directoriesWithDeletion map[string]int) (newDirectoriesWithDeletion map[string]int) { var allDirs []string for dir, _ := range directoriesWithDeletion { allDirs = append(allDirs, dir) 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) +} diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go index 52a50a98c..bff1055bb 100644 --- a/weed/storage/volume_loading.go +++ b/weed/storage/volume_loading.go @@ -96,6 +96,10 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind v.dirIdx = v.dir } } + // check volume idx files + if err := v.checkIdxFile(); err != nil { + glog.Fatalf("check volume idx file %s: %v", v.FileName(".idx"), err) + } var indexFile *os.File if v.noWriteOrDelete { glog.V(0).Infoln("open to read file", v.FileName(".idx")) diff --git a/weed/util/bounded_tree/bounded_tree.go b/weed/util/bounded_tree/bounded_tree.go index 0e8af2520..3a8a22a9c 100644 --- a/weed/util/bounded_tree/bounded_tree.go +++ b/weed/util/bounded_tree/bounded_tree.go @@ -70,12 +70,7 @@ func (t *BoundedTree) ensureVisited(n *Node, currentPath util.FullPath, componen } else { // fmt.Printf("ensure %v\n", currentPath) - filerPath := currentPath - if t.baseDir != "/" { - filerPath = t.baseDir + filerPath - } - - children, err := visitFn(filerPath) + children, err := visitFn(currentPath) if err != nil { glog.V(0).Infof("failed to visit %s: %v", currentPath, err) return false, err |
