Browse Source

sync before closing index file

merge from 0181f87d91
fasthttp
Chris Lu 5 years ago
parent
commit
08e4702542
  1. 4
      weed/storage/needle_map_memory.go

4
weed/storage/needle_map_memory.go

@ -64,6 +64,10 @@ func (nm *NeedleMap) Delete(key NeedleId, offset Offset) error {
return nm.appendToIndexFile(key, offset, TombstoneFileSize) return nm.appendToIndexFile(key, offset, TombstoneFileSize)
} }
func (nm *NeedleMap) Close() { func (nm *NeedleMap) Close() {
indexFileName := nm.indexFile.Name()
if err := nm.indexFile.Sync(); err != nil {
glog.Warningf("sync file %s failed, %v", indexFileName, err)
}
_ = nm.indexFile.Close() _ = nm.indexFile.Close()
} }
func (nm *NeedleMap) Destroy() error { func (nm *NeedleMap) Destroy() error {

Loading…
Cancel
Save