[MDEV-14168] Unconditionally allow ALGORITHM=INPLACE for setting a column NOT NULL Created: 2017-10-27  Updated: 2019-03-04  Resolved: 2018-04-24

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.3
Fix Version/s: 10.3.7

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: online-ddl, performance

Issue Links:
Problem/Incident
causes MDEV-16126 Crash or ASAN heap-buffer-overflow in... Closed
causes MDEV-16365 Setting a column NOT NULL fails to re... Closed
Relates
relates to MDEV-18732 InnoDB: Wrong results in ALTER IGNORE... Closed
relates to MDEV-11369 Instant add column for InnoDB Closed

 Description   

When the table-rebuilding "inplace" ALTER TABLE was introduced in MySQL 5.6, one of the supported operations was the change of the NULL / NOT NULL attribute. Introducing a NOT NULL constraint can fail when the column actually contains a NULL value in some row. However, if SQL_MODE does not include STRICT_TRANS_TABLES or STRICT_ALL_TABLES, the column contents should be replaced with the implicit or explicit DEFAULT value of the column, just like ALGORITHM=COPY does it.

MDEV-11369 allows instant ADD COLUMN…NOT NULL without specifying a DEFAULT value, even when rows exist in the table. Just like what would happen with ALGORITHM=COPY or with ALGORITHM=INPLACE before the instant ADD was implemented, the implicit default value of the data type will be applied.

It would be consistent with the ADD COLUMN behaviour to allow changing an existing column to NOT NULL in non-strict mode, replacing any NULL values with the implicit or explicit default value. Such operation would naturally allow LOCK=NONE operation, even when there are concurrent INSERT or UPDATE of NULL values.



 Comments   
Comment by Marko Mäkelä [ 2018-04-17 ]

I posted some review comments. Please request a new review after addressing them.

Generated at Thu Feb 08 08:11:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.