summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-04-21 23:01:20 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-04-22 00:01:16 +0530
commit7591d8ebb23c9d976686d5f531b341d983dab74b (patch)
tree29ff4588ad2c10e56b849b12ed104986fac9bf85
parent940c62b9303f5053f49509d851948a90b63e655d (diff)
downloadmariadb-git-bb-10.6-MDEV-15250-unreachable.tar.gz
prepare_inplace_alter_table_dict(): After allocating online log,bb-10.6-MDEV-15250-unreachable
InnoDB does create fulltext common tables. fulltext index doesn't allow the index to be online. So removed the dead code of online log removal commit_inplace_alter_table(): Added the assert that InnoDB won't encounter the fulltext indexes, spatial indexes in newly added indexes if ctx->online is true. UndorecApplier::log_insert(): Undo log will always find the matching clustered index record
-rw-r--r--mysql-test/suite/innodb/r/alter_dml_apply.result39
-rw-r--r--mysql-test/suite/innodb/r/insert_into_empty_debug.result72
-rw-r--r--mysql-test/suite/innodb/r/online_table_rebuild.result47
-rw-r--r--mysql-test/suite/innodb/t/alter_dml_apply.opt2
-rw-r--r--mysql-test/suite/innodb/t/alter_dml_apply.test58
-rw-r--r--mysql-test/suite/innodb/t/insert_into_empty_debug.test80
-rw-r--r--mysql-test/suite/innodb/t/online_table_rebuild.opt2
-rw-r--r--mysql-test/suite/innodb/t/online_table_rebuild.test62
-rw-r--r--mysql-test/suite/innodb_fts/r/misc_debug.result9
-rw-r--r--mysql-test/suite/innodb_fts/t/misc_debug.test12
-rw-r--r--storage/innobase/handler/handler0alter.cc42
-rw-r--r--storage/innobase/row/row0log.cc33
-rw-r--r--storage/innobase/row/row0umod.cc1
13 files changed, 399 insertions, 60 deletions
diff --git a/mysql-test/suite/innodb/r/alter_dml_apply.result b/mysql-test/suite/innodb/r/alter_dml_apply.result
new file mode 100644
index 00000000000..c9def9d6a41
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_dml_apply.result
@@ -0,0 +1,39 @@
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
+f3 CHAR(200), f4 CHAR(200),
+PRIMARY KEY(f1))ENGINE=InnoDB;
+INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
+SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
+ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD UNIQUE INDEX(f4(10));
+connect con1,localhost,root,,,;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+BEGIN;
+DELETE FROM t1 WHERE f1= 6000;
+INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
+ROLLBACK;
+BEGIN;
+DELETE FROM t1 WHERE f1= 6000;
+INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
+INSERT INTO t1 SELECT seq, seq, repeat('a', 200), repeat('b', 200) FROM seq_1_to_4000;
+COMMIT;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+connection default;
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
+SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
+ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD INDEX(f3(10));
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+BEGIN;
+DELETE FROM t1;
+INSERT INTO t1 SELECT seq, seq, repeat('d', 200), repeat('e', 200) FROM
+seq_1_to_4000;
+UPDATE t1 SET f3=repeat('c', 200), f4= repeat('d', 200), f2=3;
+COMMIT;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+connection default;
+ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
+disconnect con1;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+SET DEBUG_SYNC=reset;
diff --git a/mysql-test/suite/innodb/r/insert_into_empty_debug.result b/mysql-test/suite/innodb/r/insert_into_empty_debug.result
new file mode 100644
index 00000000000..3f5039646a6
--- /dev/null
+++ b/mysql-test/suite/innodb/r/insert_into_empty_debug.result
@@ -0,0 +1,72 @@
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
+PRIMARY KEY(f1))ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1, 2), (2, 2);
+SET DEBUG_SYNC="innodb_rollback_inplace_alter_table SIGNAL dml_start WAIT_FOR dml_commit";
+ALTER TABLE t1 ADD UNIQUE KEY(f2);
+connect con1,localhost,root,,,;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+BEGIN;
+DELETE FROM t1;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+connection default;
+ERROR 23000: Duplicate entry '2' for key 'f2'
+SET DEBUG_SYNC="now SIGNAL dml_resume";
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR dml_resume";
+COMMIT;
+InnoDB 0 transactions not purged
+SET unique_checks=0, foreign_key_checks=0;
+BEGIN;
+INSERT INTO t1 VALUES(1, 2);
+ROLLBACK;
+connection default;
+SELECT * FROM t1;
+f1 f2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(1, 1);
+SET DEBUG_SYNC="now SIGNAL purge_stop";
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR purge_stop";
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+SET DEBUG_SYNC="now SIGNAL delete_start";
+connect con2,localhost,root,,,;
+SET DEBUG_SYNC="now WAIT_FOR delete_start";
+DELETE FROM t1;
+SET DEBUG_SYNC="now SIGNAL ddl_start";
+connection default;
+SET DEBUG_SYNC="now WAIT_FOR ddl_start";
+SET DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL purge_resume WAIT_FOR dml_commit";
+ALTER TABLE t1 ADD INDEX(f2, f1);
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR purge_resume";
+COMMIT;
+SET DEBUG_SYNC="now SIGNAL dml_start";
+connection con2;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+InnoDB 1 transactions not purged
+SET unique_checks=0, foreign_key_checks=0;
+BEGIN;
+INSERT INTO t1 VALUES(2, 2);
+ROLLBACK;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+connection default;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) NOT NULL,
+ PRIMARY KEY (`f1`),
+ KEY `f2` (`f2`,`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
+SET DEBUG_SYNC=RESET;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=default;
diff --git a/mysql-test/suite/innodb/r/online_table_rebuild.result b/mysql-test/suite/innodb/r/online_table_rebuild.result
new file mode 100644
index 00000000000..0ba26fca1d9
--- /dev/null
+++ b/mysql-test/suite/innodb/r/online_table_rebuild.result
@@ -0,0 +1,47 @@
+CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(200), f3 CHAR(200))ENGINE=InnoDB;
+INSERT INTO t1 VALUES(3, "innodb", "alter log");
+SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
+ALTER TABLE t1 ADD PRIMARY KEY(f3(10)), ADD UNIQUE KEY(f2(10));
+CONNECT con1,localhost,root,,,;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+BEGIN;
+INSERT INTO t1 VALUES(1, repeat('b', 100), repeat('c', 100));
+INSERT INTO t1 VALUES(2, repeat('b', 100), repeat('a', 100));
+COMMIT;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+connection default;
+ERROR 23000: Duplicate entry 'bbbbbbbbbb' for key 'f2'
+connection default;
+SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
+ALTER TABLE t1 ADD PRIMARY KEY(f1);
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+INSERT INTO t1 SELECT 10, repeat('a', 100), repeat('b', 100) FROM seq_1_to_4800;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+connection default;
+ERROR HY000: Creating index 'PRIMARY' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again
+DELETE FROM t1;
+INSERT INTO t1 VALUES(1, repeat('a', 100), repeat('b', 100));
+ALTER TABLE t1 ADD PRIMARY KEY(f1);
+set DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_commit";
+ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(f3(10));
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+BEGIN;
+INSERT INTO t1 VALUES(2, repeat('b', 100), repeat('c', 100));
+UPDATE t1 set f3=repeat('c', 100) where f1=1;
+COMMIT;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+connection default;
+ERROR 23000: Duplicate entry 'cccccccccc' for key 'PRIMARY'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` char(200) DEFAULT NULL,
+ `f3` char(200) DEFAULT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+disconnect con1;
+SET DEBUG_SYNC=reset;
diff --git a/mysql-test/suite/innodb/t/alter_dml_apply.opt b/mysql-test/suite/innodb/t/alter_dml_apply.opt
new file mode 100644
index 00000000000..fa3418284bf
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_dml_apply.opt
@@ -0,0 +1,2 @@
+--innodb_online_alter_log_max_size=64k
+--innodb_sort_buffer_size=64k
diff --git a/mysql-test/suite/innodb/t/alter_dml_apply.test b/mysql-test/suite/innodb/t/alter_dml_apply.test
new file mode 100644
index 00000000000..4d6fd418691
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_dml_apply.test
@@ -0,0 +1,58 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_sequence.inc
+
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
+ f3 CHAR(200), f4 CHAR(200),
+ PRIMARY KEY(f1))ENGINE=InnoDB;
+INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
+
+# InnoDB DML thread applies the online log, aborts other online index
+
+SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
+SEND ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD UNIQUE INDEX(f4(10));
+
+# InnoDB DML thread applies insert log
+
+connect(con1,localhost,root,,,);
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+# Rollback should avoid online index
+BEGIN;
+DELETE FROM t1 WHERE f1= 6000;
+INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
+ROLLBACK;
+
+# Insert log will fetch the previous version in this case
+BEGIN;
+DELETE FROM t1 WHERE f1= 6000;
+INSERT INTO t1 VALUES(6000, 6000, "InnoDB", "MariaDB");
+INSERT INTO t1 SELECT seq, seq, repeat('a', 200), repeat('b', 200) FROM seq_1_to_4000;
+COMMIT;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+
+connection default;
+--error ER_DUP_ENTRY
+reap;
+
+# DML Thread applies update log
+
+SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
+SEND ALTER TABLE t1 ADD UNIQUE KEY(f2), ADD INDEX(f3(10));
+
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+BEGIN;
+DELETE FROM t1;
+INSERT INTO t1 SELECT seq, seq, repeat('d', 200), repeat('e', 200) FROM
+seq_1_to_4000;
+UPDATE t1 SET f3=repeat('c', 200), f4= repeat('d', 200), f2=3;
+COMMIT;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+
+connection default;
+--error ER_DUP_ENTRY
+reap;
+disconnect con1;
+CHECK TABLE t1;
+DROP TABLE t1;
+SET DEBUG_SYNC=reset;
diff --git a/mysql-test/suite/innodb/t/insert_into_empty_debug.test b/mysql-test/suite/innodb/t/insert_into_empty_debug.test
new file mode 100644
index 00000000000..af75c74e4a8
--- /dev/null
+++ b/mysql-test/suite/innodb/t/insert_into_empty_debug.test
@@ -0,0 +1,80 @@
+--source include/have_innodb.inc
+--source include/have_sequence.inc
+--source include/have_debug.inc
+
+# Encounter aborted online index during rollback of bulk insert
+
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
+ PRIMARY KEY(f1))ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1, 2), (2, 2);
+
+SET DEBUG_SYNC="innodb_rollback_inplace_alter_table SIGNAL dml_start WAIT_FOR dml_commit";
+send ALTER TABLE t1 ADD UNIQUE KEY(f2);
+
+connect(con1,localhost,root,,,);
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+BEGIN;
+DELETE FROM t1;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+
+connection default;
+--error ER_DUP_ENTRY
+reap;
+SET DEBUG_SYNC="now SIGNAL dml_resume";
+
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR dml_resume";
+COMMIT;
+--source include/wait_all_purged.inc
+SET unique_checks=0, foreign_key_checks=0;
+BEGIN;
+INSERT INTO t1 VALUES(1, 2);
+ROLLBACK;
+
+connection default;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+
+# Online alter logs ROW_LOG_EMPTY when table does bulk insert
+INSERT INTO t1 VALUES(1, 1);
+SET DEBUG_SYNC="now SIGNAL purge_stop";
+
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR purge_stop";
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+SET DEBUG_SYNC="now SIGNAL delete_start";
+
+connect(con2,localhost,root,,,);
+SET DEBUG_SYNC="now WAIT_FOR delete_start";
+DELETE FROM t1;
+SET DEBUG_SYNC="now SIGNAL ddl_start";
+
+connection default;
+SET DEBUG_SYNC="now WAIT_FOR ddl_start";
+SET DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL purge_resume WAIT_FOR dml_commit";
+send ALTER TABLE t1 ADD INDEX(f2, f1);
+
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR purge_resume";
+COMMIT;
+SET DEBUG_SYNC="now SIGNAL dml_start";
+
+connection con2;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+let $wait_all_purged=1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+--source include/wait_all_purged.inc
+SET unique_checks=0, foreign_key_checks=0;
+BEGIN;
+INSERT INTO t1 VALUES(2, 2);
+ROLLBACK;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+
+connection default;
+reap;
+SHOW CREATE TABLE t1;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
+SET DEBUG_SYNC=RESET;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=default;
diff --git a/mysql-test/suite/innodb/t/online_table_rebuild.opt b/mysql-test/suite/innodb/t/online_table_rebuild.opt
new file mode 100644
index 00000000000..fa3418284bf
--- /dev/null
+++ b/mysql-test/suite/innodb/t/online_table_rebuild.opt
@@ -0,0 +1,2 @@
+--innodb_online_alter_log_max_size=64k
+--innodb_sort_buffer_size=64k
diff --git a/mysql-test/suite/innodb/t/online_table_rebuild.test b/mysql-test/suite/innodb/t/online_table_rebuild.test
new file mode 100644
index 00000000000..94bac2f949c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/online_table_rebuild.test
@@ -0,0 +1,62 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_sequence.inc
+
+CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(200), f3 CHAR(200))ENGINE=InnoDB;
+INSERT INTO t1 VALUES(3, "innodb", "alter log");
+
+# InnoDB fails with DUPLICATE KEY error in commit phase
+
+SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
+send ALTER TABLE t1 ADD PRIMARY KEY(f3(10)), ADD UNIQUE KEY(f2(10));
+CONNECT(con1,localhost,root,,,);
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+BEGIN;
+INSERT INTO t1 VALUES(1, repeat('b', 100), repeat('c', 100));
+INSERT INTO t1 VALUES(2, repeat('b', 100), repeat('a', 100));
+COMMIT;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+
+connection default;
+--error ER_DUP_ENTRY
+reap;
+
+# ONLINE_LOG_TOO_BIG error during commit phase
+
+connection default;
+
+SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit";
+SEND ALTER TABLE t1 ADD PRIMARY KEY(f1);
+
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+INSERT INTO t1 SELECT 10, repeat('a', 100), repeat('b', 100) FROM seq_1_to_4800;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+
+connection default;
+--error ER_INNODB_ONLINE_LOG_TOO_BIG
+reap;
+DELETE FROM t1;
+INSERT INTO t1 VALUES(1, repeat('a', 100), repeat('b', 100));
+ALTER TABLE t1 ADD PRIMARY KEY(f1);
+
+# Update operation leads to duplicate key error
+
+set DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_commit";
+SEND ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(f3(10));
+
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR dml_start";
+BEGIN;
+INSERT INTO t1 VALUES(2, repeat('b', 100), repeat('c', 100));
+UPDATE t1 set f3=repeat('c', 100) where f1=1;
+COMMIT;
+SET DEBUG_SYNC="now SIGNAL dml_commit";
+
+connection default;
+--error ER_DUP_ENTRY
+reap;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+disconnect con1;
+SET DEBUG_SYNC=reset;
diff --git a/mysql-test/suite/innodb_fts/r/misc_debug.result b/mysql-test/suite/innodb_fts/r/misc_debug.result
index 2a2afacb052..f40ed1fe9c3 100644
--- a/mysql-test/suite/innodb_fts/r/misc_debug.result
+++ b/mysql-test/suite/innodb_fts/r/misc_debug.result
@@ -65,3 +65,12 @@ ERROR HY000: Got error -1 "Internal error < 0 (Not system error)" from storage e
SET debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
# End of 10.3 tests
+CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100))ENGINE=InnoDB;
+SET DEBUG_DBUG="+d,stats_lock_fail";
+ALTER TABLE t1 ADD FULLTEXT(f2);
+ERROR HY000: Got error 15 "Block device required" from storage engine InnoDB
+SET DEBUG_DBUG="-d,stats_lock_fail";
+ALTER TABLE t1 DISCARD TABLESPACE;
+ALTER TABLE t1 ADD FULLTEXT(f2);
+ERROR HY000: Tablespace has been discarded for table `t1`
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/misc_debug.test b/mysql-test/suite/innodb_fts/t/misc_debug.test
index 84da1320264..6ab980a3948 100644
--- a/mysql-test/suite/innodb_fts/t/misc_debug.test
+++ b/mysql-test/suite/innodb_fts/t/misc_debug.test
@@ -95,3 +95,15 @@ TRUNCATE t1;
SET debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
--echo # End of 10.3 tests
+
+# Fulltext fails in commit phase
+
+CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100))ENGINE=InnoDB;
+SET DEBUG_DBUG="+d,stats_lock_fail";
+--error ER_GET_ERRNO
+ALTER TABLE t1 ADD FULLTEXT(f2);
+SET DEBUG_DBUG="-d,stats_lock_fail";
+ALTER TABLE t1 DISCARD TABLESPACE;
+--error ER_TABLESPACE_DISCARDED
+ALTER TABLE t1 ADD FULLTEXT(f2);
+DROP TABLE t1;
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index d1e453dc509..6592d850525 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1306,7 +1306,6 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
else
{
DBUG_ASSERT(err_key < ha_alter_info->key_count);
- abort();
dup_key= &ha_alter_info->key_info_buffer[err_key];
}
print_keydup_error(altered_table, dup_key, MYF(0));
@@ -1314,12 +1313,10 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
case DB_ONLINE_LOG_TOO_BIG:
my_error(ER_INNODB_ONLINE_LOG_TOO_BIG, MYF(0),
get_error_key_name(err_key, ha_alter_info, new_table));
- abort();
break;
case DB_INDEX_CORRUPT:
my_error(ER_INDEX_CORRUPT, MYF(0),
get_error_key_name(err_key, ha_alter_info, new_table));
- abort();
break;
default:
my_error_innodb(error, old_table->name.m_name, old_table->flags);
@@ -7198,25 +7195,8 @@ error_handling:
ctx->trx->rollback();
- if (ctx->need_rebuild()) {
- /* Free the log for online table rebuild, if
- one was allocated. */
-
- dict_index_t* clust_index = dict_table_get_first_index(
- user_table);
-
- clust_index->lock.x_lock(SRW_LOCK_CALL);
-
- if (clust_index->online_log) {
- ut_ad(ctx->online);
- abort();
- row_log_abort_sec(clust_index);
- clust_index->online_status
- = ONLINE_INDEX_COMPLETE;
- }
-
- clust_index->lock.x_unlock();
- }
+ ut_ad(!ctx->need_rebuild()
+ || !user_table->indexes.start->online_log);
ctx->prebuilt->trx->error_info = NULL;
ctx->trx->error_state = DB_SUCCESS;
@@ -8753,6 +8733,8 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info,
DBUG_ENTER("rollback_inplace_alter_table");
+ DEBUG_SYNC_C("innodb_rollback_inplace_alter_table");
+
if (!ctx)
/* If we have not started a transaction yet,
(almost) nothing has been or needs to be done. */
@@ -11016,17 +10998,13 @@ lock_fail:
for (ulint i = 0; i < ctx->num_to_add_index; i++) {
dict_index_t *index= ctx->add_index[i];
- if (index->type & (DICT_FTS | DICT_SPATIAL)) {
- abort();
- continue;
- }
-
+ ut_ad(!(index->type &
+ (DICT_FTS | DICT_SPATIAL)));
index->lock.x_lock(SRW_LOCK_CALL);
if (!index->online_log) {
/* online log would've cleared
when we detect the error in
other index */
- abort();
index->lock.x_unlock();
continue;
}
@@ -11036,7 +11014,6 @@ lock_fail:
preserved to show the error
when it happened via
row_log_apply() by DML thread */
- abort();
error= row_log_get_error(index);
err_index:
ut_ad(error != DB_SUCCESS);
@@ -11050,7 +11027,6 @@ err_index:
ctx->old_table->indexes.start
->online_log= nullptr;
if (fts_exist) {
- abort();
purge_sys.resume_FTS();
}
MONITOR_ATOMIC_INC(
@@ -11105,6 +11081,10 @@ err_index:
error = lock_table_for_trx(index_stats, trx, LOCK_X);
}
}
+
+ DBUG_EXECUTE_IF("stats_lock_fail",
+ error= DB_LOCK_WAIT;);
+
if (error == DB_SUCCESS) {
error = lock_sys_tables(trx);
}
@@ -11119,7 +11099,6 @@ err_index:
}
my_error_innodb(error, table_share->table_name.str, 0);
if (fts_exist) {
- abort();
purge_sys.resume_FTS();
}
DBUG_RETURN(true);
@@ -11149,7 +11128,6 @@ fail:
}
row_mysql_unlock_data_dictionary(trx);
if (fts_exist) {
- abort();
purge_sys.resume_FTS();
}
trx_start_for_ddl(trx);
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index c59576515c1..e621a9c3cbc 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -258,7 +258,6 @@ row_log_block_free(
@param index index log to be cleared */
static void row_log_empty(dict_index_t *index)
{
- abort();
ut_ad(index->lock.have_s());
row_log_t *log= index->online_log;
@@ -323,7 +322,7 @@ bool row_log_online_op(dict_index_t *index, const dtuple_t *tuple,
log = index->online_log;
mysql_mutex_lock(&log->mutex);
-
+start_log:
if (trx_id > log->max_trx) {
log->max_trx = trx_id;
}
@@ -383,7 +382,6 @@ bool row_log_online_op(dict_index_t *index, const dtuple_t *tuple,
goto write_failed;
/* About to run out of log, InnoDB has to
apply the online log for the completed index */
- abort();
index->lock.s_unlock();
dberr_t error= row_log_apply(
log->alter_trx, index, nullptr, nullptr);
@@ -400,6 +398,8 @@ bool row_log_online_op(dict_index_t *index, const dtuple_t *tuple,
if (!index->online_log) {
goto err_exit;
}
+
+ goto start_log;
}
if (mrec_size == avail_size) {
@@ -2003,7 +2003,6 @@ func_exit_committed:
if (error != DB_SUCCESS) {
/* Report the erroneous row using the new
version of the table. */
- abort();
innobase_row_to_mysql(dup->table, log->table, row);
}
@@ -3846,7 +3845,6 @@ static void row_log_table_empty(dict_index_t *index)
dberr_t row_log_get_error(const dict_index_t *index)
{
ut_ad(index->online_log);
- abort();
return index->online_log->error;
}
@@ -3862,14 +3860,12 @@ void dict_table_t::clear(que_thr_t *thr)
switch (dict_index_get_online_status(index)) {
case ONLINE_INDEX_ABORTED:
case ONLINE_INDEX_ABORTED_DROPPED:
- abort();
continue;
case ONLINE_INDEX_COMPLETE:
break;
case ONLINE_INDEX_CREATION:
- abort();
index->lock.s_lock(SRW_LOCK_CALL);
if (dict_index_get_online_status(index) == ONLINE_INDEX_CREATION)
{
@@ -3936,7 +3932,6 @@ static void row_log_mark_other_online_index_abort(dict_table_t *table)
&& index->online_status <= ONLINE_INDEX_CREATION
&& !index->is_corrupted())
{
- abort();
index->lock.x_lock(SRW_LOCK_CALL);
row_log_abort_sec(index);
index->type|= DICT_CORRUPT;
@@ -3966,14 +3961,7 @@ void UndorecApplier::log_insert(const dtuple_t &tuple,
mtr.start();
rec_t *rec;
rec_t *match_rec= get_old_rec(tuple, clust_index, &rec, &offsets, &mtr);
- if (!match_rec)
- {
- /* Undo log record doesn't fit into the undo log page.
- In that case, clustered index record won't be found */
- mtr.commit();
- return;
- }
-
+ ut_a(match_rec);
rec_t *copy_rec= match_rec;
if (match_rec == rec)
{
@@ -4029,7 +4017,6 @@ void UndorecApplier::log_insert(const dtuple_t &tuple,
index->lock.s_unlock();
if (!success)
{
- abort();
row_log_mark_other_online_index_abort(index->table);
return;
}
@@ -4066,13 +4053,7 @@ void UndorecApplier::log_update(const dtuple_t &tuple,
bool is_update= (type == TRX_UNDO_UPD_EXIST_REC);
rec_t *match_rec= get_old_rec(
tuple, clust_index, &rec, &offsets, &mtr);
- if (!match_rec)
- {
- abort();
- mtr.commit();
- return;
- }
-
+ ut_a(match_rec);
if (table_rebuild)
{
rec_t *copy_rec= match_rec;
@@ -4110,8 +4091,7 @@ void UndorecApplier::log_update(const dtuple_t &tuple,
row_ext_t *new_ext;
if (match_rec != rec)
{
- abort();
- row= row_build(ROW_COPY_POINTERS, clust_index, rec, offsets,
+ row= row_build(ROW_COPY_POINTERS, clust_index, match_rec, offsets,
clust_index->table, NULL, NULL, &new_ext, heap);
}
else
@@ -4171,7 +4151,6 @@ void UndorecApplier::log_update(const dtuple_t &tuple,
index->lock.s_unlock();
if (!success)
{
- abort();
row_log_mark_other_online_index_abort(index->table);
return;
}
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index 46c51aad440..f18d7ab1be1 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -857,7 +857,6 @@ row_undo_mod_upd_del_sec(
dtuple_t* entry;
if (index->type & DICT_FTS || !index->is_committed()) {
- abort();
dict_table_next_uncorrupted_index(node->index);
continue;
}