1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-15409 make sure every sst script is tested in buildbot

fix galera.galera_sst_mysqldump test to work:
* must connect to 127.0.0.1, where mysqld is listening
* disable wsrep_sync_wait in wsrep_sst_mysqldump, otherwise
  sst can deadlock
* allow 127.0.0.1 for bind_address and wsrep_sst_receive_address.
  (it's useful in tests, or when two nodes are on the same box,
  or when nodes are on different boxes, but the connection is
  tunelled, or whatever. Don't judge user's setup). MDEV-14070
* don't wait for client connections to die when doing
  mysqldump sst. they'll die in a due time, and if needed mysql
  will wait on locks until they do. MDEV-14069

Also don't mark it big, to make sure it's sufficiently tested
This commit is contained in:
Sergei Golubchik
2018-03-19 23:27:10 +01:00
parent 7e300424a3
commit 8f1014e9a0
9 changed files with 12 additions and 39 deletions

View File

@ -4,6 +4,9 @@
--echo Setting SST method to mysqldump ...
call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
--connection node_1
# We need a user with a password to perform SST, otherwise we hit LP #1378253
CREATE USER 'sst';
@ -19,6 +22,6 @@ SET GLOBAL wsrep_sst_auth = 'sst:';
--disable_query_log
# Set wsrep_sst_receive_address to the SQL port
--eval SET GLOBAL wsrep_sst_receive_address = '127.0.0.2:$NODE_MYPORT_2';
--eval SET GLOBAL wsrep_sst_receive_address = '127.0.0.1:$NODE_MYPORT_2';
--enable_query_log
SET GLOBAL wsrep_sst_method = 'mysqldump';

View File

@ -1,4 +1,6 @@
Setting SST method to mysqldump ...
call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
CREATE USER 'sst';
GRANT ALL PRIVILEGES ON *.* TO 'sst';
SET GLOBAL wsrep_sst_auth = 'sst:';
@ -369,7 +371,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
SET GLOBAL debug = 'd,sync.alter_opened_table';
SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
SET wsrep_sync_wait = 0;
Killing server ...
@ -448,6 +450,7 @@ COUNT(*) = 0
DROP TABLE t1;
COMMIT;
SET AUTOCOMMIT=ON;
SET GLOBAL debug_dbug = $debug_orig;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");

View File

@ -1,4 +1,3 @@
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc

View File

@ -30,10 +30,6 @@ SELECT @@global.wsrep_sst_receive_address;
192.168.2.254
# invalid values
SET @@global.wsrep_sst_receive_address='127.0.0.1:4444';
ERROR 42000: Variable 'wsrep_sst_receive_address' can't be set to the value of '127.0.0.1:4444'
SET @@global.wsrep_sst_receive_address='127.0.0.1';
ERROR 42000: Variable 'wsrep_sst_receive_address' can't be set to the value of '127.0.0.1'
SELECT @@global.wsrep_sst_receive_address;
@@global.wsrep_sst_receive_address
192.168.2.254

View File

@ -27,10 +27,6 @@ SELECT @@global.wsrep_sst_receive_address;
--echo
--echo # invalid values
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_sst_receive_address='127.0.0.1:4444';
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_sst_receive_address='127.0.0.1';
SELECT @@global.wsrep_sst_receive_address;
--error ER_WRONG_VALUE_FOR_VAR
SET @@global.wsrep_sst_receive_address=NULL;

View File

@ -119,11 +119,11 @@ MYSQL="$MYSQL_CLIENT $WSREP_SST_OPT_CONF "\
# Check if binary logging is enabled on the joiner node.
# Note: SELECT cannot be used at this point.
LOG_BIN=$(echo "SHOW VARIABLES LIKE 'log_bin'" | $MYSQL |\
LOG_BIN=$(echo "set statement wsrep_sync_wait=0 for SHOW VARIABLES LIKE 'log_bin'" | $MYSQL |\
tail -1 | awk -F ' ' '{ print $2 }')
# Check the joiner node's server version.
SERVER_VERSION=$(echo "SHOW VARIABLES LIKE 'version'" | $MYSQL |\
SERVER_VERSION=$(echo "set statement wsrep_sync_wait=0 for SHOW VARIABLES LIKE 'version'" | $MYSQL |\
tail -1 | awk -F ' ' '{ print $2 }')
RESET_MASTER=""

View File

@ -51,7 +51,7 @@ int wsrep_check_opts()
(!strcasecmp(my_bind_addr_str, "127.0.0.1") ||
!strcasecmp(my_bind_addr_str, "localhost")))
{
WSREP_ERROR("wsrep_sst_method is set to 'mysqldump' yet "
WSREP_WARN("wsrep_sst_method is set to 'mysqldump' yet "
"mysqld bind_address is set to '%s', which makes it "
"impossible to receive state transfer from another "
"node, since mysqld won't accept such connections. "
@ -59,7 +59,6 @@ int wsrep_check_opts()
"set bind_address to allow mysql client connections "
"from other cluster members (e.g. 0.0.0.0).",
my_bind_addr_str);
return 1;
}
}
else

View File

@ -369,7 +369,7 @@ wsrep_view_handler_cb (void* app_ctx,
if (!wsrep_before_SE())
{
WSREP_DEBUG("[debug]: closing client connections for PRIM");
wsrep_close_client_connections(TRUE);
wsrep_close_client_connections(FALSE);
}
ssize_t const req_len= wsrep_sst_prepare (sst_req);

View File

@ -85,37 +85,14 @@ static void make_wsrep_defaults_file()
}
// TODO: Improve address verification.
static bool sst_receive_address_check (const char* str)
{
if (!strncasecmp(str, "127.0.0.1", strlen("127.0.0.1")) ||
!strncasecmp(str, "localhost", strlen("localhost")))
{
return 1;
}
return 0;
}
bool wsrep_sst_receive_address_check (sys_var *self, THD* thd, set_var* var)
{
char addr_buf[FN_REFLEN];
if ((! var->save_result.string_value.str) ||
(var->save_result.string_value.length > (FN_REFLEN - 1))) // safety
{
goto err;
}
memcpy(addr_buf, var->save_result.string_value.str,
var->save_result.string_value.length);
addr_buf[var->save_result.string_value.length]= 0;
if (sst_receive_address_check(addr_buf))
{
goto err;
}
return 0;
err: