From 1cf66d75502f8837eaea90ce17be92ffd82e2469 Mon Sep 17 00:00:00 2001 From: WangXiangUSTC Date: Thu, 22 Aug 2019 16:38:16 +0800 Subject: [PATCH] executor: fix panic when execute change pump state (#11827) --- executor/builder.go | 3 ++- executor/executor_test.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/executor/builder.go b/executor/builder.go index 96e5d5abd5c2d..cfb454824ca1f 100644 --- a/executor/builder.go +++ b/executor/builder.go @@ -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, } } diff --git a/executor/executor_test.go b/executor/executor_test.go index 8de5009b0b900..32fe9328d94b3 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -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.