Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao committed Aug 6, 2021
1 parent 26fc31d commit 947f271
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
10 changes: 5 additions & 5 deletions ddl/db_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ func (s *testStateChangeSuite) TestParallelAlterModifyColumn(c *C) {
c.Assert(err2, IsNil)
rs, err := s.se.Execute(context.Background(), "select * from t")
c.Assert(err, IsNil)
rs[0].Close()
c.Assert(rs[0].Close(), IsNil)
}
s.testControlParallelExecSQL(c, sql, sql, f)
}
Expand All @@ -1067,7 +1067,7 @@ func (s *testStateChangeSuite) TestParallelAddGeneratedColumnAndAlterModifyColum
c.Assert(err2.Error(), Equals, "[ddl:8200]Unsupported modify column: oldCol is a dependent column 'a' for generated column")
rs, err := s.se.Execute(context.Background(), "select * from t")
c.Assert(err, IsNil)
rs[0].Close()
c.Assert(rs[0].Close(), IsNil)
}
s.testControlParallelExecSQL(c, sql1, sql2, f)
}
Expand All @@ -1080,7 +1080,7 @@ func (s *testStateChangeSuite) TestParallelAlterModifyColumnAndAddPK(c *C) {
c.Assert(err2.Error(), Equals, "[ddl:8200]Unsupported modify column: this column has primary key flag")
rs, err := s.se.Execute(context.Background(), "select * from t")
c.Assert(err, IsNil)
rs[0].Close()
c.Assert(rs[0].Close(), IsNil)
}
s.testControlParallelExecSQL(c, sql1, sql2, f)
}
Expand Down Expand Up @@ -1368,7 +1368,7 @@ func (s *testStateChangeSuiteBase) testControlParallelExecSQL(c *C, sql1, sql2 s
rss, err1 = se.Execute(context.Background(), sql1)
if err1 == nil && len(rss) > 0 {
for _, rs := range rss {
rs.Close()
c.Assert(rs.Close(), IsNil)
}
}
}()
Expand All @@ -1379,7 +1379,7 @@ func (s *testStateChangeSuiteBase) testControlParallelExecSQL(c *C, sql1, sql2 s
rss, err2 = se1.Execute(context.Background(), sql2)
if err2 == nil && len(rss) > 0 {
for _, rs := range rss {
rs.Close()
c.Assert(rs.Close(), IsNil)
}
}
}()
Expand Down
9 changes: 4 additions & 5 deletions executor/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"context"
"fmt"
"sort"
"strings"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -351,10 +350,10 @@ func (e *HashAggExec) initForUnparallelExec() {

func closeBaseExecutor(b *baseExecutor) {
if r := recover(); r != nil {
if str, ok := r.(string); ok && strings.Contains(str, memory.PanicMemoryExceed) {
terror.Log(b.Close())
panic(r)
}
// Release the resource, but throw the panic again and let the top level handle it.
terror.Log(b.Close())
logutil.BgLogger().Warn("panic in Open(), close base executor and throw exception again")
panic(r)
}
}

Expand Down
8 changes: 4 additions & 4 deletions session/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ func (s *testBootstrapSuite) TestBootstrap(c *C) {
mustExecSQL(c, se, "USE test;")
// Check privilege tables.
rs := mustExecSQL(c, se, "SELECT * from mysql.global_priv;")
rs.Close()
c.Assert(rs.Close(), IsNil)
rs = mustExecSQL(c, se, "SELECT * from mysql.db;")
rs.Close()
c.Assert(rs.Close(), IsNil)
rs = mustExecSQL(c, se, "SELECT * from mysql.tables_priv;")
rs.Close()
c.Assert(rs.Close(), IsNil)
rs = mustExecSQL(c, se, "SELECT * from mysql.columns_priv;")
rs.Close()
c.Assert(rs.Close(), IsNil)
// Check privilege tables.
r = mustExecSQL(c, se, "SELECT COUNT(*) from mysql.global_variables;")
c.Assert(r, NotNil)
Expand Down

0 comments on commit 947f271

Please sign in to comment.