force persisting the tombstone file (#578)

Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
This commit is contained in:
zhulongcheng 2019-04-08 20:06:40 +08:00 committed by Krasi Georgiev
parent 520b1d858f
commit 8b33ee9e2b
1 changed files with 7 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/prometheus/tsdb/encoding" "github.com/prometheus/tsdb/encoding"
tsdb_errors "github.com/prometheus/tsdb/errors"
) )
const tombstoneFilename = "tombstones" const tombstoneFilename = "tombstones"
@ -100,6 +101,12 @@ func writeTombstoneFile(dir string, tr TombstoneReader) error {
return err 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 { if err = f.Close(); err != nil {
return err return err
} }