Skip to content

Commit

Permalink
executor: fix issue of getting stuck when querying information_schema…
Browse files Browse the repository at this point in the history
….columns (pingcap#18847) (pingcap#18849)

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
ti-srebot authored Jul 29, 2020
1 parent 3c74fec commit 2e3db79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion executor/infoschema_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,12 @@ func (e *hugeMemTableRetriever) setDataForColumns(ctx sessionctx.Context) error
schema := e.dbs[e.dbsIdx]
for e.tblIdx < len(schema.Tables) {
table := schema.Tables[e.tblIdx]
e.tblIdx++
if checker != nil && !checker.RequestVerification(ctx.GetSessionVars().ActiveRoles, schema.Name.L, table.Name.L, "", mysql.AllPrivMask) {
continue
}

e.dataForColumnsInTable(schema, table)
e.tblIdx++
if len(e.rows) >= batch {
return nil
}
Expand Down
12 changes: 12 additions & 0 deletions infoschema/tables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,18 @@ func (s *testTableSuite) TestStmtSummaryTable(c *C) {
}, nil, nil)
}

func (s *testTableSuite) TestIssue18845(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec(`CREATE USER 'user18845'@'localhost';`)
tk.Se.Auth(&auth.UserIdentity{
Username: "user18845",
Hostname: "localhost",
AuthUsername: "user18845",
AuthHostname: "localhost",
}, nil, nil)
tk.MustQuery(`select count(*) from information_schema.columns;`)
}

// Test statements_summary_history.
func (s *testTableSuite) TestStmtSummaryHistoryTable(c *C) {
tk := s.newTestKitWithRoot(c)
Expand Down

0 comments on commit 2e3db79

Please sign in to comment.