|
|
|
@ -15,7 +15,6 @@ package tsdb
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"fmt"
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"math"
|
|
|
|
|
"os"
|
|
|
|
@ -753,8 +752,8 @@ func TestCancelCompactions(t *testing.T) {
|
|
|
|
|
defer os.RemoveAll(tmpdir)
|
|
|
|
|
|
|
|
|
|
// Create some blocks to fall within the compaction range.
|
|
|
|
|
createBlock(t, tmpdir, 1000, 0, 1000)
|
|
|
|
|
createBlock(t, tmpdir, 1000, 1000, 2000)
|
|
|
|
|
createBlock(t, tmpdir, 3000, 0, 1000)
|
|
|
|
|
createBlock(t, tmpdir, 3000, 1000, 2000)
|
|
|
|
|
createBlock(t, tmpdir, 1, 2000, 2001) // The most recent block is ignored so can be e small one.
|
|
|
|
|
|
|
|
|
|
db, err := Open(tmpdir, log.NewNopLogger(), nil, &Options{BlockRanges: []int64{1, 2000}})
|
|
|
|
@ -764,8 +763,7 @@ func TestCancelCompactions(t *testing.T) {
|
|
|
|
|
dbClosed := make(chan struct{})
|
|
|
|
|
for {
|
|
|
|
|
if prom_testutil.ToFloat64(db.compactor.(*LeveledCompactor).metrics.populatingBlocks) > 0 {
|
|
|
|
|
fmt.Println("populating started.")
|
|
|
|
|
time.Sleep(2 * time.Millisecond)
|
|
|
|
|
time.Sleep(3 * time.Millisecond)
|
|
|
|
|
go func() {
|
|
|
|
|
testutil.Ok(t, db.Close())
|
|
|
|
|
close(dbClosed)
|
|
|
|
|