Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-35941 : galera_bf_abort_lock_table fails with wait for metadata … #3801

Open
wants to merge 1 commit into
base: 10.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions mysql-test/include/wait_condition_with_debug_and_kill.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# include/wait_condition_with_debug_and_kill.inc
#
# SUMMARY
#
# Waits until the passed statement returns true, or the operation
# times out. If the operation times out, the additional error
# statement will be executed and server is killed.
#
# USAGE
#
# let $wait_condition=
# SELECT c = 3 FROM t;
# let $wait_condition_on_error_output= select count(*) from t;
# [let $explicit_default_wait_timeout= N] # to override the default reset
# --source include/wait_condition_with_debug.inc
#
# OR
#
# let $wait_timeout= 60; # Override default 30 seconds with 60.
# let $wait_condition=
# SELECT c = 3 FROM t;
# let $wait_condition_on_error_output= select count(*) from t;
# --source include/wait_condition_with_debug.inc
# --echo Executed the test condition $wait_condition_reps times
#
#
# EXAMPLE
# events_bugs.test, events_time_zone.test
#

let $wait_counter= 300;
if ($wait_timeout)
{
let $wait_counter= `SELECT $wait_timeout * 10`;
}
# Reset $wait_timeout so that its value won't be used on subsequent
# calls, and default will be used instead.
if ($explicit_default_wait_timeout)
{
--let $wait_timeout= $explicit_default_wait_timeout
}
if (!$explicit_default_wait_timeout)
{
--let $wait_timeout= 0
}

# Keep track of how many times the wait condition is tested
# This is used by some tests (e.g., main.status)
let $wait_condition_reps= 0;
while ($wait_counter)
{
--error 0,ER_NO_SUCH_TABLE,ER_LOCK_WAIT_TIMEOUT,ER_UNKNOWN_COM_ERROR,ER_LOCK_DEADLOCK
let $success= `$wait_condition`;
inc $wait_condition_reps;
if ($success)
{
let $wait_counter= 0;
}
if (!$success)
{
real_sleep 0.1;
dec $wait_counter;
}
}
if (!$success)
{
echo Timeout in wait_condition.inc for $wait_condition;
--eval $wait_condition_on_error_output
--source include/kill_galera.inc
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ LOCK TABLE t1 WRITE;
connection node_1;
INSERT INTO t1 VALUES (2);
connection node_2;
SET SESSION wsrep_sync_wait = 0;
UNLOCK TABLES;
COMMIT;
SELECT COUNT(*) = 1 FROM t1;
Expand Down
6 changes: 6 additions & 0 deletions mysql-test/suite/galera/t/galera_bf_abort_lock_table.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
!include ../galera_2nodes.cnf

[mysqld.1]
wsrep-debug=1
loose-galera-bf-abort-lock-table=1

8 changes: 6 additions & 2 deletions mysql-test/suite/galera/t/galera_bf_abort_lock_table.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/force_restart.inc

#
# Test that a local LOCK TABLE will NOT be broken by an incoming remote transaction against that table
Expand All @@ -16,13 +17,16 @@ LOCK TABLE t1 WRITE;
INSERT INTO t1 VALUES (2);

--connection node_2
SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'
--source include/wait_condition.inc
--let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
--source include/wait_condition_with_debug_and_kill.inc

UNLOCK TABLES;

--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'
--source include/wait_condition.inc
--let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
--source include/wait_condition_with_debug_and_kill.inc

COMMIT;
SELECT COUNT(*) = 1 FROM t1;
Expand Down
6 changes: 2 additions & 4 deletions mysql-test/suite/galera/t/mysql-wsrep#198.cnf
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
!include ../galera_2nodes.cnf

[mysqld.1]
[mysqld]
log-bin
wsrep-debug=1
loose-mysql-wsrep198=1

[mysqld.1]
log-bin
wsrep-debug=1
3 changes: 2 additions & 1 deletion mysql-test/suite/galera/t/mysql-wsrep#198.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ LOCK TABLE t2 WRITE;
--connection node_2
SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Waiting for table metadata lock'
--source include/wait_condition.inc
--let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
--source include/wait_condition_with_debug_and_kill.inc

--connection node_1
INSERT INTO t2 VALUES (1);
Expand Down