-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
*: support 'admin show ddl jobs <number>' grammar #7028
Conversation
executor/executor.go
Outdated
@@ -247,7 +248,7 @@ func (e *ShowDDLJobQueriesExec) Open(ctx context.Context) error { | |||
return errors.Trace(err) | |||
} | |||
// TODO: need to return the job that the user needs. | |||
historyJobs, err := admin.GetHistoryDDLJobs(e.ctx.Txn()) | |||
historyJobs, err := admin.GetHistoryDDLJobs(e.ctx.Txn(), 10) |
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.
Could we define 10
as a constant?
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.
done
err = r.Next(ctx, chk) | ||
c.Assert(err, IsNil) | ||
row = chk.GetRow(0) | ||
c.Assert(row.Len(), Equals, 10) |
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.
Why is its value 10 is not 20?
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.
I think it the first-row length.
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.
ye~
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.
Do we need to check the number of jobs in the result?
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.
The number of jobs in the result cannot be ensured, it is related to the actual DDL jobs.
util/admin/admin.go
Outdated
@@ -137,18 +137,21 @@ func GetDDLJobs(txn kv.Transaction) ([]*model.Job, error) { | |||
// MaxHistoryJobs is exported for testing. | |||
const MaxHistoryJobs = 10 | |||
|
|||
// DefHistoryJobs is default value of the default number of history job | |||
const DefHistoryJobs = 10 |
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.
s/DefHistoryJobs/DefHistoryJobsNum?
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.
done
executor/executor.go
Outdated
|
||
historyJobs, err := admin.GetHistoryDDLJobs(e.ctx.Txn()) | ||
if e.jobNumber == 0 { | ||
e.jobNumber = 10 |
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.
s/ 10/ admin/DefHistoryJobs?
@@ -413,6 +413,7 @@ func (s *testParserSuite) TestDMLStmt(c *C) { | |||
// for admin | |||
{"admin show ddl;", true}, | |||
{"admin show ddl jobs;", true}, | |||
{"admin show ddl jobs 20;", true}, |
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.
add test for
admin show ddl jobs -1;
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.
done
executor/executor.go
Outdated
@@ -247,7 +248,7 @@ func (e *ShowDDLJobQueriesExec) Open(ctx context.Context) error { | |||
return errors.Trace(err) | |||
} | |||
// TODO: need to return the job that the user needs. |
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.
this todo can be removed?
util/admin/admin.go
Outdated
@@ -137,18 +137,21 @@ func GetDDLJobs(txn kv.Transaction) ([]*model.Job, error) { | |||
// MaxHistoryJobs is exported for testing. | |||
const MaxHistoryJobs = 10 | |||
|
|||
// DefHistoryJobsNum is default value of the default number of history job | |||
const DefHistoryJobsNum = 10 |
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.
how about s/DefHistoryJobsNum/DefNumHistoryJobs/ ?
util/admin/admin.go
Outdated
// The maximum count of history jobs is MaxHistoryJobs. | ||
func GetHistoryDDLJobs(txn kv.Transaction) ([]*model.Job, error) { | ||
// The maximum count of history jobs is num. | ||
func GetHistoryDDLJobs(txn kv.Transaction, num int) ([]*model.Job, error) { |
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.
how about s/num/maxNumJobs/ ?
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.
done
LGTM |
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.
LGTM
/run-all-tests |
What have you changed? (mandatory)
issue#7025
add "admin show ddl jobs [number]" grammar support.
this is use to support parallel ddl test in schrodinger-test
eg:
What are the type of the changes (mandatory)?
How has this PR been tested (mandatory)?
unit test