mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
5d142f9958
When MySQL 5.7 introduced indexed virtual columns, it introduced several bugs into the online table-rebuilding ALTER, that is, the row_log_table_apply() family of functions. The online_log format that was introduced for online table-rebuilding ALTER in MySQL 5.6 should be sufficient. Ideally, any indexed virtual column values would be evaluated based on the log records in the temporary file. There is no need to log virtual column values. (For ADD INDEX, that is row_log_apply(), we always must log the values of the keys, no matter if the columns are virtual.) Because omitting the virtual column values removes any chance of row_log_table_apply() working with indexed virtual columns, we will for now refuse LOCK=NONE in table-rebuilding ALTER operations when indexes on virtual columns exist. This restriction would be lifted in MDEV-14341. innobase_indexed_virtual_exist(): New predicate, to determine if indexed virtual columns exist in a table definition. ha_innobase::check_if_supported_inplace_alter(): Refuse online rebuild if indexed virtual columns exist. rec_get_converted_size_temp_v(), rec_convert_dtuple_to_temp_v(): Remove. row_log_table_delete(), row_log_table_update(, row_log_table_insert(): Remove parameters for virtual columns. trx_undo_read_v_rows(): Remove the col_map parameter. row_log_table_apply(): Do not deal with virtual columns.
106 lines
3.5 KiB
Text
106 lines
3.5 KiB
Text
CREATE TABLE t1 (j SERIAL, i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB;
|
|
CREATE TABLE t2 (j SERIAL, i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB
|
|
ROW_FORMAT=REDUNDANT;
|
|
CREATE TABLE t3 (i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB;
|
|
CREATE TABLE t4 (i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB
|
|
ROW_FORMAT=REDUNDANT;
|
|
INSERT INTO t4 SET i=1;
|
|
ALTER TABLE t4 ADD INDEX(v), LOCK=NONE;
|
|
ALTER TABLE t4 ADD COLUMN k INT, LOCK=NONE;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
|
|
ALTER TABLE t4 ADD COLUMN k INT;
|
|
ALTER TABLE t4 DROP k, LOCK=NONE;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
|
|
ALTER TABLE t4 DROP INDEX v, LOCK=NONE;
|
|
ALTER TABLE t4 DROP k, LOCK=NONE;
|
|
INSERT INTO t3 SET i=1;
|
|
ALTER TABLE t3 ADD INDEX(v), LOCK=NONE;
|
|
ALTER TABLE t3 ADD COLUMN k INT, LOCK=NONE;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
|
|
ALTER TABLE t3 ADD COLUMN k INT;
|
|
ALTER TABLE t3 DROP k, LOCK=NONE;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
|
|
ALTER TABLE t3 DROP INDEX v, LOCK=NONE;
|
|
ALTER TABLE t3 DROP k, LOCK=NONE;
|
|
INSERT INTO t2 SET i=1;
|
|
ALTER TABLE t2 ADD INDEX(v), LOCK=NONE;
|
|
ALTER TABLE t2 ADD COLUMN k INT, LOCK=NONE;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
|
|
ALTER TABLE t2 ADD COLUMN k INT;
|
|
ALTER TABLE t2 DROP k, LOCK=NONE;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
|
|
ALTER TABLE t2 DROP INDEX v, LOCK=NONE;
|
|
ALTER TABLE t2 DROP k, LOCK=NONE;
|
|
INSERT INTO t1 SET i=1;
|
|
ALTER TABLE t1 ADD INDEX(v), LOCK=NONE;
|
|
ALTER TABLE t1 ADD COLUMN k INT, LOCK=NONE;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
|
|
ALTER TABLE t1 ADD COLUMN k INT;
|
|
ALTER TABLE t1 DROP k, LOCK=NONE;
|
|
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
|
|
ALTER TABLE t1 DROP INDEX v, LOCK=NONE;
|
|
ALTER TABLE t1 DROP k, LOCK=NONE;
|
|
connect ddl,localhost,root,,test;
|
|
connection default;
|
|
connection ddl;
|
|
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL copied WAIT_FOR dml';
|
|
ALTER TABLE t4 FORCE;
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR copied';
|
|
BEGIN;
|
|
UPDATE t4 SET i = 0;
|
|
ROLLBACK;
|
|
SET DEBUG_SYNC = 'now SIGNAL dml';
|
|
connection ddl;
|
|
connection default;
|
|
SELECT * FROM t4;
|
|
i v
|
|
1 1
|
|
DROP TABLE t4;
|
|
connection ddl;
|
|
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL copied WAIT_FOR dml';
|
|
ALTER TABLE t3 FORCE;
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR copied';
|
|
BEGIN;
|
|
UPDATE t3 SET i = 0;
|
|
ROLLBACK;
|
|
SET DEBUG_SYNC = 'now SIGNAL dml';
|
|
connection ddl;
|
|
connection default;
|
|
SELECT * FROM t3;
|
|
i v
|
|
1 1
|
|
DROP TABLE t3;
|
|
connection ddl;
|
|
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL copied WAIT_FOR dml';
|
|
ALTER TABLE t2 FORCE;
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR copied';
|
|
BEGIN;
|
|
UPDATE t2 SET i = 0;
|
|
ROLLBACK;
|
|
SET DEBUG_SYNC = 'now SIGNAL dml';
|
|
connection ddl;
|
|
connection default;
|
|
SELECT * FROM t2;
|
|
j i v
|
|
1 1 1
|
|
DROP TABLE t2;
|
|
connection ddl;
|
|
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL copied WAIT_FOR dml';
|
|
ALTER TABLE t1 FORCE;
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR copied';
|
|
BEGIN;
|
|
UPDATE t1 SET i = 0;
|
|
ROLLBACK;
|
|
SET DEBUG_SYNC = 'now SIGNAL dml';
|
|
connection ddl;
|
|
connection default;
|
|
SELECT * FROM t1;
|
|
j i v
|
|
1 1 1
|
|
DROP TABLE t1;
|
|
disconnect ddl;
|
|
SET DEBUG_SYNC = 'RESET';
|