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

Execute the no-dependent DDL job as soon as possible #19476

Closed
crazycs520 opened this issue Aug 26, 2020 · 1 comment
Closed

Execute the no-dependent DDL job as soon as possible #19476

crazycs520 opened this issue Aug 26, 2020 · 1 comment
Labels
feature/discussing This feature request is discussing among product managers sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature. type/performance

Comments

@crazycs520
Copy link
Contributor

crazycs520 commented Aug 26, 2020

Feature Request

Is your feature request related to a problem? Please describe:

test> admin show ddl jobs;
+--------+---------+-------------------------+--------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------+
| JOB_ID | DB_NAME | TABLE_NAME              | JOB_TYPE     | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | START_TIME          | END_TIME            | STATE   |
+--------+---------+-------------------------+--------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------+
| 58     | test    | t                       | add index    | write reorganization | 1         | 56       | 0         | 2020-08-26 16:09:42 | <null>              | running |
| 59     | test    | t                       | add column   | none                 | 1         | 56       | 0         | 2020-08-26 16:09:44 | <null>              | none    |
| 61     | test    |                         | create table | none                 | 1         | 60       | 0         | 2020-08-26 16:09:47 | <null>              | none    |
+--------+---------+-------------------------+--------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------+

As you can see, DDL job 59 is blocked by DDL job 58, since they are both modify the table t, this is reasonable.

But DDL job 61 is also been blocked, it is blocked by DDL job 59, since they are in the same DDL job queue. This can be optimized because it doesn't have a dependent DDL job.

Implementation

In the function handleDDLJobQueue, we can change getFirstDDLJob into getFirstNoDependencyDDLJob to find the first job that has no dependency. We also need to handle the dequeue logic properly.

Score

300

SIG Slack Channel

You can join #sig-ddl on slack in your spare time to discuss and get help with mentors or others.

Mentor(s)

Recommended Skills

  • DDL
  • Golang

Learning Materials

MySQL's document for syntax reference.
TiDB DDL architecture

@crazycs520 crazycs520 added sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature. labels Aug 26, 2020
@scsldb scsldb added the feature/discussing This feature request is discussing among product managers label Aug 27, 2020
@tangenta
Copy link
Contributor

This issue is related to #32031.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/discussing This feature request is discussing among product managers sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature. type/performance
Projects
None yet
Development

No branches or pull requests

3 participants