Commit 49e3bd2c authored by Daniele Sciascia's avatar Daniele Sciascia Committed by Jan Lindström

MDEV-27553 Assertion `inited==INDEX' failed: in ha_index_end()

In wsrep_schema code, call ha_index_end() only if the corresponding
ha_index_init() call succeeded.
Reviewed-by: default avatarJan Lindström <jan.lindstrom@mariadb.com>
parent b915f79e
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
connection node_1;
SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
SET @@global.debug_dbug="+d,ha_index_init_fail";
ROLLBACK;
connection node_2;
SELECT COUNT(*) `Expect 0` FROM mysql.wsrep_streaming_log;
Expect 0
0
connection node_1;
SET @@global.debug_dbug="";
SELECT COUNT(*) `Expect 1` FROM mysql.wsrep_streaming_log;
Expect 1
1
SET SESSION wsrep_on=OFF;
DELETE FROM mysql.wsrep_streaming_log;
SET SESSION wsrep_on=ON;
DROP TABLE t1;
CALL mtr.add_suppression("WSREP: Failed to init table for index scan");
#
# MDEV-27553 Assertion `inited==INDEX' failed: int handler::ha_index_end()
#
--source include/galera_cluster.inc
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
--connection node_1
--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
# This will result in failure to remove fragments
# from streaming log, in the following ROLLBACK.
SET @@global.debug_dbug="+d,ha_index_init_fail";
ROLLBACK;
--connection node_2
SELECT COUNT(*) `Expect 0` FROM mysql.wsrep_streaming_log;
--connection node_1
SET @@global.debug_dbug="";
SELECT COUNT(*) `Expect 1` FROM mysql.wsrep_streaming_log;
SET SESSION wsrep_on=OFF;
DELETE FROM mysql.wsrep_streaming_log;
SET SESSION wsrep_on=ON;
DROP TABLE t1;
CALL mtr.add_suppression("WSREP: Failed to init table for index scan");
......@@ -598,9 +598,11 @@ static int init_for_index_scan(TABLE* table, const uchar* key,
*/
static int end_index_scan(TABLE* table) {
int error;
if ((error= table->file->ha_index_end())) {
WSREP_ERROR("Failed to end scan: %d", error);
return 1;
if (table->file->inited) {
if ((error= table->file->ha_index_end())) {
WSREP_ERROR("Failed to end scan: %d", error);
return 1;
}
}
return 0;
}
......
Subproject commit 6fd1fdf69044bb6a08c488cec52668bbb31dd8aa
Subproject commit da5098b622bc6f92c9265bacf4c1168fd69b38b5
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment