Skip to content

Commit

Permalink
store: Binary index header is now production ready and enabled by def…
Browse files Browse the repository at this point in the history
…ault.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka committed Mar 27, 2020
1 parent 1a26959 commit ad83295
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Since there are no consistency guarantees provided by some Object Storage provid
- [#2294](https://github.com/thanos-io/thanos/pull/2294) store: optimizations for fetching postings. Queries using `=~".*"` matchers or negation matchers (`!=...` or `!~...`) benefit the most.
- [#2301](https://github.com/thanos-io/thanos/pull/2301) Ruler: initlialization fails with filepath bad pattern error and rule manager update error.
- [#2310](https://github.com/thanos-io/thanos/pull/2310) query: Report timespan 0 to 0 when discovering no stores.
- [#](https://github.com/thanos-io/thanos/pull/) store: index-header is no longer experimental. It is enabled by default for store Gateway. You can disable it with new hidden flag: `--store.disable-index-header`. `--experimental.enable-index-header` flag was removed.

## [v0.11.0](https://github.com/thanos-io/thanos/releases/tag/v0.11.0) - 2020.03.02

Expand Down
13 changes: 7 additions & 6 deletions cmd/thanos/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ func registerStore(m map[string]setupFunc, app *kingpin.Application) {

selectorRelabelConf := regSelectorRelabelFlags(cmd)

enableIndexHeader := cmd.Flag("experimental.enable-index-header", "If true, Store Gateway will recreate index-header instead of index-cache.json for each block. This will replace index-cache.json permanently once it will be out of experimental stage.").
// TODO(bwplotka): Remove in 0.19 if no issues.
disableIndexHeader := cmd.Flag("store.disable-index-header", "If specified, Store Gateway will user index-cache.json for each block instead of recreating binary index-header").
Hidden().Default("false").Bool()

enablePostingsCompression := cmd.Flag("experimental.enable-index-cache-postings-compression", "If true, Store Gateway will reencode and compress postings before storing them into cache. Compressed postings take about 10% of the original size.").
Expand Down Expand Up @@ -117,7 +118,7 @@ func registerStore(m map[string]setupFunc, app *kingpin.Application) {
uint64(*indexCacheSize),
uint64(*chunkPoolSize),
uint64(*maxSampleCount),
int(*maxConcurrent),
*maxConcurrent,
component.Store,
debugLogging,
*syncInterval,
Expand All @@ -128,7 +129,7 @@ func registerStore(m map[string]setupFunc, app *kingpin.Application) {
},
selectorRelabelConf,
*advertiseCompatibilityLabel,
*enableIndexHeader,
*disableIndexHeader,
*enablePostingsCompression,
time.Duration(*consistencyDelay),
time.Duration(*ignoreDeletionMarksDelay),
Expand Down Expand Up @@ -163,7 +164,7 @@ func runStore(
filterConf *store.FilterConfig,
selectorRelabelConf *extflag.PathOrContent,
advertiseCompatibilityLabel bool,
enableIndexHeader bool,
disableIndexHeader bool,
enablePostingsCompression bool,
consistencyDelay time.Duration,
ignoreDeletionMarksDelay time.Duration,
Expand Down Expand Up @@ -252,7 +253,7 @@ func runStore(
return errors.Wrap(err, "meta fetcher")
}

if enableIndexHeader {
if !disableIndexHeader {
level.Info(logger).Log("msg", "index-header instead of index-cache.json enabled")
}
bs, err := store.NewBucketStore(
Expand All @@ -269,7 +270,7 @@ func runStore(
blockSyncConcurrency,
filterConf,
advertiseCompatibilityLabel,
enableIndexHeader,
disableIndexHeader,
enablePostingsCompression,
)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ type BucketStore struct {
filterConfig *FilterConfig
advLabelSets []storepb.LabelSet
enableCompatibilityLabel bool
enableIndexHeader bool
disableIndexHeader bool

// Reencode postings using diff+varint+snappy when storing to cache.
// This makes them smaller, but takes extra CPU and memory.
Expand All @@ -271,7 +271,7 @@ func NewBucketStore(
blockSyncConcurrency int,
filterConfig *FilterConfig,
enableCompatibilityLabel bool,
enableIndexHeader bool,
disableIndexHeader bool,
enablePostingsCompression bool,
) (*BucketStore, error) {
if logger == nil {
Expand Down Expand Up @@ -307,7 +307,7 @@ func NewBucketStore(
samplesLimiter: NewLimiter(maxSampleCount, metrics.queriesDropped),
partitioner: gapBasedPartitioner{maxGapSize: partitionerMaxGapSize},
enableCompatibilityLabel: enableCompatibilityLabel,
enableIndexHeader: enableIndexHeader,
disableIndexHeader: disableIndexHeader,
enablePostingsCompression: enablePostingsCompression,
}
s.metrics = metrics
Expand Down Expand Up @@ -462,10 +462,10 @@ func (s *BucketStore) addBlock(ctx context.Context, meta *metadata.Meta) (err er
h := lset.Hash()

var indexHeaderReader indexheader.Reader
if s.enableIndexHeader {
if !s.disableIndexHeader {
indexHeaderReader, err = indexheader.NewBinaryReader(ctx, s.logger, s.bkt, s.dir, meta.ULID)
if err != nil {
return errors.Wrap(err, "create index header reader")
return errors.Wrap(err, "create binary index header reader")
}
} else {
indexHeaderReader, err = indexheader.NewJSONReader(ctx, s.logger, s.bkt, s.dir, meta.ULID)
Expand Down

0 comments on commit ad83295

Please sign in to comment.