Skip to content

Commit

Permalink
MDEV-21494 : Galera test sporadic failure on galera.galera_defaults
Browse files Browse the repository at this point in the history
Make sure that we operate with correct Galera library version
and do not print wsrep_provider_options field.
  • Loading branch information
Jan Lindström committed Nov 19, 2020
1 parent 60035bd commit 6f50f51
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
1 change: 1 addition & 0 deletions mysql-test/suite/galera/r/galera#505.result
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ connection node_2;
connection node_1;
connection node_1;
SET SESSION wsrep_sync_wait=0;
# Correct Galera library found
SET SESSION wsrep_sync_wait=DEFAULT;
SET GLOBAL wsrep_provider_options = 'pc.weight=3';
SHOW GLOBAL VARIABLES LIKE 'wsrep_provider_options';
Expand Down
5 changes: 3 additions & 2 deletions mysql-test/suite/galera/r/galera_defaults.result
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
connection node_2;
connection node_1;
SELECT COUNT(*) `expect 48` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
expect 48
# Correct Galera library found
SELECT COUNT(*) `expect 49` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
expect 49
49
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
Expand Down
5 changes: 1 addition & 4 deletions mysql-test/suite/galera/t/galera#505.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
--connection node_1

SET SESSION wsrep_sync_wait=0;
--disable_result_log
--disable_query_log
--let $galera_version=25.3.24
source ../../wsrep/include/check_galera_version.inc;
--enable_result_log
--enable_query_log

SET SESSION wsrep_sync_wait=DEFAULT;

# Convert "... pc.weight = N; ..." to "N; ..."
Expand Down
7 changes: 7 additions & 0 deletions mysql-test/suite/galera/t/galera_defaults.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
!include ../galera_2nodes.cnf

[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1'

[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.segment=1'
11 changes: 5 additions & 6 deletions mysql-test/suite/galera/t/galera_defaults.test
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
#
# The purpose of this test is to preserve the current state of the following:
# * SHOW VARIABLES LIKE 'wsrep%'
# * wsrep_provider_options
# * The names of the Galera status variables
#
# Note that wsrep_provider_options contains paths and other non-deterministic parts
#
# This way, if there is any change, inadvertent or not, the test will fail and the
# developer and QA will be alerted.
#

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

# Make sure that the test is operating on the right version of galera library.
--disable_query_log
--let $galera_version=25.3.20
--let $galera_version=26.4.6
source ../wsrep/include/check_galera_version.inc;
--enable_query_log

# Global Variables

SELECT COUNT(*) `expect 48` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
SELECT COUNT(*) `expect 49` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';

SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
Expand Down
12 changes: 8 additions & 4 deletions mysql-test/suite/wsrep/include/check_galera_version.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,27 @@ SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+)\\.(\\d+).*','\\3')

# Actual
SELECT VARIABLE_VALUE INTO @ACTUAL_GALERA_VERSION FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version';
SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MAJOR_VERSION;
SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*(\\d+)\\.\\d+.*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION;
SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_RELEASE_VERSION;
--enable_query_log

# For testing
#SELECT @GALERA_MAJOR_VERSION;
#SELECT @GALERA_MINOR_VERSION;
#SELECT @GALERA_RELEASE_VERSION;
#SELECT @ACTUAL_GALERA_VERSION;
#SELECT @ACTUAL_GALERA_MAJOR_VERSION;
#SELECT @ACTUAL_GALERA_MINOR_VERSION;
#SELECT @ACTUAL_GALERA_RELEASE_VERSION;

if (!`SELECT (@ACTUAL_GALERA_MINOR_VERSION > @GALERA_MINOR_VERSION) OR
(@ACTUAL_GALERA_MINOR_VERSION = @GALERA_MINOR_VERSION AND
if (!`SELECT (@ACTUAL_GALERA_MAJOR_VERSION >= @GALERA_MAJOR_VERSION AND @ACTUAL_GALERA_MINOR_VERSION > @GALERA_MINOR_VERSION) OR
(@ACTUAL_GALERA_MAJOR_VERSION = @GALERA_MAJOR_VERSION AND
@ACTUAL_GALERA_MINOR_VERSION = @GALERA_MINOR_VERSION AND
@ACTUAL_GALERA_RELEASE_VERSION >= @GALERA_RELEASE_VERSION)
`)
{
skip Test requires Galera library version >= $galera_version;
}

--enable_query_log
--echo # Correct Galera library found

0 comments on commit 6f50f51

Please sign in to comment.