force persisting the tombstone file
@@ -24,6 +24,7 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/tsdb/encoding"
+ tsdb_errors "github.com/prometheus/tsdb/errors"
)
const tombstoneFilename = "tombstones"
@@ -100,6 +101,12 @@ func writeTombstoneFile(dir string, tr TombstoneReader) error {
return err
}
+ var merr tsdb_errors.MultiError
+ if merr.Add(f.Sync()); merr.Err() != nil {
+ merr.Add(f.Close())
+ return merr.Err()
+ }
+
if err = f.Close(); err != nil {
return err
}
