Skip to content

Commit

Permalink
executor: return an error when updating TiDB insta ... (pingcap#17100) (
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot authored May 14, 2020
1 parent 5e4caa7 commit fedc553
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 @@ -105,8 +105,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")
c.Assert(tk.ExecToErr("set config '1.1.1.1:1111' log.level='info'"), ErrorMatches, "instance 1.1.1.1:1111 is not found in this cluster")
Expand Down

0 comments on commit fedc553

Please sign in to comment.