From f1b4ed455ca47db402898dffd01b48a52cb76dea Mon Sep 17 00:00:00 2001 From: Varun Nagaraju Date: Thu, 4 Jul 2024 17:11:12 +0530 Subject: [PATCH] Revert "PS-9222 ALTER TABLE ALGORITHM=INSTANT FIX #1" This reverts commit d537fd3b39ff586d45659092ebd359e37c055e0c. --- .../r/instant_alter_index_prefix.result | 38 -------------- .../innodb/t/instant_alter_index_prefix.test | 50 ------------------- storage/innobase/mtr/mtr0log.cc | 4 +- 3 files changed, 2 insertions(+), 90 deletions(-) delete mode 100644 mysql-test/suite/innodb/r/instant_alter_index_prefix.result delete mode 100644 mysql-test/suite/innodb/t/instant_alter_index_prefix.test diff --git a/mysql-test/suite/innodb/r/instant_alter_index_prefix.result b/mysql-test/suite/innodb/r/instant_alter_index_prefix.result deleted file mode 100644 index c38870b25bae..000000000000 --- a/mysql-test/suite/innodb/r/instant_alter_index_prefix.result +++ /dev/null @@ -1,38 +0,0 @@ -without prefix field in the index -CREATE TABLE t1 (c1 TINYTEXT COLLATE ascii_bin NOT NULL, c2 DATETIME(3) NOT NULL, c3 TEXT, UNIQUE KEY (c1(30))); -INSERT INTO t1 (c1, c2, c3) VALUE ('k1','2021-12-21','something'); -INSERT INTO t1 (c1, c2, c3) VALUE ('k3','2021-12-21','something else'); -ALTER TABLE t1 ADD COLUMN c4 VARCHAR(18) NOT NULL, ALGORITHM=INSTANT; -SET GLOBAL innodb_log_checkpoint_now = ON; -SET GLOBAL innodb_page_cleaner_disabled_debug = 1; -SET GLOBAL innodb_dict_stats_disabled_debug = 1; -SET GLOBAL innodb_master_thread_disabled_debug = 1; -SET GLOBAL innodb_checkpoint_disabled = ON; -UPDATE t1 SET c4 = 'value' WHERE c1 = 'k1'; -# Restart the server and reload the table to see if tables are corrupted. -# Kill and restart -# Run a select to confirm that the database started up successfully -SELECT * FROM t1; -c1 c2 c3 c4 -k1 2021-12-21 00:00:00.000 something value -k3 2021-12-21 00:00:00.000 something else -DROP TABLE t1; -with prefix field in the index -CREATE TABLE t1 (c1 TINYTEXT COLLATE ascii_bin NOT NULL, c2 DATETIME(3) NOT NULL, c3 TEXT, PRIMARY KEY (c1(30))); -INSERT INTO t1 (c1, c2, c3) VALUE ('k1','2021-12-21','something'); -INSERT INTO t1 (c1, c2, c3) VALUE ('k3','2021-12-21','something else'); -ALTER TABLE t1 ADD COLUMN c4 VARCHAR(18) NOT NULL, ALGORITHM=INSTANT; -SET GLOBAL innodb_log_checkpoint_now = ON; -SET GLOBAL innodb_page_cleaner_disabled_debug = 1; -SET GLOBAL innodb_dict_stats_disabled_debug = 1; -SET GLOBAL innodb_master_thread_disabled_debug = 1; -SET GLOBAL innodb_checkpoint_disabled = ON; -UPDATE t1 SET c4 = 'value' WHERE c1 = 'k1'; -# Restart the server and reload the table to see if tables are corrupted. -# Kill and restart -# Run a select to confirm that the database started up successfully -SELECT * FROM t1; -c1 c2 c3 c4 -k1 2021-12-21 00:00:00.000 something value -k3 2021-12-21 00:00:00.000 something else -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/instant_alter_index_prefix.test b/mysql-test/suite/innodb/t/instant_alter_index_prefix.test deleted file mode 100644 index f01ac58105bc..000000000000 --- a/mysql-test/suite/innodb/t/instant_alter_index_prefix.test +++ /dev/null @@ -1,50 +0,0 @@ -# PS-9222 Testing if ALGORITHM=INSTANT crashes server -source include/have_debug.inc; - ---echo without prefix field in the index -CREATE TABLE t1 (c1 TINYTEXT COLLATE ascii_bin NOT NULL, c2 DATETIME(3) NOT NULL, c3 TEXT, UNIQUE KEY (c1(30))); -INSERT INTO t1 (c1, c2, c3) VALUE ('k1','2021-12-21','something'); -INSERT INTO t1 (c1, c2, c3) VALUE ('k3','2021-12-21','something else'); - -ALTER TABLE t1 ADD COLUMN c4 VARCHAR(18) NOT NULL, ALGORITHM=INSTANT; - -SET GLOBAL innodb_log_checkpoint_now = ON; -SET GLOBAL innodb_page_cleaner_disabled_debug = 1; -SET GLOBAL innodb_dict_stats_disabled_debug = 1; -SET GLOBAL innodb_master_thread_disabled_debug = 1; -SET GLOBAL innodb_checkpoint_disabled = ON; - -UPDATE t1 SET c4 = 'value' WHERE c1 = 'k1'; - ---echo # Restart the server and reload the table to see if tables are corrupted. ---source include/kill_and_restart_mysqld.inc - --- echo # Run a select to confirm that the database started up successfully -SELECT * FROM t1; - -# cleanup -DROP TABLE t1; - ---echo with prefix field in the index -CREATE TABLE t1 (c1 TINYTEXT COLLATE ascii_bin NOT NULL, c2 DATETIME(3) NOT NULL, c3 TEXT, PRIMARY KEY (c1(30))); -INSERT INTO t1 (c1, c2, c3) VALUE ('k1','2021-12-21','something'); -INSERT INTO t1 (c1, c2, c3) VALUE ('k3','2021-12-21','something else'); - -ALTER TABLE t1 ADD COLUMN c4 VARCHAR(18) NOT NULL, ALGORITHM=INSTANT; - -SET GLOBAL innodb_log_checkpoint_now = ON; -SET GLOBAL innodb_page_cleaner_disabled_debug = 1; -SET GLOBAL innodb_dict_stats_disabled_debug = 1; -SET GLOBAL innodb_master_thread_disabled_debug = 1; -SET GLOBAL innodb_checkpoint_disabled = ON; - -UPDATE t1 SET c4 = 'value' WHERE c1 = 'k1'; - ---echo # Restart the server and reload the table to see if tables are corrupted. ---source include/kill_and_restart_mysqld.inc - --- echo # Run a select to confirm that the database started up successfully -SELECT * FROM t1; - -# cleanup -DROP TABLE t1; diff --git a/storage/innobase/mtr/mtr0log.cc b/storage/innobase/mtr/mtr0log.cc index 6d205c7221a4..51704f1446d1 100644 --- a/storage/innobase/mtr/mtr0log.cc +++ b/storage/innobase/mtr/mtr0log.cc @@ -862,8 +862,8 @@ bool mlog_open_and_write_index(mtr_t *mtr, const byte *rec, if (col->is_instant_added() || col->is_instant_dropped()) { continue; - } else if (col->get_col_phy_pos() >= phy_pos) { - phy_pos = col->get_col_phy_pos(); + } else if (col->get_phy_pos() >= phy_pos) { + phy_pos = col->get_phy_pos(); } else { fields_with_changed_order[i] = true; }