Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: fix issue of getting stuck when querying information_schema.columns (#18847) #18849

Merged
merged 2 commits into from
Jul 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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