Skip to content

Commit

Permalink
config: be compatible with deprecated stmt-summary config items (#33449
Browse files Browse the repository at this point in the history
…) (#33450)

close #33337
  • Loading branch information
ti-srebot authored Mar 28, 2022
1 parent 953b420 commit e95812d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
37 changes: 22 additions & 15 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,21 +782,28 @@ func StoreGlobalConfig(config *Config) {
}

var deprecatedConfig = map[string]struct{}{
"pessimistic-txn.ttl": {},
"pessimistic-txn.enable": {},
"log.file.log-rotate": {},
"log.log-slow-query": {},
"txn-local-latches": {},
"txn-local-latches.enabled": {},
"txn-local-latches.capacity": {},
"performance.max-memory": {},
"max-txn-time-use": {},
"experimental.allow-auto-random": {},
"enable-redact-log": {}, // use variable tidb_redact_log instead
"tikv-client.copr-cache.enable": {},
"alter-primary-key": {}, // use NONCLUSTERED keyword instead
"enable-streaming": {},
"performance.mem-profile-interval": {},
"pessimistic-txn.ttl": {},
"pessimistic-txn.enable": {},
"log.file.log-rotate": {},
"log.log-slow-query": {},
"txn-local-latches": {},
"txn-local-latches.enabled": {},
"txn-local-latches.capacity": {},
"performance.max-memory": {},
"max-txn-time-use": {},
"experimental.allow-auto-random": {},
"enable-redact-log": {}, // use variable tidb_redact_log instead
"tikv-client.copr-cache.enable": {},
"alter-primary-key": {}, // use NONCLUSTERED keyword instead
"enable-streaming": {},
"performance.mem-profile-interval": {},
"stmt-summary": {},
"stmt-summary.enable": {},
"stmt-summary.enable-internal-query": {},
"stmt-summary.max-stmt-count": {},
"stmt-summary.max-sql-length": {},
"stmt-summary.refresh-interval": {},
"stmt-summary.history-size": {},
}

func isAllDeprecatedConfigItems(items []string) bool {
Expand Down
9 changes: 8 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,14 @@ grpc-max-send-msg-size = 40960
[log.file]
log-rotate = true
[performance]
mem-profile-interval="1m"`)
mem-profile-interval="1m"
[stmt-summary]
enable=false
enable-internal-query=true
max-stmt-count=1000
max-sql-length=1024
refresh-interval=100
history-size=100`)
require.NoError(t, err)
err = conf.Load(configFile)
tmp := err.(*ErrConfigValidationFailed)
Expand Down

0 comments on commit e95812d

Please sign in to comment.