|
|
@ -15,10 +15,10 @@ package tsdb
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"crypto/rand"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
"math"
|
|
|
|
"math"
|
|
|
|
"math/rand"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"sort"
|
|
|
|
"sort"
|
|
|
@ -413,8 +413,7 @@ func (c *LeveledCompactor) Compact(dest string, dirs []string, open []*Block) (u
|
|
|
|
uids = append(uids, meta.ULID.String())
|
|
|
|
uids = append(uids, meta.ULID.String())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
entropy := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
|
|
uid = ulid.MustNew(ulid.Now(), rand.Reader)
|
|
|
|
uid = ulid.MustNew(ulid.Now(), entropy)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
meta := compactBlockMetas(uid, metas...)
|
|
|
|
meta := compactBlockMetas(uid, metas...)
|
|
|
|
err = c.write(dest, meta, blocks...)
|
|
|
|
err = c.write(dest, meta, blocks...)
|
|
|
@ -468,8 +467,7 @@ func (c *LeveledCompactor) Compact(dest string, dirs []string, open []*Block) (u
|
|
|
|
func (c *LeveledCompactor) Write(dest string, b BlockReader, mint, maxt int64, parent *BlockMeta) (ulid.ULID, error) {
|
|
|
|
func (c *LeveledCompactor) Write(dest string, b BlockReader, mint, maxt int64, parent *BlockMeta) (ulid.ULID, error) {
|
|
|
|
start := time.Now()
|
|
|
|
start := time.Now()
|
|
|
|
|
|
|
|
|
|
|
|
entropy := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
|
|
uid := ulid.MustNew(ulid.Now(), rand.Reader)
|
|
|
|
uid := ulid.MustNew(ulid.Now(), entropy)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
meta := &BlockMeta{
|
|
|
|
meta := &BlockMeta{
|
|
|
|
ULID: uid,
|
|
|
|
ULID: uid,
|
|
|
|