-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
planner,executor: support admin show slow
command
#7785
Changes from 1 commit
b77189c
5d9a8fb
ed271b9
133cdc1
d449de7
93a8e75
858a106
3e65995
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -637,11 +637,31 @@ func (s *testSuite) TestShowTableStatus(c *C) { | |
partition by range(a) | ||
( partition p0 values less than (10), | ||
partition p1 values less than (20), | ||
partition p2 values less than (maxvalue) | ||
partition p2 values less than (maxvalue) | ||
);`) | ||
rs, err = tk.Exec("show table status from test like 'tp';") | ||
c.Assert(errors.ErrorStack(err), Equals, "") | ||
rows, err = session.GetRows4Test(context.Background(), tk.Se, rs) | ||
c.Assert(errors.ErrorStack(err), Equals, "") | ||
c.Assert(rows[0].GetString(16), Equals, "partitioned") | ||
} | ||
|
||
func (s *testSuite) TestShowSlow(c *C) { | ||
tk := testkit.NewTestKit(c, s.store) | ||
tk.MustExec("use test") | ||
tk.MustExec(`drop table if exists t`) | ||
tk.MustExec(`create table t(a bigint)`) | ||
tk.MustQuery(`select sleep(1)`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't assume sleep 1s is a slow query, we need to use cfg.Log.SlowThreshold? |
||
|
||
result := tk.MustQuery(`admin show slow recent 3`) | ||
c.Check(result.Rows(), HasLen, 1) | ||
|
||
result = tk.MustQuery(`admin show slow top 3`) | ||
c.Check(result.Rows(), HasLen, 1) | ||
|
||
result = tk.MustQuery(`admin show slow top internal 3`) | ||
c.Check(result.Rows(), HasLen, 0) | ||
|
||
result = tk.MustQuery(`admin show slow top all 3`) | ||
c.Check(result.Rows(), HasLen, 1) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -758,7 +758,7 @@ func buildShowSlowSchema() *expression.Schema { | |
schema.Append(buildColumn("", "DETAILS", mysql.TypeVarchar, 256)) | ||
schema.Append(buildColumn("", "SUCC", mysql.TypeTiny, 2)) | ||
schema.Append(buildColumn("", "CONN_ID", mysql.TypeLonglong, 4)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. length is too small. |
||
schema.Append(buildColumn("", "TXNTS", mysql.TypeLonglong, 4)) | ||
schema.Append(buildColumn("", "TRANSACTION_TS", mysql.TypeLonglong, 4)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. length is too small |
||
schema.Append(buildColumn("", "USER", mysql.TypeVarchar, 32)) | ||
schema.Append(buildColumn("", "DB", mysql.TypeVarchar, 64)) | ||
schema.Append(buildColumn("", "TABLE_IDS", mysql.TypeVarchar, 64)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. length is too small. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about
if len(tableIDs) > len("table_ids:")
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a comment for it already.