Debian Codegraph @

mysql-test/suite/binlog/t/binlog_autocommit_off_no_hang.test

raw
1 #
2 # Purpose:
3 # When the mysql.gtid_slave_pos table uses the InnoDB engine, and mysqld
4 # starts, it reads the table and begins a transaction. After mysqld reads the
5 # value, it should end the transaction and release all associated locks.
6 # The bug reported in DBAAS-7828 shows that when autocommit is off, the locks
7 # are not released, resulting in indefinite hangs on future attempts to change
8 # gtid_slave_pos. This test ensures its fix such that the locks are properly
9 # released.
10 #
11 # References:
12 # DBAAS-7828: Primary/replica: configuration change of "autocommit=0" can
13 # not be applied
14 #
15
16 --source include/have_innodb.inc
17 --source include/have_log_bin.inc
18
19 # Reading gtid_slave_pos table is format independent so just use one for
20 # reduced test time
21 --source include/have_binlog_format_row.inc
22
23 --let old_slave_pos_engine= query_get_value(SHOW TABLE STATUS FROM mysql LIKE 'gtid_slave_pos', Engine, 1)
24
25 # Use a transactional engine
26 ALTER TABLE mysql.gtid_slave_pos ENGINE=innodb;
27
28 --echo # Restart the server so mysqld reads the gtid_slave_pos using innodb
29 --write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
30 --shutdown_server
31 --source include/wait_until_disconnected.inc
32 --write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
33 --enable_reconnect
34 --source include/wait_until_connected_again.inc
35
36 --echo # Set gtid_slave_pos should not hang
37 SET GLOBAL gtid_slave_pos=@@gtid_binlog_pos;
38 COMMIT;
39
40 # Revert table type
41 --disable_query_log
42 --eval ALTER TABLE mysql.gtid_slave_pos ENGINE=$old_slave_pos_engine
43 --enable_query_log
44
45 RESET MASTER;