Skip to content

Commit

Permalink
executor: return an error when updating TiDB instances' config items …
Browse files Browse the repository at this point in the history
…by 'set config'(pingcap#17100)
  • Loading branch information
qw4990 authored May 12, 2020
1 parent 41ae65b commit b367d12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion executor/set_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ func (s *SetConfigExec) Next(ctx context.Context, req *chunk.Chunk) error {
url = fmt.Sprintf("%s://%s%s", util.InternalHTTPSchema(), serverInfo.StatusAddr, pdapi.Config)
case "tikv":
url = fmt.Sprintf("%s://%s/config", util.InternalHTTPSchema(), serverInfo.StatusAddr)
case "tidb":
return errors.Errorf("TiDB doesn't support to change configs online, please use SQL variables")
default:
continue
return errors.Errorf("Unknown server type %s", serverInfo.ServerType)
}
if err := s.doRequest(url); err != nil {
s.ctx.GetSessionVars().StmtCtx.AppendWarning(err)
Expand Down
1 change: 1 addition & 0 deletions executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ func (s *testSuite5) TestSetClusterConfig(c *C) {

c.Assert(tk.ExecToErr("set config xxx log.level='info'"), ErrorMatches, "unknown type xxx")
c.Assert(tk.ExecToErr("set config tidb log.level='info'"), ErrorMatches, "TiDB doesn't support to change configs online, please use SQL variables")
c.Assert(tk.ExecToErr("set config '127.0.0.1:1111' log.level='info'"), ErrorMatches, "TiDB doesn't support to change configs online, please use SQL variables")
c.Assert(tk.ExecToErr("set config '127.a.b.c:1234' log.level='info'"), ErrorMatches, "invalid instance 127.a.b.c:1234")
c.Assert(tk.ExecToErr("set config tikv log.level=null"), ErrorMatches, "can't set config to null")

Expand Down

0 comments on commit b367d12

Please sign in to comment.