Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2.4-5, 10.3.1-2
Description
Add support for instant add column for InnoDB when adding a new column with a default value last.
We have got patches from Alibaba and TenCent for doing this. We should choose either one or merge them.
The idea in both patches is to add a new row type to InnoDB where the number of columns
are stored in each row in 1-2 bytes. When creating a row we store the current number of columns. This allows us to fill any extra columns with default values on read.
Attachments
Issue Links
- blocks
-
MDEV-15562 Instant DROP COLUMN or changing the order of columns
-
- Closed
-
- causes
-
MDEV-14022 Upgrade from 10.0/10.1 fails on assertion `!is_user_rec || !leaf || index->is_dummy || dict_index_is_ibuf(index) || n == n_fields || (n >= index->n_core_fields && n <= index->n_fields)'
-
- Closed
-
-
MDEV-14062 Upgrade from 10.0 fails on assertion `!is_user_rec || n >= index->n_core_fields || n >= rec_offs_n_fields(offsets)' failed in rec_offs_make_valid
-
- Closed
-
-
MDEV-14067 Assertion `node->pcur.btr_cur.low_match == node->ref->n_fields' failed
-
- Closed
-
-
MDEV-14111 Inplace update assert after instant adding column
-
- Closed
-
-
MDEV-14660 Assertion failure in lock_move_rec_list_start() after instant ADD COLUMN
-
- Closed
-
-
MDEV-14663 Assertion `page_is_root(block->frame)' failed in innobase_add_instant_try
-
- Closed
-
-
MDEV-14837 Duplicate primary keys are allowed after ADD COLUMN / UPDATE
-
- Closed
-
-
MDEV-14897 After UPDATE of instant ADD COLUMN, PRIMARY KEY accepts duplicates
-
- Closed
-
-
MDEV-14906 Assertion `index->is_instant()' failed in rec_init_offsets_comp_ordinary upon DELETE from table
-
- Closed
-
-
MDEV-15060 Assertion `0' failed in row_log_table_apply_op after instant ADD when the table is emptied during subsequent ALTER TABLE
-
- Closed
-
-
MDEV-15871 Assertion `ptr' failed in ut_align_down
-
- Closed
-
-
MDEV-16017 galera mtr tests fail with sst_xtrabackup-v2
-
- Closed
-
-
MDEV-16131 Assertion `is_instant() || id == DICT_INDEXES_ID' failed in dict_index_t::instant_field_value
-
- Closed
-
-
MDEV-17126 UPDATE of a BLOB column with long DEFAULT value fails
-
- Confirmed
-
-
MDEV-17196 Crash during instant ADD COLUMN with long DEFAULT value
-
- Closed
-
-
MDEV-17197 "1713: Undo log record is too big" for instant ADD COLUMN with long DEFAULT for BLOB
-
- Confirmed
-
-
MDEV-17383 BLOB leak when emptying an instantly altered table
-
- Open
-
-
MDEV-17483 Insert on delete-marked record can wrongly inherit old values for instantly added column
-
- Closed
-
-
MDEV-17821 Assertion `!page_rec_is_supremum(rec)' failed in btr_pcur_store_position or non-debug assertion failure in rem/rem0rec.cc upon HANDLER READ
-
- Closed
-
-
MDEV-17823 Assertion `!rec_offs_nth_default(clust_offs, clust_pos)' failed in row_sel_sec_rec_is_for_clust_rec
-
- Closed
-
-
MDEV-17881 Assertion failure in cmp_dtuple_rec_with_match_bytes after instant ADD COLUMN
-
- Closed
-
-
MDEV-18295 IMPORT TABLESPACE fails with instant-altered tables
-
- Closed
-
-
MDEV-19385 InnoDB: Failing assertion: !cursor->index->is_committed() with virtual columns / indexes, WITHOUT foreign keys and temporary tables
-
- Closed
-
-
MDEV-19783 Random crashes and corrupt data in INSTANT-added columns
-
- Closed
-
-
MDEV-19916 Corruption after instant ADD/DROP and shrinking the index tree
-
- Closed
-
-
MDEV-20066 Wrong value on instantly added column after DELETE and UPDATE
-
- Closed
-
-
MDEV-23072 Diskspace not reused for Blob in data file
-
- Closed
-
-
MDEV-23334 SIGSEGV or assertion failures in rec_get_status upon ALTER TABLE
-
- Closed
-
-
MDEV-24323 Crash on recovery after server kill during instant ADD COLUMN
-
- Closed
-
-
MDEV-24620 ASAN heap-buffer-overflow in rec_init_offsets_comp_ordinary
-
- Closed
-
-
MDEV-24653 Assertion `block->page.id().page_no() == index->page' failed in innobase_instant_try
-
- Closed
-
-
MDEV-24730 Corruption in online ALTER TABLE with ROW_FORMAT=REDUNDANT
-
- Closed
-
-
MDEV-26577 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) during ADD COLUMN
-
- Closed
-
- is duplicated by
-
MDEV-13076 AliSQL: [Feature] Issue#43 Add Column Dynamically
-
- Closed
-
-
MDEV-14535 Duplicate entry on ALTER TABLE ADD COLUMN
-
- Closed
-
- is part of
-
MDEV-10137 Providing compatibility to other databases
-
- Open
-
- relates to
-
MDEV-11424 Instant ALTER TABLE of failure-free record format changes
-
- Closed
-
-
MDEV-13134 Introduce ALTER TABLE attributes ALGORITHM=NOCOPY and ALGORITHM=INSTANT
-
- Closed
-
-
MDEV-13176 ALTER TABLE…CHANGE col col TIMESTAMP NOT NULL DEFAULT… fails
-
- Closed
-
-
MDEV-13745 ALTER TABLE…ADD COLUMN…POINT NOT NULL without DEFAULT should be refused if the table is not empty
-
- Stalled
-
-
MDEV-13899 IMPORT TABLESPACE may corrupt ROW_FORMAT=REDUNDANT tables
-
- Closed
-
-
MDEV-13942 Potential InnoDB SPATIAL INDEX corruption during root page split
-
- Closed
-
-
MDEV-14016 Allow instant ADD COLUMN, ADD INDEX, LOCK=NONE
-
- Closed
-
-
MDEV-14168 Unconditionally allow ALGORITHM=INPLACE for setting a column NOT NULL
-
- Closed
-
-
MDEV-14246 Skip the ha_innobase::prepare_inplace_alter_table() phase if no inplace_alter_table() phase is needed
-
- Closed
-
-
MDEV-14848 MariaDB 10.3 refuses InnoDB crash-upgrade from MariaDB 10.2
-
- Closed
-
-
MDEV-16282 ALTER TABLE t ADD COLUMN c INT, ADD INDEX(c), ALGORITHM=NOCOPY fails
-
- Stalled
-
-
MDEV-17459 Allow instant ALTER TABLE even if FULLTEXT INDEX exists
-
- Stalled
-
-
MDEV-17468 Avoid table rebuild on operations on generated columns
-
- Stalled
-
-
MDEV-17831 Assertion `supports_instant()' failed in dict_table_t::prepare_instant upon ADD COLUMN on table with KEY_BLOCK_SIZE
-
- Closed
-
-
MDEV-18926 Support ALTER TABLE…ADD COLUMN…ADD INDEX, ALGORITHM=NOCOPY
-
- Open
-
-
MDEV-21693 ALGORITHM=INSTANT does not work for partitioned tables
-
- Closed
-
-
MDEV-23632 ALTER TABLE...ADD KEY creates corrupted index on virtual column
-
- Closed
-
-
MDEV-25971 Instant ADD COLUMN fails to issue truncation warnings
-
- Closed
-
-
MDEV-28462 AddressSanitizer: use-after-poison dict_index_t::get_n_nullable(unsigned long) const
-
- Closed
-
-
MDEV-28912 Assertion `ha_alter_info->key_count + (dict_table_get_first_index(ctx->new_table))->is_gen_clust() + .... in bool prepare_inplace_alter_table_dict
-
- Closed
-
-
MDEV-29440 InnoDB instant ALTER TABLE recovery wrongly uses READ COMMITTED isolation level instead of READ UNCOMMITTED
-
- Closed
-
-
MDEV-14029 Server does not remove #sql*.frm files after crash during ALTER TABLE
-
- Closed
-
-
MDEV-15522 Change galera suite MTR tests to use mariabackup instead of xtrabackup
-
- Closed
-
-
MDEV-16830 ALTER TABLE DROP FOREIGN KEY - unexpected end of stream error
-
- Closed
-
-
MDEV-18095 InnoDB assertion failure when access table
-
- Closed
-
-
MDEV-18519 0x7f0118195700 InnoDB: Assertion failure in file /home/buildbot/buildbot/build/mariadb-10.3.7/storage/innobase/btr/btr0cur.cc line 4308
-
- Closed
-
-
MDEV-19611 INPLACE ALTER does not fail on bad implicit default value
-
- Closed
-
-
MDEV-20048 dtuple_get_nth_field(): Assertion 'n < tuple->n_fields' failed on ROLLBACK after instant DROP COLUMN
-
- Closed
-
-
MDEV-20590 Introduce a file format constraint to ALTER TABLE
-
- Closed
-
-
MDEV-24796 Assertion `page_has_next(block->frame) || rec_is_alter_metadata(p, *index) || block->page.id().page_no() != index->page' failed in btr_pcur_store_position and other related asserts
-
- Closed
-
-
MDEV-32668 tables with UNIQUE blob columns cannot be alter_algorithm=INSTANT modified
-
- Open
-
-
MDEV-34223 Innodb - add status variable for number of bulk inserts
-
- Closed
-
To avoid complicating import, export, and future data dictionary related tasks such as MDEV-11655, I am trying to prototype a design change that minimizes the format changes to the InnoDB data dictionary tables.
Instead of introducing a new table SYS_COLUMNS_ADDED to store the default values of instantly-added columns, my revised design would introduce a special 'default row' record at the start of the clustered index. This record would carry the magic REC_INFO_MIN_REC_FLAG, which was until now only set on the leftmost node pointer record of each non-leaf level.
We must also store the original number of columns (’core columns’) somewhere in the clustered index tree, instead of only storing it somewhere in the InnoDB data dictionary.
There is a chicken-and-egg problem here because of my unfortunate design mistake in MySQL 5.0.3 that reserves the n_nullable bits in node pointer records for ROW_FORMAT!=REDUNDANT. It is clearly not possible to navigate to the leftmost leaf page by reading child page numbers from mach_read_from_4(rec_get_next_ptr(node_ptr_with_min_rec_flag, 1)-4) because the next-record pointer may have been changed, for example if some pages were merged and the original next-record pointer was moved to the PAGE_FREE list.
It looks like instant ADD COLUMN should write 1+UT_BITS_IN_BYTES(n_nullable) to spare 8 bits in the clustered index root page. A good candidate would be the high-order byte of PAGE_DIRECTION, which was always written as 0 starting with MySQL 4.0.14 and 4.1.1, so always for ROW_FORMAT!=REDUNDANT. Originally, it was sometimes written as uninitialized garbage for ROW_FORMAT=REDUNDANT in the initial InnoDB version.