chore(schema-v13): Fix `periodConfig.Validate` for `v13` schema (#10336)

**What this PR does / why we need it**:
Fix periodConfigs `Validate()` for new schema `v13`.

**Which issue(s) this PR fixes**:
Fixes #<issue number>

**Special notes for your reviewer**:
Found when testing archiver with latest loki
**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
pull/10201/head
Kaviraj Kanagaraj 2 years ago committed by GitHub
parent 603eb637f6
commit 4bd5e617c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      pkg/storage/config/schema_config.go
  2. 22
      pkg/storage/config/schema_config_test.go

@ -430,7 +430,7 @@ func (cfg PeriodConfig) validate() error {
}
switch v {
case 10, 11, 12:
case 10, 11, 12, 13:
if cfg.RowShards == 0 {
return fmt.Errorf("must have row_shards > 0 (current: %d) for schema (%s)", cfg.RowShards, cfg.Schema)
}

@ -427,6 +427,15 @@ func TestPeriodConfig_Validate(t *testing.T) {
ChunkTables: PeriodicTableConfig{Period: 0},
},
},
{
desc: "v13",
in: PeriodConfig{
Schema: "v13",
RowShards: 16,
IndexTables: PeriodicTableConfig{Period: 0},
ChunkTables: PeriodicTableConfig{Period: 0},
},
},
} {
t.Run(tc.desc, func(t *testing.T) {
if tc.err == "" {
@ -555,6 +564,19 @@ func TestVersionAsInt(t *testing.T) {
},
expected: int(12),
},
{
name: "v13",
schemaCfg: SchemaConfig{
Configs: []PeriodConfig{
{
From: DayTime{Time: 0},
Schema: "v13",
RowShards: 16,
},
},
},
expected: int(13),
},
} {
t.Run(tc.name, func(t *testing.T) {
version, err := tc.schemaCfg.Configs[0].VersionAsInt()

Loading…
Cancel
Save