cmd: restore the old Execute API only for the test (#22692)

Signed-off-by: AilinKid <314806019@qq.com>
This commit is contained in:
Arenatlx
2021-02-05 16:05:40 +08:00
committed by GitHub
parent 46acccede1
commit 006e2fcd08
2 changed files with 8 additions and 8 deletions

View File

@ -211,15 +211,15 @@ func (s *TestDDLSuite) TestCommitWhenSchemaChanged(c *C) {
s1, err := session.CreateSession(s.store)
c.Assert(err, IsNil)
ctx := goctx.Background()
_, err = s1.ExecuteInternal(ctx, "use test_ddl")
_, err = s1.Execute(ctx, "use test_ddl")
c.Assert(err, IsNil)
s1.ExecuteInternal(ctx, "begin")
s1.ExecuteInternal(ctx, "insert into test_commit values (3, 3)")
s1.Execute(ctx, "begin")
s1.Execute(ctx, "insert into test_commit values (3, 3)")
s.mustExec(c, "alter table test_commit drop column b")
// When this transaction commit, it will find schema already changed.
s1.ExecuteInternal(ctx, "insert into test_commit values (4, 4)")
_, err = s1.ExecuteInternal(ctx, "commit")
s1.Execute(ctx, "insert into test_commit values (4, 4)")
_, err = s1.Execute(ctx, "commit")
c.Assert(terror.ErrorEqual(err, plannercore.ErrWrongValueCountOnRow), IsTrue, Commentf("err %v", err))
}

View File

@ -115,7 +115,7 @@ func (s *TestDDLSuite) SetUpSuite(c *C) {
s.ctx = s.s.(sessionctx.Context)
goCtx := goctx.Background()
_, err = s.s.ExecuteInternal(goCtx, "create database if not exists test_ddl")
_, err = s.s.Execute(goCtx, "create database if not exists test_ddl")
c.Assert(err, IsNil)
s.Bootstrap(c)
@ -130,7 +130,7 @@ func (s *TestDDLSuite) SetUpSuite(c *C) {
s.dom, err = session.BootstrapSession(s.store)
c.Assert(err, IsNil)
s.ctx = s.s.(sessionctx.Context)
_, err = s.s.ExecuteInternal(goCtx, "use test_ddl")
_, err = s.s.Execute(goCtx, "use test_ddl")
c.Assert(err, IsNil)
addEnvPath("..")
@ -449,7 +449,7 @@ func (s *TestDDLSuite) getServer() *server {
func (s *TestDDLSuite) runDDL(sql string) chan error {
done := make(chan error, 1)
go func() {
_, err := s.s.ExecuteInternal(goctx.Background(), sql)
_, err := s.s.Execute(goctx.Background(), sql)
// We must wait 2 * lease time to guarantee all servers update the schema.
if err == nil {
time.Sleep(time.Duration(*lease) * time.Second * 2)