Allow stats files to be observed for finishing/unlinking.
This commit adds the `.tss` files generated for TSM statistics to the `FileObserver` so that package users can be notified when new stats files are created and removed.pull/10616/head
parent
8d546ff689
commit
73d8c85aa2
|
@ -745,6 +745,14 @@ func (f *FileStore) replace(oldFiles, newFiles []string, updatedFn func(r []TSMF
|
|||
return err
|
||||
}
|
||||
|
||||
// Observe the associated statistics file, if available.
|
||||
statsFile := StatsFilename(file)
|
||||
if _, err := os.Stat(statsFile); err == nil {
|
||||
if err := f.obs.FileFinishing(statsFile); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
var newName = file
|
||||
if strings.HasSuffix(file, tsmTmpExt) {
|
||||
// The new TSM files have a tmp extension. First rename them.
|
||||
|
@ -802,6 +810,14 @@ func (f *FileStore) replace(oldFiles, newFiles []string, updatedFn func(r []TSMF
|
|||
return err
|
||||
}
|
||||
|
||||
// Remove associated stats file.
|
||||
statsFile := StatsFilename(file.Path())
|
||||
if _, err := os.Stat(statsFile); err == nil {
|
||||
if err := f.obs.FileUnlinking(statsFile); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
for _, t := range file.TombstoneFiles() {
|
||||
if err := f.obs.FileUnlinking(t.Path); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue