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
Ben Johnson 2018-12-07 10:20:32 -07:00
parent 8d546ff689
commit 73d8c85aa2
No known key found for this signature in database
GPG Key ID: 81741CD251883081
1 changed files with 16 additions and 0 deletions

View File

@ -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