Merge pull request #5434 from runner-mei/tsm_tombstone_windows
fix TSMReader.Delete() and all unit tests is pass in the windowspull/5525/merge
commit
28ae8b6fe0
|
@ -433,7 +433,9 @@ func TestTSMKeyIterator_MultipleKeysDeleted(t *testing.T) {
|
|||
}
|
||||
|
||||
r1 := MustTSMReader(dir, 1, points1)
|
||||
r1.Delete([]string{"cpu,host=A#!~#value"})
|
||||
if e := r1.Delete([]string{"cpu,host=A#!~#value"}); nil != e {
|
||||
t.Fatal(e)
|
||||
}
|
||||
|
||||
v2 := tsm1.NewValue(time.Unix(1, 0), float64(1))
|
||||
v3 := tsm1.NewValue(time.Unix(1, 0), float64(1))
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// +build !windows
|
||||
|
||||
package tsm1
|
||||
|
||||
import "os"
|
||||
|
||||
func syncDir(dirName string) error {
|
||||
// fsync the dir to flush the rename
|
||||
dir, err := os.OpenFile(dirName, os.O_RDONLY, os.ModeDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer dir.Close()
|
||||
return dir.Sync()
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package tsm1
|
||||
|
||||
func syncDir(dirName string) error {
|
||||
return nil
|
||||
}
|
|
@ -94,17 +94,14 @@ func (t *Tombstoner) writeTombstone(tombstones []string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := os.Rename(tmp.Name(), t.tombstonePath()); err != nil {
|
||||
tmpFilename := tmp.Name()
|
||||
tmp.Close()
|
||||
|
||||
if err := os.Rename(tmpFilename, t.tombstonePath()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// fsync the dir to flush the rename
|
||||
dir, err := os.OpenFile(filepath.Dir(t.tombstonePath()), os.O_RDONLY, os.ModeDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer dir.Close()
|
||||
return dir.Sync()
|
||||
return syncDir(filepath.Dir(t.tombstonePath()))
|
||||
}
|
||||
|
||||
func (t *Tombstoner) readTombstone() ([]string, error) {
|
||||
|
|
Loading…
Reference in New Issue