Move memory_map_windows to new folder, intercept most of the read and write calls to volume dat files

This commit is contained in:
j.laycock
2019-08-28 14:48:06 +01:00
parent 36bde84000
commit 0e5d3b1a70
4 changed files with 170 additions and 110 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
. "github.com/chrislusf/seaweedfs/weed/storage/types"
"github.com/joeslay/seaweedfs/weed/storage/memory_map"
)
var ErrorNotFound = errors.New("not found")
@@ -48,6 +49,11 @@ func (v *Volume) Destroy() (err error) {
err = fmt.Errorf("volume %d is compacting", v.Id)
return
}
mem_map, exists := memory_map.FileMemoryMap[v.FileName()]
if exists {
memory_map.DeleteFileAndMemoryMap(mem_map)
}
v.Close()
os.Remove(v.FileName() + ".dat")
os.Remove(v.FileName() + ".idx")