Skip to content

Commit 4473520

Browse files
committed
server/config: keep disable-raw-kv-region-split as json bool
Signed-off-by: bufferflies <1045931706@qq.com>
1 parent 0ef292c commit 4473520

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

server/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ type KeyspaceConfig struct {
879879
// WaitRegionSplitTimeout indicates the max duration to wait region split.
880880
WaitRegionSplitTimeout typeutil.Duration `toml:"wait-region-split-timeout" json:"wait-region-split-timeout"`
881881
// DisableRawKVRegionSplit indicates whether to skip raw kv region split.
882-
DisableRawKVRegionSplit bool `toml:"disable-raw-kv-region-split" json:"disable-raw-kv-region-split,string"`
882+
DisableRawKVRegionSplit bool `toml:"disable-raw-kv-region-split" json:"disable-raw-kv-region-split"`
883883
// CheckRegionSplitInterval indicates the interval to check whether the region split is complete
884884
CheckRegionSplitInterval typeutil.Duration `toml:"check-region-split-interval" json:"check-region-split-interval"`
885885
}

server/config/config_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,25 @@ disable-make-up-replica = false
327327
re.Error(err)
328328
}
329329

330+
func TestKeyspaceConfigJSONBoolEncoding(t *testing.T) {
331+
re := require.New(t)
332+
cfg := NewConfig()
333+
cfg.Keyspace.DisableRawKVRegionSplit = true
334+
cfg.Keyspace.WaitRegionSplit = true
335+
336+
data, err := json.Marshal(cfg)
337+
re.NoError(err)
338+
339+
var payload map[string]any
340+
re.NoError(json.Unmarshal(data, &payload))
341+
342+
keyspaceCfg, ok := payload["keyspace"].(map[string]any)
343+
re.True(ok)
344+
re.IsType(true, keyspaceCfg["disable-raw-kv-region-split"])
345+
re.Equal(true, keyspaceCfg["disable-raw-kv-region-split"])
346+
re.IsType(true, keyspaceCfg["wait-region-split"])
347+
}
348+
330349
func TestPDServerConfig(t *testing.T) {
331350
re := require.New(t)
332351
tests := []struct {

0 commit comments

Comments
 (0)