Skip to content

Commit db18808

Browse files
MDEV-36771 Assertion 'bulk_insert == TRX_NO_BULK' failed in trx_t::assert_freed
- InnoDB fails to reset bulk_insert of a transaction while freeing the transaction during shutting down of a server.
1 parent 3da36fa commit db18808

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

mysql-test/suite/innodb/r/insert_into_empty.result

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,4 +580,20 @@ WHERE variable_name = 'innodb_bulk_operations';
580580
bulk_operations
581581
1
582582
DROP TABLE t1;
583+
call mtr.add_suppression("Found 1 prepared XA transactions");
584+
#
585+
# MDEV-36771 Assertion `bulk_insert == TRX_NO_BULK' failed
586+
# in trx_t::assert_freed from innodb_shutdown
587+
#
588+
CREATE TABLE t1(f1 INT)ENGINE=InnoDB;
589+
XA START 'a';
590+
INSERT INTO t1 VALUES(1);
591+
XA END 'a';
592+
XA PREPARE 'a';
593+
# restart
594+
XA COMMIT 'a';
595+
SELECT * FROM t1;
596+
f1
597+
1
598+
DROP TABLE t1;
583599
# End of 10.11 tests

mysql-test/suite/innodb/t/insert_into_empty.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,4 +638,19 @@ SELECT variable_value-@old_bulk_op bulk_operations
638638
FROM information_schema.global_status
639639
WHERE variable_name = 'innodb_bulk_operations';
640640
DROP TABLE t1;
641+
642+
call mtr.add_suppression("Found 1 prepared XA transactions");
643+
--echo #
644+
--echo # MDEV-36771 Assertion `bulk_insert == TRX_NO_BULK' failed
645+
--echo # in trx_t::assert_freed from innodb_shutdown
646+
--echo #
647+
CREATE TABLE t1(f1 INT)ENGINE=InnoDB;
648+
XA START 'a';
649+
INSERT INTO t1 VALUES(1);
650+
XA END 'a';
651+
XA PREPARE 'a';
652+
--source include/restart_mysqld.inc
653+
XA COMMIT 'a';
654+
SELECT * FROM t1;
655+
DROP TABLE t1;
641656
--echo # End of 10.11 tests

storage/innobase/trx/trx0trx.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ TRANSACTIONAL_TARGET void trx_free_at_shutdown(trx_t *trx)
515515
ut_a(trx->magic_n == TRX_MAGIC_N);
516516

517517
ut_d(trx->apply_online_log = false);
518+
trx->bulk_insert = 0;
518519
trx->commit_state();
519520
trx->release_locks();
520521
trx->mod_tables.clear();

0 commit comments

Comments
 (0)