[MDEV-18845] Introduce alter_lock to allow refusing non-online ALTER TABLE Created: 2019-03-07 Updated: 2023-11-30 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Storage Engine - InnoDB |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
With It could be convenient to introduce an option that allows ALTER TABLE to behave like ALTER ONLINE TABLE: refuse the operation if it would lock the table. This would be in line with the SET alter_algorithm that was introduced in The proposal is to introduce a parameter with 3 values:
There should be no need to implicitly add LOCK=EXCLUSIVE to each ALTER TABLE statement. That locking mode is rather useless. |
| Comments |
| Comment by Matt White (Inactive) [ 2019-03-07 ] |
|
What should the default value for this variable be? |
| Comment by Federico Razzoli [ 2019-04-15 ] |
|
I believe that disabling any ALTER TABLE by default would be annoying and confusing for many users, and could simply break existing tools. 'DEFAULT' seems to me very reasonable. |
| Comment by Matt White (Inactive) [ 2019-08-06 ] |
|
Inadvertently taking a potentially critical table offline by issuing an ALTER that implicitly gets a table lock seems orders of magnitude more annoying than having to hit the up arrow key and add a "LOCK=". |
| Comment by Marko Mäkelä [ 2020-02-26 ] |
|
As part of designing this change, we should evaluate and address the comments in |
| Comment by Johnathan Davis [ 2022-11-09 ] |
|
The choice of DEFAULT here is a little confusing since SET has a naming collision with its own semantics of what DEFAULT means: What name would we give this choice that also happens to be the DEFAULT? alter_lock=AS_NEEDED has a clear meaning, but I'd welcome a better name. When the LOCK= syntax is omitted from an ALTER, Xpand has an implicit strategy of LOCK=NONE, whereas MariaDB Server's default is LOCK=DEFAULT, so I'd expect each database to have a distinct outcome for what alter_lock=DEFAULT means. |
| Comment by Federico Razzoli [ 2022-11-09 ] |
|
Some variables, like wsrep_sst_receive_address, have an AUTO value. |
| Comment by Johnathan Davis [ 2022-11-09 ] |
|
Thank you for the feedback! I actually think AUTO works really well here. |