Skip to content

Commit

Permalink
executor: fix panic when execute change pump state (#11827)
Browse files Browse the repository at this point in the history
  • Loading branch information
WangXiangUSTC authored and sre-bot committed Aug 22, 2019
1 parent bcd1d44 commit 1cf66d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ func (b *executorBuilder) buildCancelDDLJobs(v *plannercore.CancelDDLJobs) Execu

func (b *executorBuilder) buildChange(v *plannercore.Change) Executor {
return &ChangeExec{
ChangeStmt: v.ChangeStmt,
baseExecutor: newBaseExecutor(b.ctx, v.Schema(), v.ExplainID()),
ChangeStmt: v.ChangeStmt,
}
}

Expand Down
10 changes: 10 additions & 0 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4044,6 +4044,16 @@ func (s *testSuite) TestShowTableRegion(c *C) {
atomic.StoreUint32(&ddl.EnableSplitTableRegion, 0)
}

func (s *testSuite) TestChangePumpAndDrainer(c *C) {
tk := testkit.NewTestKit(c, s.store)
// change pump or drainer's state need connect to etcd
// so will meet error "URL scheme must be http, https, unix, or unixs: /tmp/tidb"
err := tk.ExecToErr("change pump to node_state ='paused' for node_id 'pump1'")
c.Assert(err, ErrorMatches, "URL scheme must be http, https, unix, or unixs.*")
err = tk.ExecToErr("change drainer to node_state ='paused' for node_id 'drainer1'")
c.Assert(err, ErrorMatches, "URL scheme must be http, https, unix, or unixs.*")
}

func testGetTableByName(c *C, ctx sessionctx.Context, db, table string) table.Table {
dom := domain.GetDomain(ctx)
// Make sure the table schema is the new schema.
Expand Down

0 comments on commit 1cf66d7

Please sign in to comment.