Commit 43c6c2ac authored by Nirbhay Choubey's avatar Nirbhay Choubey

Merged r3468 from maria-5.5-galera.

parent 7fd382f1
# galera_cluster.inc
# ==================
#
# Description
# -----------
# Configure galera cluster with 2 nodes.
#
--let $galera_cluster_size = 2
--source include/galera_init.inc
# galera_connect.inc
# ==================
#
# Description
# -----------
# Open a connection to the specified server number ($galera_server_number).
# The connection itself would be identified by $galera_connection_name.
#
# Parameters
# ----------
# $galera_connection_name
# Name of the resulting connection.
#
# $galera_server_number
# Sequence number of the node in the galera cluster.
#
# $galera_debug
# Print debug information.
#
if (!$galera_connection_name)
{
--die ERROR IN TEST: $galera_connection_name must be set before sourcing include/galera_connect.inc
}
if (!$galera_server_number)
{
--die ERROR IN TEST: $galera_server_number must be set before sourcing include/galera_connect.inc
}
--let $_galera_port= \$NODE_MYPORT_$galera_server_number
if (!$_galera_port)
{
--echo Bug in test case: '\$NODE_MYPORT_$galera_server_number' not initialized. Check the test's .cfg file.
--die Not all NODE_MYPORT_* environment variables are setup correctly.
}
if ($galera_debug)
{
--echo connect($galera_connection_name,127.0.0.1,root,,test,$_galera_port,)
}
# Open a connection
--connect($galera_connection_name,127.0.0.1,root,,test,$_galera_port,)
# galera_diff.inc
# ===============
#
# Description
# -----------
# Compare the output of the given statement on all the nodes of the cluster.
#
# Parameters
# ----------
# $galera_diff_statement
# Statement for which the output would be compared.
#
# $galera_diff_database
# Database against which the above statement would be executed.
# (Default : test)
#
# $galera_diff_servers
# Comma separated list of servers to executed the diff statement on. If not
# set, a list of servers will be generated based on $galera_cluster_size.
#
# $galerra_debug
# Print debug information.
#
if (!$galera_diff_statement)
{
--die ERROR IN TEST: $galera_diff_statement must be set before sourcing include/galera_diff.inc
}
--let $_galera_diff_database = $galera_diff_database
if (!$_galera_diff_database)
{
--let $_galera_diff_database = test
}
--let $_galera_diff_servers= $galera_diff_servers
if (!$_galera_diff_servers)
{
--let $_i= $galera_cluster_size
--let $_galera_diff_servers=
while ($_i)
{
--let $_galera_diff_servers= $_i,$_galera_diff_servers
--dec $_i
}
}
if ($galera_debug)
{
--echo \$galera_diff_servers= '$_galera_diff_servers'
}
if (!$galera_debug)
{
--disable_query_log
}
# Generate file containing $galera_diff_statement. We don't pass the
# statement on the command line, because it would be subject to shell
# substitutions.
--let $write_to_file= GENERATE
--let $write_var= $galera_diff_statement
--source include/write_var_to_file.inc
--let $_galera_diff_statement_file= $write_to_file
if (!$galera_debug)
{
--enable_query_log
}
# Compare all servers.
--let $_galera_diff_first= 1
while ($_galera_diff_servers)
{
# Set $_galera_diff_server_i to the first number in the list
--let $_galera_diff_server_i= `SELECT SUBSTRING_INDEX('$_galera_diff_servers', ',', 1)`
# Remove $_galera_diff_server_i from the list
--let $_galera_diff_servers= `SELECT SUBSTRING('$_galera_diff_servers', LENGTH('$_galera_diff_server_i') + 2)`
# Execute statement
--let $_galera_diff_file= $MYSQLTEST_VARDIR/tmp/_galera_diff_server-$_galera_diff_server_i.tmp
--exec $MYSQL --defaults-group-suffix=.$_galera_diff_server_i $_galera_diff_database < $_galera_diff_statement_file > $_galera_diff_file
# Compare
if (!$_galera_diff_first)
{
if ($galera_debug)
{
--echo diffing $_galera_diff_file and $_galera_diff_prev_file
}
--diff_files $_galera_diff_file $_galera_diff_prev_file
--remove_file $_galera_diff_prev_file
}
--let $_galera_diff_prev_file= $_galera_diff_file
--let $_galera_diff_first= 0
}
# Cleanup
--remove_file $_galera_diff_prev_file
--remove_file $_galera_diff_statement_file
# galera_end.inc
# ==============
#
# Description
# -----------
# Closes the connections opened via include/galera_init.inc
#
# Parameters
# ----------
# $galera_cluster_size
# Number of nodes in the cluster.
#
--let $_galera_node= $galera_cluster_size
while ($_galera_node)
{
if ($galera_debug)
{
--echo Disconnecting node_$_galera_node
}
--disconnect node_$_galera_node
--dec $_galera_node
}
# galera_init.inc
# ===============
#
# Description
# -----------
# Set up a Galera cluster with $wsrep_cluster_size nodes.
#
# Parameters
# ----------
# $galera_cluster_size
# Number of nodes in the cluster.
#
--source include/have_wsrep_enabled.inc
--let $_galera_node= $galera_cluster_size
while ($_galera_node)
{
--let $galera_connection_name= node_$_galera_node
--let $galera_server_number= $_galera_node
--source include/galera_connect.inc
--dec $_galera_node
}
......@@ -226,6 +226,14 @@ INSERT INTO global_suppressions VALUES
("Slave I/O: Notifying master by SET @master_binlog_checksum= @@global.binlog_checksum failed with error.*"),
("Slave I/O: Setting master-side filtering of @@skip_replication failed with error:.*"),
("Slave I/O: Setting @mariadb_slave_capability failed with error:.*"),
/*
Galera-related warnings.
*/
("WSREP: Could not open saved state file for reading: .*"),
("WSREP: last inactive check more than .* skipping check"),
("WSREP: Gap in state sequence. Need state transfer."),
("WSREP: Failed to prepare for incremental state transfer: .*"),
("THE_LAST_SUPPRESSION")||
......
......@@ -857,6 +857,8 @@ sub collect_one_test_case {
# Suite has no config, autodetect which one to use
if ($tinfo->{rpl_test}) {
$config= "suite/rpl/my.cnf";
} elsif ($tinfo->{galera_test}) {
$config= "suite/galera/my.cnf";
} else {
$config= "include/default_my.cnf";
}
......@@ -977,6 +979,7 @@ my $tags_map= {'big_test' => ['big_test', 1],
'master-slave' => ['rpl_test', 1],
'ndb_master-slave' => ['rpl_test', 1, 'ndb_test', 1],
'long_test' => ['long_test', 1],
'galera_init' => ['galera_test', 1],
};
my $tags_regex_string= join('|', keys %$tags_map);
my $tags_regex= qr:include/($tags_regex_string)\.inc:o;
......
......@@ -4824,6 +4824,9 @@ sub extract_warning_lines ($$) {
qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|,
qr|'log-bin-use-v1-row-events' is MySQL 5.6 compatible option|,
qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind
# Galera-related warnings.
qr|WSREP:.*down context.*|,
qr|WSREP: Failed to send state UUID:.*|,
);
my $matched_lines= [];
......
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
[mysqld.1]
binlog-format=row
wsrep_provider=/usr/lib/libgalera_smm.so
wsrep_cluster_address='gcomm://'
[mysqld.2]
binlog-format=row
wsrep_provider=/usr/lib/libgalera_smm.so
wsrep_cluster_address='gcomm://127.0.0.1:4567'
wsrep_provider_options='gmcast.listen_addr=tcp://127.0.0.1:4568'
[ENV]
NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket
NODE_MYPORT_2= @mysqld.2.port
NODE_MYSOCK_2= @mysqld.2.socket
!include galera_2nodes.cnf
USE test;
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
SELECT * FROM t1;
c1
1
2
3
4
5
# On node_1
SELECT * FROM test.t1;
c1
1
2
3
4
5
# On node_2
SELECT * FROM test.t1;
c1
1
2
3
4
5
DROP TABLE t1;
# End of test
--source include/galera_cluster.inc
--source include/have_innodb.inc
USE test;
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
SELECT * FROM t1;
--echo
--echo # On node_1
--connection node_1
SELECT * FROM test.t1;
--echo
--echo # On node_2
--connection node_2
SELECT * FROM test.t1;
--let $galera_diff_statement = SELECT * FROM t1
--source include/galera_diff.inc
# Cleanup
DROP TABLE t1;
--source include/galera_end.inc
--echo # End of test
* 'wsrep' suite is designated for tests which do not require a multi-node
galera cluster.
* As these tests are specific to wsrep-related functionalities, they must skip
on server built without wsrep patch (vanilla). (-DWITH_WSREP=OFF)
See : include/have_wsrep.inc, include/have_wsrep_enabled.inc, not_wsrep.inc
--source include/have_wsrep.inc
--source include/have_innodb.inc
--echo #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment