-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package loki | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/grafana/loki/pkg/ingester/index" | ||
"github.com/grafana/loki/pkg/storage/config" | ||
) | ||
|
||
func ValidateConfigCompatibility(c Config) error { | ||
for _, fn := range []func(Config) error{ | ||
ensureInvertedIndexShardingCompatibility, | ||
} { | ||
if err := fn(c); err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func ensureInvertedIndexShardingCompatibility(c Config) error { | ||
|
||
for i, sc := range c.SchemaConfig.Configs { | ||
switch sc.IndexType { | ||
case config.TSDBType: | ||
if err := index.ValidateBitPrefixShardFactor(uint32(c.Ingester.IndexShards)); err != nil { | ||
return err | ||
} | ||
default: | ||
if sc.RowShards > 0 && c.Ingester.IndexShards%int(sc.RowShards) > 0 { | ||
return fmt.Errorf( | ||
"incompatible ingester index shards (%d) and period config row shard factor (%d) for period config at index (%d). The ingester factor must be evenly divisible by all period config factors", | ||
c.Ingester.IndexShards, | ||
sc.RowShards, | ||
i, | ||
) | ||
} | ||
} | ||
|
||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters