Commit 4d856e36 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

[MDEV-6877] Added tests for binlog_row_image using noblobs switch

parent d817267a
# WL#5096
#
# Description
# ===========
#
# This test case covers Requirements for replication using different
# combinations of indexes and blob fields.
#
# It acts as a complement for rpl_row_img_sanity tests as it checks
# that in a chained replication scenario, replication does not break.
#
# Usage
# =====
#
# Before including this file the following variables should be set:
# * $server_1_engine
# * $server_2_engine
# * $server_3_engine
#
# Example:
#
# -- let $server_1_engine= Falcon
# -- let $server_2_engine= MyISAM
# -- let $server_3_engine= InnoDB
#
# -- source extra/rpl_tests/rpl_row_img_blobs.test
#
-- connection server_1
-- let $diff_table=test.t
let $i= 7;
while($i)
{
-- connection server_1
SET SQL_LOG_BIN=0;
-- connection server_2
SET SQL_LOG_BIN=0;
-- connection server_3
SET SQL_LOG_BIN=0;
#
# The comments below (on create table) must be read with the SQL
# instructions issued later in mind. Declaring a table obviously is
# not enough to assert anything.
#
# Also, the tests in this file make more sense when performed with
# binlog_row_image configured as NOBLOB.
#
if ($i == 1) {
-- echo ### Asserts that declaring a blob as part of a primary key does not break replication
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_3_engine;
}
if ($i == 2)
{
-- echo ### Asserts that declaring a blob as part of a unique (not null) key does not break replication
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_3_engine;
}
if ($i == 3)
{
-- echo ### Asserts that declaring a blob in a key does not break replication
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_3_engine;
}
if ($i == 4) {
-- echo ### Asserts that updates without blobs in the BI (PK exists int the table)
-- echo ### will not break replication
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_3_engine;
}
if ($i == 5)
{
-- echo ### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
-- echo ### will not break replication
-- connection server_1
--eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_3_engine;
}
if ($i == 6)
{
-- echo ### Asserts that updates without blobs in the AI (they are not updated)
-- echo ### will not break replication (check even if there is a key in the table)
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_3_engine;
}
if ($i == 7)
{
-- echo ### Asserts that updates without blobs in the AI (they are not updated)
-- echo ### will not break replication (check when there is no key in the table)
-- connection server_1
--eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_1_engine;
-- connection server_2
--eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_2_engine;
-- connection server_3
--eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_3_engine;
}
-- connection server_1
SET SQL_LOG_BIN=1;
-- connection server_2
SET SQL_LOG_BIN=1;
-- connection server_3
SET SQL_LOG_BIN=1;
-- connection server_1
-- let $blob1= "a"
-- let $blob2= "b"
-- let $blob3= "c"
-- eval INSERT INTO t VALUES (1, $blob1, 10)
-- eval INSERT INTO t VALUES (2, $blob2, 20)
-- eval INSERT INTO t VALUES (3, $blob3, 30)
-- source include/rpl_sync.inc
-- connection server_1
-- eval UPDATE t SET c1=10 WHERE c2=$blob1
-- eval UPDATE t SET c1=20 WHERE c1=2
-- eval UPDATE t SET c1=30 WHERE c3=30
-- eval UPDATE t SET c3=40 WHERE c1=30
-- source include/rpl_sync.inc
-- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
-- source include/diff_tables.inc
-- connection server_1
-- eval DELETE FROM t WHERE c2=$blob1
-- eval DELETE FROM t WHERE c1=20
-- eval DELETE FROM t
-- source include/rpl_sync.inc
-- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
-- source include/diff_tables.inc
-- connection server_1
DROP TABLE t;
-- source include/rpl_sync.inc
dec $i;
}
#
# This is a helper script for rpl_row_img.test. It creates
# all combinations MyISAM / InnoDB in a three server replication
# chain. Each engine combination is tested against the current
# seetings for binlog_row_image (on each server).
#
# The test script that is executed on every combination is the
# only argument to this wrapper script. See below.
#
# This script takes one parameter:
# - $row_img_test_script
# the name of the test script to include in every combination
#
# Sample usage:
# -- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
# -- source include/rpl_row_img_general_loop.test
-- let $engine_type_a= 2
-- let $server_1_engine= MyISAM
while($engine_type_a)
{
-- let $engine_type_b= 2
-- let $server_2_engine= MyISAM
while($engine_type_b)
{
-- let $engine_type_c= 2
-- let $server_3_engine= MyISAM
while($engine_type_c)
{
-- echo ### engines: $server_1_engine, $server_2_engine, $server_3_engine
-- source $row_img_test_script
-- let $server_3_engine= InnoDB
-- dec $engine_type_c
}
-- let $server_2_engine= InnoDB
-- dec $engine_type_b
}
-- let $server_1_engine= InnoDB
-- dec $engine_type_a
}
#
# This is an auxiliar script that sets the binlog-row-image
# on a set of connections. These connections are passed as
# a parameter to this script. Its format is the following:
#
# <conid,value,Y_or_N>:[<conid,value,Y_or_N>:...]
#
# In detail:
#
# conid -- connection id (eg, master)
# value -- binlog_row_image value to set (eg, FULL)
# Y_or_N -- Issue stop and start slave (eg, Y)
#
# Sample usage:
#
# -- let $row_img_set=master:FULL:N,slave:MINIMAL:Y
# -- source include/rpl_row_img_set.inc
#
# Notes:
#
# 1. This script saves and restores the original connection that was
# in use at the time it was included.
-- let $old_conn= $CURRENT_CONNECTION
while (`SELECT HEX('$row_img_set') != HEX('')`)
{
-- let $tuple= `SELECT SUBSTRING_INDEX('$row_img_set', ',', 1)`
-- let $conn= `SELECT SUBSTRING_INDEX('$tuple', ':', 1)`
-- let $rimg= `SELECT SUBSTRING_INDEX(LTRIM(SUBSTRING('$tuple', LENGTH('$conn') + 2)), ':', 1)`
-- let $is_slave_restart= `SELECT LTRIM(SUBSTRING('$tuple', LENGTH('$conn') + LENGTH('$rimg')+ 3))`
-- echo CON: '$conn', IMG: '$rimg', RESTART SLAVE: '$is_slave_restart'
-- connection $conn
-- eval SET SESSION binlog_row_image= '$rimg'
-- eval SET GLOBAL binlog_row_image= '$rimg'
if ($is_slave_restart == Y)
{
-- source include/stop_slave.inc
-- source include/start_slave.inc
}
FLUSH TABLES;
SHOW VARIABLES LIKE 'binlog_row_image';
-- let $row_img_set= `SELECT LTRIM(SUBSTRING('$row_img_set', LENGTH('$tuple') + 2 ))`
}
-- connection $old_conn
This diff is collapsed.
!include suite/rpl/t/rpl_row_img.cnf
#Want to skip this test from daily Valgrind execution
--source include/no_valgrind_without_big.inc
#
# This file contains tests for WL#5096.
#
--let $rpl_topology= 1->2->3
--source include/rpl_init.inc
-- source include/have_binlog_format_row.inc
-- connection server_1
-- source include/have_innodb.inc
-- connection server_2
-- source include/have_innodb.inc
-- connection server_3
-- source include/have_innodb.inc
-- connection server_1
#
# WL#5096 Tests.
#
#
# Tests combinations of binlog-row-image against mixes of MyISAM and InnoDB
# storage engines on all three servers.
#
# All the combinarions need not to be separated into their own files as
# the tests for indexes and engines mixes are, because noblobs test script
# does not take too long time, thence we do not risk triggering PB2 timeout
# on valgrind runs.
#
## NOBLOB
-- let $row_img_set=server_1:NOBLOB:N,server_2:NOBLOB:Y,server_3:NOBLOB:Y
-- source include/rpl_row_img_set.inc
-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
-- source include/rpl_row_img_general_loop.inc
## MINIMAL
-- let $row_img_set=server_1:MINIMAL:N,server_2:MINIMAL:Y,server_3:MINIMAL:Y
-- source include/rpl_row_img_set.inc
-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
-- source include/rpl_row_img_general_loop.inc
## FULL
-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
-- source include/rpl_row_img_set.inc
-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
-- source include/rpl_row_img_general_loop.inc
--source include/rpl_end.inc
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