fix(tsi): sync index file before close
parent
5d04f0ae20
commit
5fd1b29d74
|
@ -1007,6 +1007,11 @@ func (p *Partition) compactToLevel(files []*IndexFile, level int, interrupt <-ch
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = f.Sync(); err != nil {
|
||||||
|
log.Error("Error sync index file", zap.Error(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Close file.
|
// Close file.
|
||||||
if err := f.Close(); err != nil {
|
if err := f.Close(); err != nil {
|
||||||
log.Error("Error closing index file", zap.Error(err))
|
log.Error("Error closing index file", zap.Error(err))
|
||||||
|
@ -1152,9 +1157,14 @@ func (p *Partition) compactLogFile(logFile *LogFile) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = f.Sync(); err != nil {
|
||||||
|
log.Error("Cannot sync index file", zap.Error(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Close file.
|
// Close file.
|
||||||
if err := f.Close(); err != nil {
|
if err := f.Close(); err != nil {
|
||||||
log.Error("Cannot close log file", zap.Error(err))
|
log.Error("Cannot close index file", zap.Error(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue