mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
weed fix: add back .idx file generation
This commit is contained in:
parent
4e731f1c8b
commit
aa73364a24
|
@ -68,11 +68,6 @@ func runFix(cmd *Command, args []string) bool {
|
||||||
baseFileName = *fixVolumeCollection + "_" + baseFileName
|
baseFileName = *fixVolumeCollection + "_" + baseFileName
|
||||||
}
|
}
|
||||||
indexFileName := path.Join(*fixVolumePath, baseFileName+".idx")
|
indexFileName := path.Join(*fixVolumePath, baseFileName+".idx")
|
||||||
indexFile, err := os.OpenFile(indexFileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
|
||||||
if err != nil {
|
|
||||||
glog.Fatalf("Create Volume Index [ERROR] %s\n", err)
|
|
||||||
}
|
|
||||||
defer indexFile.Close()
|
|
||||||
|
|
||||||
nm := needle_map.NewMemDb()
|
nm := needle_map.NewMemDb()
|
||||||
|
|
||||||
|
@ -81,9 +76,13 @@ func runFix(cmd *Command, args []string) bool {
|
||||||
nm: nm,
|
nm: nm,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = storage.ScanVolumeFile(*fixVolumePath, *fixVolumeCollection, vid, storage.NeedleMapInMemory, scanner)
|
if err = storage.ScanVolumeFile(*fixVolumePath, *fixVolumeCollection, vid, storage.NeedleMapInMemory, scanner); err != nil {
|
||||||
if err != nil {
|
glog.Fatalf("scan .dat File: %v", err)
|
||||||
glog.Fatalf("Export Volume File [ERROR] %s\n", err)
|
os.Remove(indexFileName)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := nm.SaveToIdx(indexFileName); err != nil {
|
||||||
|
glog.Fatalf("save to .idx File: %v", err)
|
||||||
os.Remove(indexFileName)
|
os.Remove(indexFileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue