Skip to content

Commit

Permalink
Merge mariadb-10.2.41 into 10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Nov 9, 2021
2 parents 7c30bc3 + 561b6c7 commit 75f0c59
Show file tree
Hide file tree
Showing 23 changed files with 477 additions and 277 deletions.
7 changes: 7 additions & 0 deletions mysql-test/suite/galera/r/galera_UK_conflict.result
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ f1 f2 f3
10 10 0
INSERT INTO t1 VALUES (7,7,7);
INSERT INTO t1 VALUES (8,8,8);
SELECT COUNT(*) FROM t1;
COUNT(*)
7
SELECT * FROM t1;
f1 f2 f3
1 1 0
Expand All @@ -78,12 +81,16 @@ f1 f2 f3
8 8 8
10 10 0
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
7
SELECT * FROM t1;
f1 f2 f3
1 1 0
3 3 1
4 4 2
5 5 2
7 7 7
8 8 8
10 10 0
DROP TABLE t1;
10 changes: 6 additions & 4 deletions mysql-test/suite/galera/r/galera_ssl_upgrade.result
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
connection node_1;
call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
call mtr.add_suppression("WSREP: write_handler().*");
connection node_2;
call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
call mtr.add_suppression("WSREP: write_handler():.*");
connection node_1;
connection node_2;
connection node_1;
Expand All @@ -24,5 +24,7 @@ connection node_1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
disconnect node_2;
disconnect node_1;
connection node_1;
call mtr.add_suppression("WSREP: write_handler().*");
connection node_2;
call mtr.add_suppression("WSREP: write_handler():.*");
30 changes: 30 additions & 0 deletions mysql-test/suite/galera/r/galera_to_error.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
connection node_1;
connection node_2;
connection node_1;
call mtr.add_suppression("WSREP: TO isolation failed for: ");
CREATE TABLE t2(a int not null auto_increment primary key, b int, key(b)) engine=innodb;
INSERT INTO t2 values (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6);
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
BEGIN;
UPDATE t2 set b = b + 20 where b BETWEEN 2 and 5;;
connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1b;
connection node_2;
Killing server ...
connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1c;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
Got one of the listed errors
Got one of the listed errors
CREATE UNIQUE INDEX b2 ON t2(b);
Got one of the listed errors
connection node_1;
disconnect node_1a;
disconnect node_1b;
disconnect node_1c;
connection node_2;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
DROP TABLE t2;
disconnect node_2;
disconnect node_1;
16 changes: 0 additions & 16 deletions mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,6 @@ connection node_1a;
connection node_1b;
connection node_2;
connection node_2a;
connection node_1;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) FROM parent;
COUNT(*)
20001
SELECT COUNT(*) FROM child;
COUNT(*)
10000
connection node_2;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) FROM parent;
COUNT(*)
20001
SELECT COUNT(*) FROM child;
COUNT(*)
10000
DROP TABLE child;
DROP TABLE parent;
DROP TABLE ten;
4 changes: 4 additions & 0 deletions mysql-test/suite/galera/t/galera_UK_conflict.test
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,13 @@ SELECT * FROM t1;
# original state in node 1
INSERT INTO t1 VALUES (7,7,7);
INSERT INTO t1 VALUES (8,8,8);
SELECT COUNT(*) FROM t1;
SELECT * FROM t1;

--connection node_1
--let $wait_condition = SELECT COUNT(*) = 7 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) FROM t1;
SELECT * FROM t1;

DROP TABLE t1;
10 changes: 7 additions & 3 deletions mysql-test/suite/galera/t/galera_ssl_upgrade.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
--source include/have_ssl_communication.inc

--connection node_1
call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
call mtr.add_suppression("WSREP: write_handler().*");
--connection node_2
call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
call mtr.add_suppression("WSREP: write_handler():.*");

# Save original auto_increment_offset values.
--let $node_1=node_1
Expand Down Expand Up @@ -72,4 +72,8 @@ SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N
# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc

--source include/galera_end.inc
--connection node_1
call mtr.add_suppression("WSREP: write_handler().*");
--connection node_2
call mtr.add_suppression("WSREP: write_handler():.*");

71 changes: 71 additions & 0 deletions mysql-test/suite/galera/t/galera_to_error.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#
# Confirm that with two nodes, killing one causes the other to stop accepting connections
#

--source include/galera_cluster.inc
--source include/have_innodb.inc

# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc

--connection node_1
call mtr.add_suppression("WSREP: TO isolation failed for: ");
--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`

CREATE TABLE t2(a int not null auto_increment primary key, b int, key(b)) engine=innodb;
INSERT INTO t2 values (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6);

--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
BEGIN;
--send UPDATE t2 set b = b + 20 where b BETWEEN 2 and 5;

#
# Take thread id for above query
#
--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1b
--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`

--connection node_2
--source include/kill_galera.inc

--connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1c
--error ER_LOCK_DEADLOCK,ER_UNKNOWN_COM_ERROR
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;

--disable_query_log
--error ER_LOCK_DEADLOCK, ER_CANNOT_USER,ER_KILL_QUERY_DENIED_ERROR
--eval KILL QUERY $k_thread;
--enable_query_log

# Reset the master and restart the slave so that post-test checks can run
--error ER_LOCK_DEADLOCK,ER_UNKNOWN_COM_ERROR
CREATE UNIQUE INDEX b2 ON t2(b);

--connection node_1
--disconnect node_1a
--disconnect node_1b
--disconnect node_1c

--connection node_2
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc

--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/wait_until_connected_again.inc

DROP TABLE t2;

# Restore original auto_increment_offset values.
--let $node_2=node_2a
--source include/auto_increment_offset_restore.inc

--source include/galera_end.inc

14 changes: 5 additions & 9 deletions mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,11 @@ INSERT INTO parent VALUES (1, 0);
--connection node_2a
--reap

--connection node_1
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) FROM parent;
SELECT COUNT(*) FROM child;

--connection node_2
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) FROM parent;
SELECT COUNT(*) FROM child;
#
# ALTER TABLE could bf kill one or more of INSERTs to parent, so
# the actual number of rows in PARENT depends on whether
# the INSERT is committed before ALTER TABLE is executed
#

DROP TABLE child;
DROP TABLE parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ SELECT * FROM t1;
--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig
--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node1
--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node1
--disconnect node_1a

--connection node_2
--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig
--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node2
--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node2
--disconnect node_2a

--enable_query_log

Expand Down
6 changes: 3 additions & 3 deletions mysql-test/suite/wsrep/t/variables.test
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ call mtr.add_suppression("WSREP: Failed to get provider options");

#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';

--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
--replace_regex /.*libgalera.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_slave_threads;
SELECT @@global.wsrep_cluster_address;
Expand All @@ -77,7 +77,7 @@ SHOW STATUS LIKE 'wsrep_thread_count';

#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';

--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
--replace_regex /.*libgalera.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_cluster_address;
SELECT @@global.wsrep_on;
Expand All @@ -101,7 +101,7 @@ SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VA
SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
SELECT VARIABLE_VALUE AS EXPECT_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';

--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
--replace_regex /.*libgalera.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_cluster_address;
SELECT @@global.wsrep_on;
Expand Down
22 changes: 13 additions & 9 deletions sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,7 @@ bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use,

if (needs_thr_lock_abort)
{
bool mutex_released= false;
mysql_mutex_lock(&in_use->LOCK_thd_data);
/* If not already dying */
if (in_use->killed != KILL_CONNECTION_HARD)
Expand All @@ -1879,18 +1880,21 @@ bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use,
thread can see those instances (e.g. see partitioning code).
*/
if (!thd_table->needs_reopen())
{
signalled|= mysql_lock_abort_for_thread(this, thd_table);
if (WSREP(this) && wsrep_thd_is_BF(this, FALSE))
{
WSREP_DEBUG("remove_table_from_cache: %llu",
(unsigned long long) this->real_id);
wsrep_abort_thd((void *)this, (void *)in_use, FALSE);
}
}
}
#ifdef WITH_WSREP
if (WSREP(this) && wsrep_thd_is_BF(this, false))
{
WSREP_DEBUG("notify_shared_lock: BF thread %llu query %s"
" victim %llu query %s",
this->real_id, wsrep_thd_query(this),
in_use->real_id, wsrep_thd_query(in_use));
wsrep_abort_thd((void *)this, (void *)in_use, false);
mutex_released= true;
}
#endif /* WITH_WSREP */
}
mysql_mutex_unlock(&in_use->LOCK_thd_data);
if (!mutex_released) mysql_mutex_unlock(&in_use->LOCK_thd_data);
}
DBUG_RETURN(signalled);
}
Expand Down
38 changes: 37 additions & 1 deletion sql/sql_parse.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2020, MariaDB
Copyright (c) 2008, 2021, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -9069,6 +9069,18 @@ static
void sql_kill(THD *thd, longlong id, killed_state state, killed_type type)
{
uint error;
#ifdef WITH_WSREP
if (WSREP(thd))
{
WSREP_DEBUG("sql_kill called");
if (thd->wsrep_applier)
{
WSREP_DEBUG("KILL in applying, bailing out here");
return;
}
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
}
#endif /* WITH_WSREP */
if (!(error= kill_one_thread(thd, id, state, type)))
{
if (!thd->killed)
Expand All @@ -9078,6 +9090,13 @@ void sql_kill(THD *thd, longlong id, killed_state state, killed_type type)
}
else
my_error(error, MYF(0), id);
#ifdef WITH_WSREP
return;
wsrep_error_label:
error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR :
ER_KILL_DENIED_ERROR);
my_error(error, MYF(0), id);
#endif /* WITH_WSREP */
}


Expand All @@ -9086,6 +9105,18 @@ void sql_kill_user(THD *thd, LEX_USER *user, killed_state state)
{
uint error;
ha_rows rows;
#ifdef WITH_WSREP
if (WSREP(thd))
{
WSREP_DEBUG("sql_kill_user called");
if (thd->wsrep_applier)
{
WSREP_DEBUG("KILL in applying, bailing out here");
return;
}
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
}
#endif /* WITH_WSREP */
if (!(error= kill_threads_for_user(thd, user, state, &rows)))
my_ok(thd, rows);
else
Expand All @@ -9096,6 +9127,11 @@ void sql_kill_user(THD *thd, LEX_USER *user, killed_state state)
*/
my_error(error, MYF(0), user->host.str, user->user.str);
}
#ifdef WITH_WSREP
return;
wsrep_error_label:
my_error(ER_CANNOT_USER, MYF(0), user ? user->user.str : "NULL");
#endif /* WITH_WSREP */
}


Expand Down
Loading

0 comments on commit 75f0c59

Please sign in to comment.