Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: warn undefined config item #1577

Merged
merged 4 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion conf/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ leader-schedule-limit = 4
region-schedule-limit = 1024
replica-schedule-limit = 1024
merge-schedule-limit = 8
tolerant-size-ratio = 0
#tolerant-size-ratio = 5.0

# customized schedulers, the format is as below
# if empty, it will use balance-leader, balance-region, hot-region as default
Expand All @@ -83,6 +83,8 @@ max-replicas = 3
# For example, ["zone", "rack"] means that we should place replicas to
# different zones first, then to different racks if we don't have enough zones.
location-labels = []
# Strictly checks if the label of TiKV is matched with location labels.
#strictly-match-label = false

[label-property]
# Do not assign region leaders to stores that have these tags.
Expand Down
4 changes: 2 additions & 2 deletions server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ func (m *configMetaData) CheckUndecoded() error {
func (c *Config) Adjust(meta *toml.MetaData) error {
configMetaData := newConfigMetadata(meta)
if err := configMetaData.CheckUndecoded(); err != nil {
return err
c.WarningMsgs = append(c.WarningMsgs, err.Error())
}

if c.Name == "" {
Expand Down Expand Up @@ -682,7 +682,7 @@ type ReplicationConfig struct {
// For example, ["zone", "rack"] means that we should place replicas to
// different zones first, then to different racks if we don't have enough zones.
LocationLabels typeutil.StringSlice `toml:"location-labels,omitempty" json:"location-labels"`
// StrictlyMatchLabel strictly checks if the label of TiKV is matched with LocaltionLabels.
// StrictlyMatchLabel strictly checks if the label of TiKV is matched with LocationLabels.
StrictlyMatchLabel bool `toml:"strictly-match-label,omitempty" json:"strictly-match-label,string"`
}

Expand Down
4 changes: 3 additions & 1 deletion server/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"fmt"
"os"
"path"
"strings"
"time"

"github.com/BurntSushi/toml"
Expand Down Expand Up @@ -131,7 +132,8 @@ type = "random-merge"
meta, err = toml.Decode(cfgData, &cfg)
c.Assert(err, IsNil)
err = cfg.Adjust(&meta)
c.Assert(err, NotNil)
c.Assert(err, IsNil)
c.Assert(strings.Contains(cfg.WarningMsgs[0], "Config contains undefined item"), IsTrue)

// Check misspelled schedulers name
cfgData = `
Expand Down