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

support wait/nowait grammar on ddl operation #19928

Open
Damon-Guo opened this issue Sep 10, 2020 · 3 comments
Open

support wait/nowait grammar on ddl operation #19928

Damon-Guo opened this issue Sep 10, 2020 · 3 comments
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.

Comments

@Damon-Guo
Copy link

Damon-Guo commented Sep 10, 2020

Feature Request

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

When adding index, it is inconsistent with MySQL's behavior after the terminal is killed or Ctrl+ C, causing confusion.And adding more than one index at a time usually requires open more than one session.
Some DDL statement also blocked for long periods by add index .
For example, an add column operation on a table that is being indexed will be blocked, and DDL operations on other tables, such as create table, drop table, etc., will also be blocked.You need a way to put it in the background, and now you're doing it by Ctrl+ C, which is a deviation from the normal understanding.

Describe the feature you'd like:

  1. In the case of adding index in long time, the nowait option can be used to let the foreground session return success instead of waiting all the time, and the adding index operation will automatically run in the background.

  2. After the DDL operation is killed or manually Ctrl+ C disconnects, cancel the DDL currently executed.

  3. admin show ddl is difficult to distinguish the blocking relationship, the DDL operation in the wait state can intuitively see which job is blocked.

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

@Damon-Guo Damon-Guo added the type/feature-request Categorizes issue or PR as related to a new feature. label Sep 10, 2020
@ghost
Copy link

ghost commented Sep 12, 2020

MariaDB currently supports this syntax on DDL.

The use case is different though: MySQL/MariaDB will not permit schema changes while there is an open transaction that has modified data on the table. See #17796 for an example. I don't mind TiDB's behavior here, but it could be better documented.

w.r.t. the use case in TiDB. My hope is that #18396 is implemented instead. But if the scope makes it too large of a feature, this serves a useful intermediate use-case.

@bb7133
Copy link
Member

bb7133 commented Sep 14, 2020

Thanks for the tips @nullnotnil . considering the different semantic of WAIT/NOTWAIT between this proposal and MariaDB, I think we can use ASYNC keyword instead?

@ghost
Copy link

ghost commented Sep 14, 2020

@bb7133 yes I agree, ASYNC better describes the semantic requested. Another sql-like word is deferred, borrowed from the feature deferrable constraints (not available in mysql)

There might be some hidden scope for reviewers to discuss:

The feature request says that admin show ddl has intuitiveness issues, but an async ddl job that has to be killed because it failed to convert a type without data loss could be harder to debug. There is the opportunity to support only a subset of 'safe' DDL statements, but that also could create issues for documentation to clarify what is supported for each type of DDL.

@zz-jason zz-jason added status/discussion feature/discussing This feature request is discussing among product managers and removed status/discussion labels Sep 16, 2020
@zimulala zimulala added the sig/sql-infra SIG: SQL Infra label Sep 24, 2020
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.
Projects
None yet
Development

No branches or pull requests

4 participants