Skip to content

Commit

Permalink
MDEV-27039 Trying to lock mutex ... when the mutex was already locked
Browse files Browse the repository at this point in the history
The reason of the double lock was an extraneous ha_flush_logs().
Unlike the upstream it is unnecessary in Mariadb that exploits a binlog
checkpoint mechanism for not letting PURGE or RESET-MASTER to trouble
transaction recovery. That is in case should a trx
be prepared but its binlog file gone, the trx then is committed on disk too.
Those facts have been always verified by existing tests of

  binlog.binlog_{checkpoint,xa_recover}.test.

A regression test for the bug is included though.
  • Loading branch information
andrelkin committed Jan 3, 2022
1 parent 3e03048 commit 30b917d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 0 additions & 1 deletion sql/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7029,7 +7029,6 @@ void MYSQL_BIN_LOG::purge()
DBUG_EXECUTE_IF("expire_logs_always", { purge_time = my_time(0); });
if (purge_time >= 0)
{
ha_flush_logs();
purge_logs_before_date(purge_time);
}
DEBUG_SYNC(current_thd, "after_purge_logs_before_date");
Expand Down
7 changes: 7 additions & 0 deletions storage/spider/mysql-test/spider/r/spider_fixes.result
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,13 @@ connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
connection child2_2;
DROP DATABASE IF EXISTS auto_test_remote2;
connection master_1;
SET @@global.expire_logs_days=11;
connect master_purge, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK;
SET @@global.binlog_checksum=NONE;
SET @@global.binlog_checksum=$binlog_checksum;
SET @@global.expire_logs_days=$expire_logs_days;
disconnect master_purge;
for slave1_1
for master_1
for child2
Expand Down
15 changes: 15 additions & 0 deletions storage/spider/mysql-test/spider/t/spider_fixes.test
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,21 @@ if ($USE_CHILD_GROUP2)
--connection child2_2
DROP DATABASE IF EXISTS auto_test_remote2;
}


# MDEV-27039 LOCK_global_system_variables attempted to re-acquire
# The test proves no assert anymore.
--connection master_1
--let $binlog_checksum=`SELECT @@global.binlog_checksum`
--let $expire_logs_days=`SELECT @@global.expire_logs_days`
SET @@global.expire_logs_days=11;

--connect (master_purge, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK)
SET @@global.binlog_checksum=NONE;
--evalp SET @@global.binlog_checksum=$binlog_checksum
--evalp SET @@global.expire_logs_days=$expire_logs_days
--disconnect master_purge

--disable_query_log
--disable_result_log
--source slave_test_deinit.inc
Expand Down

0 comments on commit 30b917d

Please sign in to comment.