diff options
author | Monty <monty@mariadb.org> | 2015-07-09 14:47:32 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2015-07-09 14:47:32 +0300 |
commit | 9bb8b74e99adced1ccb38ced24a96cf2d1040f39 (patch) | |
tree | c58f67cd054fa8829ca11d275f86db7691031eb2 | |
parent | a6c801438717b815288acb72513f5e42fe736b7b (diff) | |
parent | 77803703431d79f5dcc2b23b3f878dfdbaf01c2b (diff) | |
download | mariadb-git-9bb8b74e99adced1ccb38ced24a96cf2d1040f39.tar.gz |
Merge branch '10.1' of github.com:MariaDB/server into 10.1
Conflicts:
sql/item_subselect.cc
Fixed also typo in comment
113 files changed, 15585 insertions, 1581 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h index 8300619d5c7..9db8fca12b3 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -351,7 +351,6 @@ struct my_collation_handler_st my_bool (*propagate)(CHARSET_INFO *cs, const uchar *str, size_t len); }; -extern MY_COLLATION_HANDLER my_collation_mb_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler; extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler; diff --git a/mysql-test/extra/rpl_tests/rpl_row_img.test b/mysql-test/extra/rpl_tests/rpl_row_img.test new file mode 100644 index 00000000000..b905b81c4c6 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_row_img.test @@ -0,0 +1,241 @@ +# WL#5096 +# +# Description +# =========== +# +# This test case checks replication between hosts with same index +# structure but may differ on engines. +# +# 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.test +# + +-- connection server_1 + +-- let $diff_table=test.t + +let $i= 12; +while($i) +{ + let $step= ""; + + -- connection server_1 + SET SQL_LOG_BIN=0; + + -- connection server_2 + SET SQL_LOG_BIN=0; + + -- connection server_3 + SET SQL_LOG_BIN=0; + + if ($i == 1) { + let $step= No keys; + --echo ******* TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_3_engine; + + } + if ($i == 2) + { + let $step= One key; + --echo ******* TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_3_engine; + + } + if ($i == 3) + { + let $step= One Composite key; + --echo ****** TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_3_engine; + } + if ($i == 4) + { + let $step= One Unique key; + --echo ****** TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_3_engine; + + } + if ($i == 5) + { + let $step= One Composite Unique key; + --echo ****** TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_3_engine; + + } + if ($i == 6) + { + let $step= One Primary key; + --echo ****** TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_3_engine; + } + if ($i == 7) + { + let $step= One Composite Primary Key; + --echo ****** TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_3_engine; + } + if ($i == 8) + { + let $step= One Composite key with holes; + --echo ****** TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_3_engine; + } + if ($i == 9) + { + let $step= One Composite Unique key with holes; + --echo ****** TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_3_engine; + } + if ($i == 10) + { + let $step= One Composite Primary Key with holes; + --echo ****** TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_3_engine; + } + if ($i == 11) + { + let $step= One Composite NOT NULL Unique key with holes; + --echo ****** TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_3_engine; + } + if ($i == 12) + { + let $step= One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave; + --echo ****** TEST: $step + -- connection server_1 + --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_1_engine; + -- connection server_2 + --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_2_engine; + -- connection server_3 + --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) 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 + INSERT INTO t VALUES (1, '1', '1', '1' ); + INSERT INTO t VALUES (4, '4', '4', '4' ); + INSERT INTO t VALUES (7, '7', '7', '7' ); + + INSERT INTO t VALUES (9, '9', '9', NULL ); + + INSERT INTO t VALUES (2, '1', '2', '2' ); + INSERT INTO t VALUES (3, '1', '3', '2' ); + + -- source include/rpl_sync.inc + + -- connection server_1 + UPDATE t SET c4 = '7'; + + UPDATE t SET c4 = '5' WHERE c1 = 1; + UPDATE t SET c2 = '5' WHERE c1 = 1; + UPDATE t SET c1 = '5' WHERE c1 = 1; + + UPDATE t SET c4 = '8' WHERE c2 = '4'; + UPDATE t SET c1 = '8' WHERE c2 = '4'; + UPDATE t SET c2 = '8' WHERE c2 = '4'; + + UPDATE t SET c3 = '0' WHERE c4 = NULL; + UPDATE t SET c2 = '0' WHERE c4 = '0'; + + UPDATE t SET c2 = '2' WHERE c4 = '2'; + + -- 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 + + DELETE FROM t WHERE c1 = 7; + DELETE FROM t WHERE c1 = 8; + 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; +} diff --git a/mysql-test/extra/rpl_tests/rpl_row_img_blobs.test b/mysql-test/extra/rpl_tests/rpl_row_img_blobs.test new file mode 100644 index 00000000000..9d3a0a593e3 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_row_img_blobs.test @@ -0,0 +1,179 @@ +# 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; +} diff --git a/mysql-test/include/ctype_utf8mb4.inc b/mysql-test/include/ctype_utf8mb4.inc index 1971cc0c9a1..152316e6158 100644 --- a/mysql-test/include/ctype_utf8mb4.inc +++ b/mysql-test/include/ctype_utf8mb4.inc @@ -1802,5 +1802,33 @@ DROP TABLE t1; --echo # --echo # ---echo # End of tests +--echo # ctype_utf8mb4.inc: Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +--echo # +CREATE TABLE t1 ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (0x61); +INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF); +INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF); +INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +SELECT COUNT(DISTINCT a) FROM t1; +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +SELECT COUNT(DISTINCT a) FROM t1; +DROP TABLE t1; + +--echo # +--echo # ctype_utf8mb4.inc: End of 10.1 tests +--echo # + +--echo # +--echo # End of ctype_utf8mb4.inc --echo # diff --git a/mysql-test/include/icp_tests.inc b/mysql-test/include/icp_tests.inc index 7c9feea55c2..6807d6eb1bd 100644 --- a/mysql-test/include/icp_tests.inc +++ b/mysql-test/include/icp_tests.inc @@ -639,6 +639,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; +# MDEV-8189 field<>const and const<>field are not symmetric +# Do the same EXPLAIN and SELECT +# with "t1.d1 <> t2.pk" instead of "t2.pk <> t1.d1" + +EXPLAIN +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 + WHERE t1.d1 <> t2.pk AND t2.pk = 4; +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 + WHERE t1.d1 <> t2.pk AND t2.pk = 4; + DROP TABLE t1, t2; --echo # diff --git a/mysql-test/include/rpl_row_img_general_loop.inc b/mysql-test/include/rpl_row_img_general_loop.inc new file mode 100644 index 00000000000..3c7749e5135 --- /dev/null +++ b/mysql-test/include/rpl_row_img_general_loop.inc @@ -0,0 +1,42 @@ +# +# 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 +} diff --git a/mysql-test/include/rpl_row_img_set.inc b/mysql-test/include/rpl_row_img_set.inc new file mode 100644 index 00000000000..d998c3f1d6c --- /dev/null +++ b/mysql-test/include/rpl_row_img_set.inc @@ -0,0 +1,55 @@ +# +# 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 diff --git a/mysql-test/r/analyze_stmt_orderby.result b/mysql-test/r/analyze_stmt_orderby.result index 0f5c7c8437b..c4c4fbf4ce3 100644 --- a/mysql-test/r/analyze_stmt_orderby.result +++ b/mysql-test/r/analyze_stmt_orderby.result @@ -531,4 +531,49 @@ EXPLAIN } drop table t5,t6,t7; drop table t3; +# +# Tabular ANALYZE must get its data from execution tracker (and not from +# the query plan) +# +CREATE TABLE t2( +col1 int, +col2 int, +UNIQUE INDEX idx (col1, col2)) engine=myisam; +INSERT INTO t2(col1, col2) VALUES +(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11), +(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1); +flush status; +explain +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by +analyze +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 range NULL idx 5 NULL 7 20.00 100.00 100.00 Using index for group-by +analyze format=json +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t2", + "access_type": "range", + "key": "idx", + "key_length": "5", + "used_key_parts": ["col1"], + "r_loops": 1, + "rows": 7, + "r_rows": 20, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100, + "using_index_for_group_by": true + } + } +} +drop table t2; drop table t0,t1; diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result index 131e7043e58..df1f79fc218 100644 --- a/mysql-test/r/ctype_eucjpms.result +++ b/mysql-test/r/ctype_eucjpms.result @@ -33841,3 +33841,45 @@ ERROR HY000: Invalid eucjpms character string: '8EA0' # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms, KEY(a)); +INSERT INTO t1 VALUES ('a'),(0x7F); +INSERT INTO t1 VALUES (0x8EA1),(0x8EDF); +INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE); +INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE); +SELECT HEX(a) FROM t1 ORDER BY a; +HEX(a) +61 +7F +8EA1 +8EDF +8FA1A1 +8FFEFE +A1A1 +DEDE +DFDF +E0E0 +FEFE +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET eucjpms COLLATE eucjpms_bin; +SELECT HEX(a) FROM t1 ORDER BY a; +HEX(a) +61 +7F +8EA1 +8EDF +8FA1A1 +8FFEFE +A1A1 +DEDE +DFDF +E0E0 +FEFE +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result index 4ad47cbc84a..b578e558c0a 100644 --- a/mysql-test/r/ctype_ujis.result +++ b/mysql-test/r/ctype_ujis.result @@ -26144,3 +26144,45 @@ ERROR HY000: Invalid ujis character string: '8EA0' # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis, KEY(a)); +INSERT INTO t1 VALUES ('a'),(0x7F); +INSERT INTO t1 VALUES (0x8EA1),(0x8EDF); +INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE); +INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE); +SELECT HEX(a) FROM t1 ORDER BY a; +HEX(a) +61 +7F +8EA1 +8EDF +8FA1A1 +8FFEFE +A1A1 +DEDE +DFDF +E0E0 +FEFE +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ujis COLLATE ujis_bin; +SELECT HEX(a) FROM t1 ORDER BY a; +HEX(a) +61 +7F +8EA1 +8EDF +8FA1A1 +8FFEFE +A1A1 +DEDE +DFDF +E0E0 +FEFE +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index 2d91ce3dd6f..4d8f2d38a03 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -2127,3 +2127,64 @@ DEALLOCATE PREPARE stmt; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf16, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (_utf8mb4 0x61); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 0061 +2 0080 +3 07FF +4 0800 +6 D800DC00 +7 DBFFDFFF +5 FFFF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 FFFF +7 DBFFDFFF +6 D800DC00 +4 0800 +3 07FF +2 0080 +1 0061 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 0061 +2 0080 +3 07FF +4 0800 +5 FFFF +6 D800DC00 +7 DBFFDFFF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 DBFFDFFF +6 D800DC00 +5 FFFF +4 0800 +3 07FF +2 0080 +1 0061 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result index 8098b0d1666..c980743ce94 100644 --- a/mysql-test/r/ctype_utf16le.result +++ b/mysql-test/r/ctype_utf16le.result @@ -2319,3 +2319,64 @@ DFFFFFDFFFFF9CFFFF9DFFFF9EFFFF # # End of 5.6 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf16le, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (_utf8mb4 0x61); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 6100 +2 8000 +3 FF07 +4 0008 +6 00D800DC +7 FFDBFFDF +5 FFFF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 FFFF +7 FFDBFFDF +6 00D800DC +4 0008 +3 FF07 +2 8000 +1 6100 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16le COLLATE utf16le_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 6100 +2 8000 +3 FF07 +4 0008 +5 FFFF +6 00D800DC +7 FFDBFFDF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 FFDBFFDF +6 00D800DC +5 FFFF +4 0008 +3 FF07 +2 8000 +1 6100 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index 0ec89a50c0f..df7b77b18a5 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -2206,3 +2206,21 @@ DEALLOCATE PREPARE stmt; # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-8419 utf32: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32, KEY(a)); +INSERT INTO t1 VALUES (0x10000),(0x10001),(0x10002); +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +1 +DROP TABLE t1; +SELECT _utf32 0x10001=_utf32 0x10002; +_utf32 0x10001=_utf32 0x10002 +1 +# +# End of 10.1 tests +# diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 4b519e213ef..7bd37ede962 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -5594,11 +5594,11 @@ a?z ab az aЀ +aր SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); PREPARE stmt FROM @query; EXECUTE stmt; ch -aր z # 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); @@ -5802,11 +5802,11 @@ a?z ab az aЀ +aր SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); PREPARE stmt FROM @query; EXECUTE stmt; ch -aր z # 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); @@ -6002,11 +6002,11 @@ a?z ab az aЀ +aր SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); PREPARE stmt FROM @query; EXECUTE stmt; ch -aր z # 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); diff --git a/mysql-test/r/ctype_utf8mb4_heap.result b/mysql-test/r/ctype_utf8mb4_heap.result index 52030d62047..f60bf124a9f 100644 --- a/mysql-test/r/ctype_utf8mb4_heap.result +++ b/mysql-test/r/ctype_utf8mb4_heap.result @@ -2495,5 +2495,66 @@ DROP TABLE t1; # End of 5.5 tests # # -# End of tests +# ctype_utf8mb4.inc: Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (0x61); +INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF); +INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF); +INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +6 F0908080 +7 F48FBFBF +5 EFBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 EFBFBF +7 F48FBFBF +6 F0908080 +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +5 EFBFBF +6 F0908080 +7 F48FBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 F48FBFBF +6 F0908080 +5 EFBFBF +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# ctype_utf8mb4.inc: End of 10.1 tests +# +# +# End of ctype_utf8mb4.inc # diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result index 243c000b6c4..f904ff6f99e 100644 --- a/mysql-test/r/ctype_utf8mb4_innodb.result +++ b/mysql-test/r/ctype_utf8mb4_innodb.result @@ -2642,5 +2642,66 @@ DROP TABLE t1; # End of 5.5 tests # # -# End of tests +# ctype_utf8mb4.inc: Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (0x61); +INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF); +INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF); +INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +6 F0908080 +7 F48FBFBF +5 EFBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 EFBFBF +7 F48FBFBF +6 F0908080 +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +5 EFBFBF +6 F0908080 +7 F48FBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 F48FBFBF +6 F0908080 +5 EFBFBF +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# ctype_utf8mb4.inc: End of 10.1 tests +# +# +# End of ctype_utf8mb4.inc # diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result index acdd6d36af7..e44421d1410 100644 --- a/mysql-test/r/ctype_utf8mb4_myisam.result +++ b/mysql-test/r/ctype_utf8mb4_myisam.result @@ -2642,5 +2642,66 @@ DROP TABLE t1; # End of 5.5 tests # # -# End of tests +# ctype_utf8mb4.inc: Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (0x61); +INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF); +INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF); +INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +6 F0908080 +7 F48FBFBF +5 EFBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 EFBFBF +7 F48FBFBF +6 F0908080 +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +5 EFBFBF +6 F0908080 +7 F48FBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 F48FBFBF +6 F0908080 +5 EFBFBF +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# ctype_utf8mb4.inc: End of 10.1 tests +# +# +# End of ctype_utf8mb4.inc # diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result index e08cd9780fd..f81a62ef23b 100644 --- a/mysql-test/r/explain_json.result +++ b/mysql-test/r/explain_json.result @@ -293,14 +293,17 @@ EXPLAIN }, "subqueries": [ { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 10, - "filtered": 100, - "attached_condition": "(t1.b = t0.a)" + "expression_cache": { + "state": "uninitialized", + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t1.b = t0.a)" + } } } } @@ -323,14 +326,17 @@ EXPLAIN }, "subqueries": [ { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 10, - "filtered": 100, - "attached_condition": "(t1.b = t0.a)" + "expression_cache": { + "state": "uninitialized", + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100, + "attached_condition": "(t1.b = t0.a)" + } } } } diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 847c959fc59..2a918adcb5f 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1633,9 +1633,7 @@ drop table if exists t1;drop table if exists t1; drop table if exists t1;drop table if exists t1; drop table if exists t1;drop table if exists t1; drop table if exists t1;drop table if exists t1; -drop table if exists t1;drop table if exists -Warnings: -Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row 1 +drop table if exists t1;drop table if exists t1; select * from information_schema.global_variables where variable_name like 'init%' order by variable_name; VARIABLE_NAME VARIABLE_VALUE INIT_CONNECT drop table if exists t1;drop table if exists t1; @@ -1658,11 +1656,9 @@ drop table if exists t1;drop table if exists t1; drop table if exists t1;drop table if exists t1; drop table if exists t1;drop table if exists t1; drop table if exists t1;drop table if exists t1; -drop table if exists t1;drop table if exists +drop table if exists t1;drop table if exists t1; INIT_FILE INIT_SLAVE -Warnings: -Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row # set global init_connect=""; create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT'; SELECT 1; diff --git a/mysql-test/r/innodb_icp.result b/mysql-test/r/innodb_icp.result index fb467494525..cff78e76664 100644 --- a/mysql-test/r/innodb_icp.result +++ b/mysql-test/r/innodb_icp.result @@ -600,6 +600,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; d1 pk i1 1 4 1 +EXPLAIN +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 +WHERE t1.d1 <> t2.pk AND t2.pk = 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL k1 9 NULL 3 Using index +1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 +WHERE t1.d1 <> t2.pk AND t2.pk = 4; +d1 pk i1 +1 4 1 DROP TABLE t1, t2; # # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89 diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result index c1dbef08c04..68ea89949b2 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -4321,6 +4321,23 @@ h n v p +EXPLAIN +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where +1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +v +b +h +n +v +p SET SESSION join_cache_level=6; EXPLAIN SELECT t2.v FROM t1, t2, t3 @@ -4339,6 +4356,23 @@ h n v p +EXPLAIN +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +v +b +h +n +v +p SET SESSION join_cache_level=4; EXPLAIN SELECT t2.v FROM t1, t2, t3 @@ -4357,6 +4391,23 @@ h n v p +EXPLAIN +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join) +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 +GROUP BY t2.v ORDER BY t1.pk,t2.v; +v +b +h +n +v +p DROP TABLE t1,t2,t3; SET SESSION join_cache_level=DEFAULT; # diff --git a/mysql-test/r/myisam_icp.result b/mysql-test/r/myisam_icp.result index 49cba60320d..2792d75abb2 100644 --- a/mysql-test/r/myisam_icp.result +++ b/mysql-test/r/myisam_icp.result @@ -604,6 +604,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; d1 pk i1 1 4 1 +EXPLAIN +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 +WHERE t1.d1 <> t2.pk AND t2.pk = 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL k1 9 NULL 3 Using index +1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 +WHERE t1.d1 <> t2.pk AND t2.pk = 4; +d1 pk i1 +1 4 1 DROP TABLE t1, t2; # # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89 diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 5dfa73b5647..fc22af6b9be 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -87,6 +87,17 @@ The following options may be given as the first argument: The maximum size of a row-based binary log event in bytes. Rows will be grouped into events smaller than this size if possible. The value has to be a multiple of 256. + --binlog-row-image=name + Controls whether rows should be logged in 'FULL', + 'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all + columns in the before and after image are logged. + 'NOBLOB', means that mysqld avoids logging blob columns + whenever possible (eg, blob column was not changed or is + not part of primary key). 'MINIMAL', means that a PK + equivalent (PK columns or full row if there is no PK in + the table) is logged in the before image, and only + changed columns are logged in the after image. (Default: + FULL). --binlog-stmt-cache-size=# The size of the statement cache for updates to non-transactional engines for the binary log. If you @@ -1127,6 +1138,7 @@ binlog-direct-non-transactional-updates FALSE binlog-format STATEMENT binlog-optimize-thread-scheduling TRUE binlog-row-event-max-size 1024 +binlog-row-image FULL binlog-stmt-cache-size 32768 bulk-insert-buffer-size 8388608 changed-page-bitmaps ON diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 78a224b1439..1b984666462 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2241,3 +2241,27 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 drop table t1,t2; +# +# Start of 10.1 tests +# +# +# MDEV-8189 field<>const and const<>field are not symmetric +# +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70); +EXPLAIN SELECT * FROM t1 WHERE a<>10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 3 Using index condition +EXPLAIN SELECT * FROM t1 WHERE 10<>a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 3 Using index condition +SELECT * FROM t1 WHERE a<>10; +a b +70 NULL +SELECT * FROM t1 WHERE 10<>a; +a b +70 NULL +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index 1b6e4cb9fe8..4ce433200bf 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2243,4 +2243,28 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 drop table t1,t2; +# +# Start of 10.1 tests +# +# +# MDEV-8189 field<>const and const<>field are not symmetric +# +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70); +EXPLAIN SELECT * FROM t1 WHERE a<>10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 3 Using index condition; Rowid-ordered scan +EXPLAIN SELECT * FROM t1 WHERE 10<>a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 3 Using index condition; Rowid-ordered scan +SELECT * FROM t1 WHERE a<>10; +a b +70 NULL +SELECT * FROM t1 WHERE 10<>a; +a b +70 NULL +DROP TABLE t1; +# +# End of 10.1 tests +# set optimizer_switch=@mrr_icp_extra_tmp; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 60879086c62..1d2ab12dbb8 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -101,19 +101,19 @@ drop table t1; show variables like "wait_timeout%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 -def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 5 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8 Variable_name Value wait_timeout 28800 show variables like "WAIT_timeout%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 -def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 5 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8 Variable_name Value wait_timeout 28800 show variables like "this_doesn't_exists%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 -def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 0 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 0 N 1 0 8 Variable_name Value show table status from test like "this_doesn't_exists%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr diff --git a/mysql-test/r/subselect_cache.result b/mysql-test/r/subselect_cache.result index e5a2fe12526..8ca6bf52e0e 100644 --- a/mysql-test/r/subselect_cache.result +++ b/mysql-test/r/subselect_cache.result @@ -39,6 +39,231 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 31 +analyze format=json +select a, (select d from t2 where b=c) from t1; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "subqueries": [ + { + "expression_cache": { + "r_loops": 10, + "r_hit_ratio": 60, + "query_block": { + "select_id": 2, + "r_loops": 4, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 4, + "rows": 4, + "r_rows": 4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 18.75, + "attached_condition": "(t1.b = t2.c)" + } + } + } + } + ] + } +} +analyze format=json +select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1; +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 10, + "r_rows": 10, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 100 + }, + "subqueries": [ + { + "expression_cache": { + "r_loops": 10, + "r_hit_ratio": 60, + "query_block": { + "union_result": { + "table_name": "<union3,4>", + "access_type": "ALL", + "r_loops": 4, + "r_rows": 1, + "query_specifications": [ + { + "query_block": { + "select_id": 3, + "r_loops": 4, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 4, + "rows": 4, + "r_rows": 4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 18.75, + "attached_condition": "(t1.b = t2.c)" + } + } + }, + { + "query_block": { + "select_id": 4, + "table": { + "message": "No tables used" + } + } + } + ] + } + } + } + }, + { + "expression_cache": { + "r_loops": 10, + "r_hit_ratio": 60, + "query_block": { + "select_id": 2, + "r_loops": 4, + "r_total_time_ms": "REPLACED", + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 4, + "rows": 4, + "r_rows": 4, + "r_total_time_ms": "REPLACED", + "filtered": 100, + "r_filtered": 18.75, + "attached_condition": "(t1.b = t2.c)" + } + } + } + } + ] + } +} +explain format=json +select a, (select d from t2 where b=c) from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "subqueries": [ + { + "expression_cache": { + "state": "uninitialized", + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 4, + "filtered": 100, + "attached_condition": "(t1.b = t2.c)" + } + } + } + } + ] + } +} +explain format=json +select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "subqueries": [ + { + "expression_cache": { + "state": "uninitialized", + "query_block": { + "union_result": { + "table_name": "<union3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 4, + "filtered": 100, + "attached_condition": "(t1.b = t2.c)" + } + } + }, + { + "query_block": { + "select_id": 4, + "table": { + "message": "No tables used" + } + } + } + ] + } + } + } + }, + { + "expression_cache": { + "state": "uninitialized", + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 4, + "filtered": 100, + "attached_condition": "(t1.b = t2.c)" + } + } + } + } + ] + } +} set optimizer_switch='subquery_cache=off'; flush status; select a, (select d from t2 where b=c) from t1; diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result index 9a5da710a4c..f55fbf07db8 100644 --- a/mysql-test/r/subselect_sj2.result +++ b/mysql-test/r/subselect_sj2.result @@ -1092,6 +1092,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) ); COUNT(*) 3724 +EXPLAIN +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where +1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index +1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3) +1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +COUNT(*) +3724 set optimizer_prune_level=@tmp_951283; DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result index c10b550d11a..2b6af74e47e 100644 --- a/mysql-test/r/subselect_sj2_jcl6.result +++ b/mysql-test/r/subselect_sj2_jcl6.result @@ -1107,6 +1107,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) ); COUNT(*) 3724 +EXPLAIN +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where +1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index +1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3) +1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (incremental, BNL join) +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +COUNT(*) +3724 set optimizer_prune_level=@tmp_951283; DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result index 4e75aee24a2..cfc7aa082f1 100644 --- a/mysql-test/r/subselect_sj2_mat.result +++ b/mysql-test/r/subselect_sj2_mat.result @@ -1094,6 +1094,27 @@ AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) ); COUNT(*) 3724 +EXPLAIN +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL 19 Using where +1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d 1 Using index +1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b 1 Using where; FirstMatch(alias3) +1 PRIMARY alias2 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 Using join buffer (flat, BNL join) +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( +SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 +WHERE alias5.b = alias4.b +AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); +COUNT(*) +3724 set optimizer_prune_level=@tmp_951283; DROP TABLE t1,t2; # diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index d8c18711293..0c62007d2a0 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -893,5 +893,57 @@ DROP TABLE t1; # End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field # # +# MDEV-8336 The meaning of NO_ZERO_DATE is not clear for DATETIME +# +SET sql_mode='NO_ZERO_DATE'; +SELECT TIMESTAMP'0000-00-01 10:20:30'; +TIMESTAMP'0000-00-01 10:20:30' +0000-00-01 10:20:30 +SELECT TIMESTAMP'0000-00-00 10:20:30'; +TIMESTAMP'0000-00-00 10:20:30' +0000-00-00 10:20:30 +SELECT TIMESTAMP'0000-00-00 00:00:00.000001'; +TIMESTAMP'0000-00-00 00:00:00.000001' +0000-00-00 00:00:00.000001 +CREATE TABLE t1 (a DATETIME); +INSERT INTO t1 VALUES ('0000-00-00 10:20:30'); +SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1; +a LEAST(a,'2001-01-01 10:20:30') +0000-00-00 10:20:30 0000-00-00 10:20:30.000000 +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME(6)); +INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000001'); +SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1; +a LEAST(a,'2001-01-01 10:20:30') +0000-00-00 00:00:00.000001 0000-00-00 00:00:00.000001 +DROP TABLE t1; +SELECT STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s'); +STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s') +0000-00-00 10:20:30 +SELECT STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f'); +STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f') +0000-00-00 00:00:00.000001 +SET old_mode=zero_date_time_cast; +SELECT CAST(TIME'10:20:30' AS DATETIME); +CAST(TIME'10:20:30' AS DATETIME) +0000-00-00 10:20:30 +SELECT CAST(TIME'00:00:00.000001' AS DATETIME(6)); +CAST(TIME'00:00:00.000001' AS DATETIME(6)) +0000-00-00 00:00:00.000001 +SELECT CAST(CAST('10:20:30' AS TIME) AS DATETIME); +CAST(CAST('10:20:30' AS TIME) AS DATETIME) +0000-00-00 10:20:30 +SELECT CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6)); +CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6)) +0000-00-00 00:00:00.000001 +SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME); +CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME) +0000-00-00 10:20:30 +SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)); +CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)) +0000-00-00 00:00:00.000001 +SET old_mode=DEFAULT; +SET sql_mode=DEFAULT; +# # End of 10.1 tests # diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption.result b/mysql-test/suite/encryption/r/innodb-page_encryption.result index 85467c509f1..c4814983af4 100644 --- a/mysql-test/suite/encryption/r/innodb-page_encryption.result +++ b/mysql-test/suite/encryption/r/innodb-page_encryption.result @@ -1,12 +1,27 @@ SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb; +show warnings; +Level Code Message create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1; +show warnings; +Level Code Message create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2; +show warnings; +Level Code Message create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3; ERROR HY000: Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options") +show warnings; +Level Code Message +Warning 140 InnoDB: ENCRYPTION_KEY_ID 3 not available +Error 1005 Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33; +show warnings; +Level Code Message create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4; +show warnings; +Level Code Message set innodb_default_encryption_key_id = 5; create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encrypted=yes; show create table innodb_defkey; diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result b/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result index b1a4262df06..f7ffc77fd66 100644 --- a/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result +++ b/mysql-test/suite/encryption/r/innodb-page_encryption_compression.result @@ -2,7 +2,11 @@ SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1; +show warnings; +Level Code Message create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1 page_compressed=1; +show warnings; +Level Code Message create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=2 page_compressed=1; show warnings; Level Code Message diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result b/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result index e627f3c0c5f..92130da19e9 100644 --- a/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result +++ b/mysql-test/suite/encryption/r/innodb-page_encryption_log_encryption.result @@ -4,10 +4,20 @@ call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key versi SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb; +show warnings; +Level Code Message create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1; +show warnings; +Level Code Message create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2; +show warnings; +Level Code Message create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33; +show warnings; +Level Code Message create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4; +show warnings; +Level Code Message show create table innodb_compact; Table Create Table innodb_compact CREATE TABLE `innodb_compact` ( diff --git a/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result b/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result index 54a7d50bf05..e3238990aaa 100644 --- a/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result +++ b/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result @@ -262,5 +262,3 @@ drop table innodb_page_compressed6; drop table innodb_page_compressed7; drop table innodb_page_compressed8; drop table innodb_page_compressed9; -SET GLOBAL innodb_encryption_threads = 4; -SET GLOBAL innodb_encrypt_tables = on; diff --git a/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result b/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result index 1ed18ec205d..43fb7368654 100644 --- a/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result +++ b/mysql-test/suite/encryption/r/innodb_page_encryption_key_change.result @@ -2,10 +2,20 @@ SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb; +show warnings; +Level Code Message create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=2; +show warnings; +Level Code Message create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=3; +show warnings; +Level Code Message create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=4; +show warnings; +Level Code Message create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=5; +show warnings; +Level Code Message insert into innodb_normal values (1,'test1'),(2,'foo'),(3,'bar'),(4,'mariadb'); insert into innodb_compact select * from innodb_normal; insert into innodb_compressed select * from innodb_normal; diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption.test b/mysql-test/suite/encryption/t/innodb-page_encryption.test index 375de4e9244..463df756933 100644 --- a/mysql-test/suite/encryption/t/innodb-page_encryption.test +++ b/mysql-test/suite/encryption/t/innodb-page_encryption.test @@ -10,12 +10,18 @@ SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb; +show warnings; create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1; +show warnings; create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2; +show warnings; --error ER_CANT_CREATE_TABLE create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3; +show warnings; create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33; +show warnings; create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4; +show warnings; set innodb_default_encryption_key_id = 5; create table innodb_defkey(c1 bigint not null, b char(200)) engine=innodb encrypted=yes; diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test index b262e6033a9..1d59c39d637 100644 --- a/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test +++ b/mysql-test/suite/encryption/t/innodb-page_encryption_compression.test @@ -15,7 +15,9 @@ SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb page_compressed=1; +show warnings; create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1 page_compressed=1; +show warnings; create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=2 page_compressed=1; show warnings; diff --git a/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test b/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test index aa201ca1a00..b6fe0d10b65 100644 --- a/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test +++ b/mysql-test/suite/encryption/t/innodb-page_encryption_log_encryption.test @@ -15,10 +15,15 @@ SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb; +show warnings; create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1; +show warnings; create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=2; +show warnings; create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33; +show warnings; create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=4; +show warnings; show create table innodb_compact; show create table innodb_compressed; diff --git a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test index 40ba6bceba9..c2c7bd96d3e 100644 --- a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test +++ b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test @@ -8,6 +8,8 @@ let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; let $innodb_file_format_orig = `SELECT @@innodb_file_format`; let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; +let $innodb_encrypt_tables_orig = `SELECT @@innodb_encrypt_tables`; +let $innodb_encryption_threads_orig = `SELECT @@innodb_encryption_threads`; --enable_query_log SET GLOBAL innodb_file_format = `Barracuda`; @@ -161,7 +163,7 @@ drop table innodb_page_compressed9; EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig; EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; +EVAL SET GLOBAL innodb_encrypt_tables = $innodb_encrypt_tables_orig; +EVAL SET GLOBAL innodb_encryption_threads = $innodb_encryption_threads_orig; --enable_query_log -SET GLOBAL innodb_encryption_threads = 4; -SET GLOBAL innodb_encrypt_tables = on; diff --git a/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test b/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test index 87511c7b3a0..7cbf005ed32 100644 --- a/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test +++ b/mysql-test/suite/encryption/t/innodb_page_encryption_key_change.test @@ -16,10 +16,15 @@ SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb; +show warnings; create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=2; +show warnings; create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed encrypted=yes encryption_key_id=3; +show warnings; create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=4; +show warnings; create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant encrypted=yes encryption_key_id=5; +show warnings; insert into innodb_normal values (1,'test1'),(2,'foo'),(3,'bar'),(4,'mariadb'); insert into innodb_compact select * from innodb_normal; diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 866461720f0..17d3b841f8a 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -167,9 +167,9 @@ def information_schema GEOMETRY_COLUMNS MAX_PPR 12 0 NO tinyint NULL NULL 3 0 NU def information_schema GEOMETRY_COLUMNS SRID 13 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) select def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select def information_schema INDEX_STATISTICS INDEX_NAME 3 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) select def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema INDEX_STATISTICS TABLE_NAME 2 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) select @@ -321,9 +321,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NUL def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select @@ -345,15 +345,15 @@ def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT 14 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select -def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select def information_schema SYSTEM_VARIABLES READ_ONLY 13 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select -def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select @@ -694,9 +694,9 @@ NULL information_schema GEOMETRY_COLUMNS COORD_DIMENSION tinyint NULL NULL NULL NULL information_schema GEOMETRY_COLUMNS MAX_PPR tinyint NULL NULL NULL NULL tinyint(2) NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL smallint(5) 3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema INDEX_STATISTICS TABLE_SCHEMA varchar 192 576 utf8 utf8_general_ci varchar(192) 3.0000 information_schema INDEX_STATISTICS TABLE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192) 3.0000 information_schema INDEX_STATISTICS INDEX_NAME varchar 192 576 utf8 utf8_general_ci varchar(192) @@ -848,9 +848,9 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet 3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) 3.0000 information_schema SESSION_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smallint(5) 3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512) NULL information_schema SPATIAL_REF_SYS AUTH_SRID smallint NULL NULL NULL NULL smallint(5) @@ -872,10 +872,10 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3) 3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16) 3.0000 information_schema STATISTICS INDEX_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024) 3.0000 information_schema SYSTEM_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) -3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) +3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema SYSTEM_VARIABLES VARIABLE_SCOPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SYSTEM_VARIABLES VARIABLE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SYSTEM_VARIABLES VARIABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048) diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index c314165367f..bd49492c353 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -167,9 +167,9 @@ def information_schema GEOMETRY_COLUMNS MAX_PPR 12 0 NO tinyint NULL NULL 3 0 NU def information_schema GEOMETRY_COLUMNS SRID 13 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) def information_schema INDEX_STATISTICS INDEX_NAME 3 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema INDEX_STATISTICS TABLE_NAME 2 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) @@ -321,9 +321,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NUL def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) @@ -345,15 +345,15 @@ def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT 14 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext -def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) def information_schema SYSTEM_VARIABLES READ_ONLY 13 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) -def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) @@ -694,9 +694,9 @@ NULL information_schema GEOMETRY_COLUMNS COORD_DIMENSION tinyint NULL NULL NULL NULL information_schema GEOMETRY_COLUMNS MAX_PPR tinyint NULL NULL NULL NULL tinyint(2) NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL smallint(5) 3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema GLOBAL_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema INDEX_STATISTICS TABLE_SCHEMA varchar 192 576 utf8 utf8_general_ci varchar(192) 3.0000 information_schema INDEX_STATISTICS TABLE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192) 3.0000 information_schema INDEX_STATISTICS INDEX_NAME varchar 192 576 utf8 utf8_general_ci varchar(192) @@ -848,9 +848,9 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet 3.0000 information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SCHEMA_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3) 3.0000 information_schema SESSION_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smallint(5) 3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512) NULL information_schema SPATIAL_REF_SYS AUTH_SRID smallint NULL NULL NULL NULL smallint(5) @@ -872,10 +872,10 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3) 3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16) 3.0000 information_schema STATISTICS INDEX_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024) 3.0000 information_schema SYSTEM_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) -3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) +3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN varchar 64 192 utf8 utf8_general_ci varchar(64) -3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema SYSTEM_VARIABLES VARIABLE_SCOPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SYSTEM_VARIABLES VARIABLE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SYSTEM_VARIABLES VARIABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048) diff --git a/mysql-test/suite/maria/icp.result b/mysql-test/suite/maria/icp.result index 85a21ada47d..7a8c0dd44dd 100644 --- a/mysql-test/suite/maria/icp.result +++ b/mysql-test/suite/maria/icp.result @@ -606,6 +606,16 @@ SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; d1 pk i1 1 4 1 +EXPLAIN +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 +WHERE t1.d1 <> t2.pk AND t2.pk = 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL k1 9 NULL 3 Using index +1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where +SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 +WHERE t1.d1 <> t2.pk AND t2.pk = 4; +d1 pk i1 +1 4 1 DROP TABLE t1, t2; # # BUG#778434 Wrong result with in_to_exists=on in maria-5.3-mwl89 diff --git a/mysql-test/suite/rpl/r/rpl_row_img_blobs.result b/mysql-test/suite/rpl/r/rpl_row_img_blobs.result new file mode 100644 index 00000000000..e69358a5d29 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_img_blobs.result @@ -0,0 +1,4733 @@ +include/rpl_init.inc [topology=1->2->3] +CON: 'server_1', IMG: 'NOBLOB', RESTART SLAVE: 'N' +SET SESSION binlog_row_image= 'NOBLOB'; +SET GLOBAL binlog_row_image= 'NOBLOB'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image NOBLOB +CON: 'server_2', IMG: 'NOBLOB', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'NOBLOB'; +SET GLOBAL binlog_row_image= 'NOBLOB'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image NOBLOB +CON: 'server_3', IMG: 'NOBLOB', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'NOBLOB'; +SET GLOBAL binlog_row_image= 'NOBLOB'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image NOBLOB +### engines: MyISAM, MyISAM, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, MyISAM, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, InnoDB, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, InnoDB, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, MyISAM, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, MyISAM, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, InnoDB, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, InnoDB, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +CON: 'server_1', IMG: 'MINIMAL', RESTART SLAVE: 'N' +SET SESSION binlog_row_image= 'MINIMAL'; +SET GLOBAL binlog_row_image= 'MINIMAL'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image MINIMAL +CON: 'server_2', IMG: 'MINIMAL', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'MINIMAL'; +SET GLOBAL binlog_row_image= 'MINIMAL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image MINIMAL +CON: 'server_3', IMG: 'MINIMAL', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'MINIMAL'; +SET GLOBAL binlog_row_image= 'MINIMAL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image MINIMAL +### engines: MyISAM, MyISAM, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, MyISAM, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, InnoDB, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, InnoDB, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, MyISAM, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, MyISAM, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, InnoDB, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, InnoDB, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N' +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +### engines: MyISAM, MyISAM, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, MyISAM, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, InnoDB, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, InnoDB, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, MyISAM, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, MyISAM, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, InnoDB, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, InnoDB, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check when there is no key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the AI (they are not updated) +### will not break replication (check even if there is a key in the table) +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) +### will not break replication +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that updates without blobs in the BI (PK exists int the table) +### will not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob in a key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a unique (not null) key does not break replication +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +### Asserts that declaring a blob as part of a primary key does not break replication +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, "a", 10); +INSERT INTO t VALUES (2, "b", 20); +INSERT INTO t VALUES (3, "c", 30); +include/rpl_sync.inc +UPDATE t SET c1=10 WHERE c2="a"; +UPDATE t SET c1=20 WHERE c1=2; +UPDATE t SET c1=30 WHERE c3=30; +UPDATE t SET c3=40 WHERE c1=30; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c2="a"; +DELETE FROM t WHERE c1=20; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_img_eng_min.result b/mysql-test/suite/rpl/r/rpl_row_img_eng_min.result new file mode 100644 index 00000000000..ba01221d3b6 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_img_eng_min.result @@ -0,0 +1,3516 @@ +include/rpl_init.inc [topology=1->2->3] +CON: 'server_1', IMG: 'MINIMAL', RESTART SLAVE: 'N' +SET SESSION binlog_row_image= 'MINIMAL'; +SET GLOBAL binlog_row_image= 'MINIMAL'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image MINIMAL +CON: 'server_2', IMG: 'MINIMAL', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'MINIMAL'; +SET GLOBAL binlog_row_image= 'MINIMAL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image MINIMAL +CON: 'server_3', IMG: 'MINIMAL', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'MINIMAL'; +SET GLOBAL binlog_row_image= 'MINIMAL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image MINIMAL +### engines: MyISAM, MyISAM, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, MyISAM, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, InnoDB, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, InnoDB, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, MyISAM, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, MyISAM, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, InnoDB, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, InnoDB, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N' +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_img_eng_noblob.result b/mysql-test/suite/rpl/r/rpl_row_img_eng_noblob.result new file mode 100644 index 00000000000..16152f28c27 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_img_eng_noblob.result @@ -0,0 +1,3516 @@ +include/rpl_init.inc [topology=1->2->3] +CON: 'server_1', IMG: 'NOBLOB', RESTART SLAVE: 'N' +SET SESSION binlog_row_image= 'NOBLOB'; +SET GLOBAL binlog_row_image= 'NOBLOB'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image NOBLOB +CON: 'server_2', IMG: 'NOBLOB', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'NOBLOB'; +SET GLOBAL binlog_row_image= 'NOBLOB'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image NOBLOB +CON: 'server_3', IMG: 'NOBLOB', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'NOBLOB'; +SET GLOBAL binlog_row_image= 'NOBLOB'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image NOBLOB +### engines: MyISAM, MyISAM, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, MyISAM, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, InnoDB, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: MyISAM, InnoDB, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, MyISAM, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, MyISAM, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, InnoDB, MyISAM +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= MyISAM;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +### engines: InnoDB, InnoDB, InnoDB +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite NOT NULL Unique key with holes +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key with holes +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Primary Key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Primary key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Unique key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +****** TEST: One Composite key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: One key +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +SET SQL_LOG_BIN=0; +******* TEST: No keys +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +SET SQL_LOG_BIN=1; +INSERT INTO t VALUES (1, '1', '1', '1' ); +INSERT INTO t VALUES (4, '4', '4', '4' ); +INSERT INTO t VALUES (7, '7', '7', '7' ); +INSERT INTO t VALUES (9, '9', '9', NULL ); +INSERT INTO t VALUES (2, '1', '2', '2' ); +INSERT INTO t VALUES (3, '1', '3', '2' ); +include/rpl_sync.inc +UPDATE t SET c4 = '7'; +UPDATE t SET c4 = '5' WHERE c1 = 1; +UPDATE t SET c2 = '5' WHERE c1 = 1; +UPDATE t SET c1 = '5' WHERE c1 = 1; +UPDATE t SET c4 = '8' WHERE c2 = '4'; +UPDATE t SET c1 = '8' WHERE c2 = '4'; +UPDATE t SET c2 = '8' WHERE c2 = '4'; +UPDATE t SET c3 = '0' WHERE c4 = NULL; +UPDATE t SET c2 = '0' WHERE c4 = '0'; +UPDATE t SET c2 = '2' WHERE c4 = '2'; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DELETE FROM t WHERE c1 = 7; +DELETE FROM t WHERE c1 = 8; +DELETE FROM t; +include/rpl_sync.inc +include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t] +DROP TABLE t; +include/rpl_sync.inc +CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N' +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y' +SET SESSION binlog_row_image= 'FULL'; +SET GLOBAL binlog_row_image= 'FULL'; +include/stop_slave.inc +include/start_slave.inc +FLUSH TABLES; +SHOW VARIABLES LIKE 'binlog_row_image'; +Variable_name Value +binlog_row_image FULL +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_img.cnf b/mysql-test/suite/rpl/t/rpl_row_img.cnf new file mode 100644 index 00000000000..ed9a4292917 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img.cnf @@ -0,0 +1,21 @@ +!include include/default_mysqld.cnf + +[mysqld.1] +log-slave-updates +innodb +innodb_flush_log_at_trx_commit= 0 + +[mysqld.2] +log-slave-updates +innodb +innodb_flush_log_at_trx_commit= 0 + +[mysqld.3] +log-slave-updates +innodb +innodb_flush_log_at_trx_commit= 0 + +[ENV] +SERVER_MYPORT_1= @mysqld.1.port +SERVER_MYPORT_2= @mysqld.2.port +SERVER_MYPORT_3= @mysqld.3.port diff --git a/mysql-test/suite/rpl/t/rpl_row_img_blobs.cnf b/mysql-test/suite/rpl/t/rpl_row_img_blobs.cnf new file mode 100644 index 00000000000..d758d29f481 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_blobs.cnf @@ -0,0 +1 @@ +!include suite/rpl/t/rpl_row_img.cnf diff --git a/mysql-test/suite/rpl/t/rpl_row_img_blobs.test b/mysql-test/suite/rpl/t/rpl_row_img_blobs.test new file mode 100644 index 00000000000..467202391b0 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_blobs.test @@ -0,0 +1,59 @@ +#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 diff --git a/mysql-test/suite/rpl/t/rpl_row_img_eng_min.cnf b/mysql-test/suite/rpl/t/rpl_row_img_eng_min.cnf new file mode 100644 index 00000000000..d758d29f481 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_eng_min.cnf @@ -0,0 +1 @@ +!include suite/rpl/t/rpl_row_img.cnf diff --git a/mysql-test/suite/rpl/t/rpl_row_img_eng_min.test b/mysql-test/suite/rpl/t/rpl_row_img_eng_min.test new file mode 100644 index 00000000000..24b9655bd81 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_eng_min.test @@ -0,0 +1,39 @@ +#Want to skip this test from daily Valgrind execution +--source include/no_valgrind_without_big.inc +# +# This file contains tests for WL#5096 and bug fixes. +# + +--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 for different storage engines on each server, +# but same index structure on tables. The tests are conducted +# using MINIMAL binlog-row-image on all servers. +# + +-- 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.test +-- source include/rpl_row_img_general_loop.inc + +-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y +-- source include/rpl_row_img_set.inc + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.cnf b/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.cnf new file mode 100644 index 00000000000..d758d29f481 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.cnf @@ -0,0 +1 @@ +!include suite/rpl/t/rpl_row_img.cnf diff --git a/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.test b/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.test new file mode 100644 index 00000000000..5d5f95a6552 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.test @@ -0,0 +1,39 @@ +#Want to skip this test from daily Valgrind execution +--source include/no_valgrind_without_big.inc +# +# This file contains tests for WL#5096 and bug fixes. +# + +--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 for different storage engines on each server, +# but same index structure on tables. The tests are conducted +# using NOBLOB binlog-row-image on all servers. +# + +-- 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.test +-- source include/rpl_row_img_general_loop.inc + +-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y +-- source include/rpl_row_img_set.inc + + +--source include/rpl_end.inc diff --git a/mysql-test/suite/sys_vars/r/binlog_row_image_basic.result b/mysql-test/suite/sys_vars/r/binlog_row_image_basic.result new file mode 100644 index 00000000000..8a1aae216bb --- /dev/null +++ b/mysql-test/suite/sys_vars/r/binlog_row_image_basic.result @@ -0,0 +1,100 @@ +SELECT @@GLOBAL.binlog_row_image; +@@GLOBAL.binlog_row_image +FULL +SELECT @@SESSION.binlog_row_image; +@@SESSION.binlog_row_image +FULL +FULL Expected +'#---------------------BS_STVARS_002_01----------------------#' +SET @start_value= @@global.binlog_row_image; +SELECT COUNT(@@GLOBAL.binlog_row_image); +COUNT(@@GLOBAL.binlog_row_image) +1 +1 Expected +SELECT COUNT(@@SESSION.binlog_row_image); +COUNT(@@SESSION.binlog_row_image) +1 +1 Expected +'#---------------------BS_STVARS_002_02----------------------#' +SET @@GLOBAL.binlog_row_image=0; +SELECT @@GLOBAL.binlog_row_image; +@@GLOBAL.binlog_row_image +MINIMAL +MINIMAL Expected +SET @@SESSION.binlog_row_image=0; +SELECT @@SESSION.binlog_row_image; +@@SESSION.binlog_row_image +MINIMAL +MINIMAL Expected +SET @@GLOBAL.binlog_row_image=1; +SELECT @@GLOBAL.binlog_row_image; +@@GLOBAL.binlog_row_image +NOBLOB +NOBLOB Expected +SET @@SESSION.binlog_row_image=1; +SELECT @@SESSION.binlog_row_image; +@@SESSION.binlog_row_image +NOBLOB +NOBLOB Expected +SET @@GLOBAL.binlog_row_image=2; +SELECT @@GLOBAL.binlog_row_image; +@@GLOBAL.binlog_row_image +FULL +FULL Expected +SET @@SESSION.binlog_row_image=2; +SELECT @@SESSION.binlog_row_image; +@@SESSION.binlog_row_image +FULL +FULL Expected +'#---------------------BS_STVARS_002_03----------------------#' +SELECT @@GLOBAL.binlog_row_image = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='binlog_row_image'; +@@GLOBAL.binlog_row_image = VARIABLE_VALUE +1 +1 Expected +SELECT COUNT(@@GLOBAL.binlog_row_image); +COUNT(@@GLOBAL.binlog_row_image) +1 +1 Expected +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='binlog_row_image'; +COUNT(VARIABLE_VALUE) +1 +1 Expected +'#---------------------BS_STVARS_002_04----------------------#' +SELECT @@SESSION.binlog_row_image = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='binlog_row_image'; +@@SESSION.binlog_row_image = VARIABLE_VALUE +1 +1 Expected +SELECT COUNT(@@SESSION.binlog_row_image); +COUNT(@@SESSION.binlog_row_image) +1 +1 Expected +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='binlog_row_image'; +COUNT(VARIABLE_VALUE) +1 +1 Expected +'#---------------------BS_STVARS_002_05----------------------#' +SELECT COUNT(@@binlog_row_image); +COUNT(@@binlog_row_image) +1 +1 Expected +SELECT COUNT(@@local.binlog_row_image); +COUNT(@@local.binlog_row_image) +1 +1 Expected +SELECT COUNT(@@SESSION.binlog_row_image); +COUNT(@@SESSION.binlog_row_image) +1 +1 Expected +SELECT COUNT(@@GLOBAL.binlog_row_image); +COUNT(@@GLOBAL.binlog_row_image) +1 +1 Expected +SET @@global.binlog_row_image= @start_value; diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 641ba67ab7d..3c232d6b504 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -233,6 +233,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME BINLOG_ROW_IMAGE +SESSION_VALUE FULL +GLOBAL_VALUE FULL +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE FULL +VARIABLE_SCOPE SESSION +VARIABLE_TYPE ENUM +VARIABLE_COMMENT Controls whether rows should be logged in 'FULL', 'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all columns in the before and after image are logged. 'NOBLOB', means that mysqld avoids logging blob columns whenever possible (eg, blob column was not changed or is not part of primary key). 'MINIMAL', means that a PK equivalent (PK columns or full row if there is no PK in the table) is logged in the before image, and only changed columns are logged in the after image. (Default: FULL). +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST MINIMAL,NOBLOB,FULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME BINLOG_STMT_CACHE_SIZE SESSION_VALUE NULL GLOBAL_VALUE 32768 diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index e4e6b5a9801..42ee3381ac7 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -233,6 +233,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME BINLOG_ROW_IMAGE +SESSION_VALUE FULL +GLOBAL_VALUE FULL +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE FULL +VARIABLE_SCOPE SESSION +VARIABLE_TYPE ENUM +VARIABLE_COMMENT Controls whether rows should be logged in 'FULL', 'NOBLOB' or 'MINIMAL' formats. 'FULL', means that all columns in the before and after image are logged. 'NOBLOB', means that mysqld avoids logging blob columns whenever possible (eg, blob column was not changed or is not part of primary key). 'MINIMAL', means that a PK equivalent (PK columns or full row if there is no PK in the table) is logged in the before image, and only changed columns are logged in the after image. (Default: FULL). +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST MINIMAL,NOBLOB,FULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME BINLOG_STMT_CACHE_SIZE SESSION_VALUE NULL GLOBAL_VALUE 32768 diff --git a/mysql-test/suite/sys_vars/t/binlog_row_image_basic.test b/mysql-test/suite/sys_vars/t/binlog_row_image_basic.test new file mode 100644 index 00000000000..6f5095b6a5d --- /dev/null +++ b/mysql-test/suite/sys_vars/t/binlog_row_image_basic.test @@ -0,0 +1,129 @@ +################## mysql-test\t\binlog_row_image_basic.test ################### +# # +# Variable Name: binlog_row_image # +# Scope: Global & Session # +# Access Type: Static # +# Data Type: enumeration # +# # +# # +# Creation Date: 2010-05-20 # +# Author : Luis Soares # +# # +# # +# Description:Test Cases of Dynamic System Variable binlog_row_image # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.X/en/server-system-variables.html # +# # +############################################################################### + + +SELECT @@GLOBAL.binlog_row_image; +SELECT @@SESSION.binlog_row_image; +--echo FULL Expected + +--echo '#---------------------BS_STVARS_002_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SET @start_value= @@global.binlog_row_image; + +SELECT COUNT(@@GLOBAL.binlog_row_image); +--echo 1 Expected + +SELECT COUNT(@@SESSION.binlog_row_image); +--echo 1 Expected + +--echo '#---------------------BS_STVARS_002_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### +SET @@GLOBAL.binlog_row_image=0; +SELECT @@GLOBAL.binlog_row_image; +--echo MINIMAL Expected + +SET @@SESSION.binlog_row_image=0; +SELECT @@SESSION.binlog_row_image; +--echo MINIMAL Expected + +SET @@GLOBAL.binlog_row_image=1; +SELECT @@GLOBAL.binlog_row_image; +--echo NOBLOB Expected + +SET @@SESSION.binlog_row_image=1; +SELECT @@SESSION.binlog_row_image; +--echo NOBLOB Expected + +SET @@GLOBAL.binlog_row_image=2; +SELECT @@GLOBAL.binlog_row_image; +--echo FULL Expected + +SET @@SESSION.binlog_row_image=2; +SELECT @@SESSION.binlog_row_image; +--echo FULL Expected + +--echo '#---------------------BS_STVARS_002_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +--disable_warnings +SELECT @@GLOBAL.binlog_row_image = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='binlog_row_image'; +--enable_warnings +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.binlog_row_image); +--echo 1 Expected + +--disable_warnings +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='binlog_row_image'; +--enable_warnings +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_002_04----------------------#' +################################################################# +# Check if the value in SESSION Table matches value in variable # +################################################################# + +--disable_warnings +SELECT @@SESSION.binlog_row_image = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='binlog_row_image'; +--enable_warnings +--echo 1 Expected + +SELECT COUNT(@@SESSION.binlog_row_image); +--echo 1 Expected + +--disable_warnings +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='binlog_row_image'; +--enable_warnings +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_002_05----------------------#' +################################################################################ +# Check if binlog_row_image can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@binlog_row_image); +--echo 1 Expected +SELECT COUNT(@@local.binlog_row_image); +--echo 1 Expected +SELECT COUNT(@@SESSION.binlog_row_image); +--echo 1 Expected +SELECT COUNT(@@GLOBAL.binlog_row_image); +--echo 1 Expected + +SET @@global.binlog_row_image= @start_value; + diff --git a/mysql-test/t/analyze_stmt_orderby.test b/mysql-test/t/analyze_stmt_orderby.test index 4e280bebd37..a40f34805d1 100644 --- a/mysql-test/t/analyze_stmt_orderby.test +++ b/mysql-test/t/analyze_stmt_orderby.test @@ -147,6 +147,31 @@ select count(distinct t5.b) as sum from t5, t6 where t5.a=t6.a and t6.b > 0 and t5.a <= 5 group by t5.a order by sum limit 1; drop table t5,t6,t7; - drop table t3; + +--echo # +--echo # Tabular ANALYZE must get its data from execution tracker (and not from +--echo # the query plan) +--echo # + +CREATE TABLE t2( + col1 int, + col2 int, + UNIQUE INDEX idx (col1, col2)) engine=myisam; + +INSERT INTO t2(col1, col2) VALUES + (1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11), + (11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1); + +flush status; +explain +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +analyze +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ /"r_buffer_size": "[^"]+"/"r_buffer_size": "REPLACED"/ +analyze format=json +select col1 f1, col2 f2, col1 f3 from t2 group by f1; +drop table t2; + + drop table t0,t1; diff --git a/mysql-test/t/ctype_eucjpms.test b/mysql-test/t/ctype_eucjpms.test index 2dd806ed027..d533e38b2a2 100644 --- a/mysql-test/t/ctype_eucjpms.test +++ b/mysql-test/t/ctype_eucjpms.test @@ -541,3 +541,28 @@ SELECT _eucjpms 0x8EA0; --echo # --echo # End of 10.0 tests --echo # + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character" +--echo # +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms, KEY(a)); +# [x00-x7F] # ASCII/JIS-Roman +# [x8E][xA1-xDF] # half-width katakana +# [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990 +# [xA1-xFE][xA1-xFE] # JIS X 0208:1997 +INSERT INTO t1 VALUES ('a'),(0x7F); +INSERT INTO t1 VALUES (0x8EA1),(0x8EDF); +INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE); +INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE); +SELECT HEX(a) FROM t1 ORDER BY a; +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET eucjpms COLLATE eucjpms_bin; +SELECT HEX(a) FROM t1 ORDER BY a; +DROP TABLE t1; + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test index 94fc7ffe4c0..6fc928c7e60 100644 --- a/mysql-test/t/ctype_ujis.test +++ b/mysql-test/t/ctype_ujis.test @@ -1369,3 +1369,28 @@ SELECT _ujis 0x8EA0; --echo # --echo # End of 10.0 tests --echo # + + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character" +--echo # +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis, KEY(a)); +# [x00-x7F] # ASCII/JIS-Roman +# [x8E][xA1-xDF] # half-width katakana +# [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990 +# [xA1-xFE][xA1-xFE] # JIS X 0208:1997 +INSERT INTO t1 VALUES ('a'),(0x7F); +INSERT INTO t1 VALUES (0x8EA1),(0x8EDF); +INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE); +INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE); +SELECT HEX(a) FROM t1 ORDER BY a; +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ujis COLLATE ujis_bin; +SELECT HEX(a) FROM t1 ORDER BY a;DROP TABLE t1; + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index e4305ed9879..8ea6ea67f1f 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -860,3 +860,31 @@ DEALLOCATE PREPARE stmt; --echo # --echo # End of 10.0 tests --echo # + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +--echo # +CREATE TABLE t1 ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + a VARCHAR(10) CHARACTER SET utf16, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (_utf8mb4 0x61); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +SELECT COUNT(DISTINCT a) FROM t1; +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +SELECT COUNT(DISTINCT a) FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/ctype_utf16le.test b/mysql-test/t/ctype_utf16le.test index a8326900847..f5998fec18c 100644 --- a/mysql-test/t/ctype_utf16le.test +++ b/mysql-test/t/ctype_utf16le.test @@ -744,3 +744,31 @@ SET NAMES utf8, collation_connection=utf16le_bin; --echo # --echo # End of 5.6 tests --echo # + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +--echo # +CREATE TABLE t1 ( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + a VARCHAR(10) CHARACTER SET utf16le, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (_utf8mb4 0x61); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF); +INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +SELECT COUNT(DISTINCT a) FROM t1; +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16le COLLATE utf16le_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +SELECT COUNT(DISTINCT a) FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index e6583f990ca..a75ac72b67f 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -956,3 +956,20 @@ DEALLOCATE PREPARE stmt; --echo # End of 10.0 tests --echo # +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-8419 utf32: compare broken bytes as "greater than any non-broken character" +--echo # +# Make sure that all non-BMP characters are compared as equal +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32, KEY(a)); +INSERT INTO t1 VALUES (0x10000),(0x10001),(0x10002); +SELECT COUNT(DISTINCT a) FROM t1; +DROP TABLE t1; +SELECT _utf32 0x10001=_utf32 0x10002; + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test index 7d873c555f6..019d8edde2f 100644 --- a/mysql-test/t/join_cache.test +++ b/mysql-test/t/join_cache.test @@ -2505,6 +2505,18 @@ SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; +# MDEV-8189 field<>const and const<>field are not symmetric +# Do the same EXPLAIN and SELECT +# for "t2.v <> t3.v" instead of "t3.v <> t2.v" + +EXPLAIN +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 + GROUP BY t2.v ORDER BY t1.pk,t2.v; +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 + GROUP BY t2.v ORDER BY t1.pk,t2.v; + SET SESSION join_cache_level=6; EXPLAIN SELECT t2.v FROM t1, t2, t3 @@ -2514,6 +2526,17 @@ SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; +# MDEV-8189 field<>const and const<>field are not symmetric +# Do the same EXPLAIN and SELECT +# for "t2.v <> t3.v" instead of "t3.v <> t2.v" +EXPLAIN +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 + GROUP BY t2.v ORDER BY t1.pk,t2.v; +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 + GROUP BY t2.v ORDER BY t1.pk,t2.v; + SET SESSION join_cache_level=4; EXPLAIN SELECT t2.v FROM t1, t2, t3 @@ -2523,6 +2546,17 @@ SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; +# MDEV-8189 field<>const and const<>field are not symmetric +# Do the same EXPLAIN and SELECT +# for "t2.v <> t3.v" instead of "t3.v <> t2.v" +EXPLAIN +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 + GROUP BY t2.v ORDER BY t1.pk,t2.v; +SELECT t2.v FROM t1, t2, t3 +WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 + GROUP BY t2.v ORDER BY t1.pk,t2.v; + DROP TABLE t1,t2,t3; SET SESSION join_cache_level=DEFAULT; diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 6249d2b5e4f..d65e0bb2f73 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1777,3 +1777,24 @@ explain extended select * from t2 where (b > 25 and b < 15) or c < 44; explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); drop table t1,t2; + + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-8189 field<>const and const<>field are not symmetric +--echo # +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70); +EXPLAIN SELECT * FROM t1 WHERE a<>10; +EXPLAIN SELECT * FROM t1 WHERE 10<>a; +SELECT * FROM t1 WHERE a<>10; +SELECT * FROM t1 WHERE 10<>a; +DROP TABLE t1; + + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/subselect_cache.test b/mysql-test/t/subselect_cache.test index 1276e546030..21247541fb6 100644 --- a/mysql-test/t/subselect_cache.test +++ b/mysql-test/t/subselect_cache.test @@ -24,6 +24,16 @@ select a, (select d from t2 where b=c) from t1; show status like "subquery_cache%"; show status like '%Handler_read%'; +--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ +analyze format=json +select a, (select d from t2 where b=c) from t1; +--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ +analyze format=json +select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1; +explain format=json +select a, (select d from t2 where b=c) from t1; +explain format=json +select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1; set optimizer_switch='subquery_cache=off'; flush status; diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test index 0bf9c6d9d10..7ee52a0fa8a 100644 --- a/mysql-test/t/subselect_sj2.test +++ b/mysql-test/t/subselect_sj2.test @@ -1222,6 +1222,25 @@ WHERE alias3.d IN ( AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) ); +# MDEV-8189 field<>const and const<>field are not symmetric +# Do the same EXPLAIN SELECT and SELECT +# with "alias3.c != alias5.c" instead of "alias5.c != alias3.c" + +EXPLAIN +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( + SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 + WHERE alias5.b = alias4.b + AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); + +SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 +WHERE alias3.d IN ( + SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 + WHERE alias5.b = alias4.b + AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) +); + set optimizer_prune_level=@tmp_951283; DROP TABLE t1,t2; diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index f3e603e9da8..cd311182921 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -623,5 +623,32 @@ let defval='0000-00-00 00:00:00'; --source include/type_temporal_zero_default.inc --echo # +--echo # MDEV-8336 The meaning of NO_ZERO_DATE is not clear for DATETIME +--echo # +SET sql_mode='NO_ZERO_DATE'; +SELECT TIMESTAMP'0000-00-01 10:20:30'; +SELECT TIMESTAMP'0000-00-00 10:20:30'; +SELECT TIMESTAMP'0000-00-00 00:00:00.000001'; +CREATE TABLE t1 (a DATETIME); +INSERT INTO t1 VALUES ('0000-00-00 10:20:30'); +SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME(6)); +INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000001'); +SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1; +DROP TABLE t1; +SELECT STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s'); +SELECT STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f'); +SET old_mode=zero_date_time_cast; +SELECT CAST(TIME'10:20:30' AS DATETIME); +SELECT CAST(TIME'00:00:00.000001' AS DATETIME(6)); +SELECT CAST(CAST('10:20:30' AS TIME) AS DATETIME); +SELECT CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6)); +SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME); +SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6)); +SET old_mode=DEFAULT; +SET sql_mode=DEFAULT; + +--echo # --echo # End of 10.1 tests --echo # diff --git a/sql/field.cc b/sql/field.cc index 81334aff39c..6ca0d4a7d63 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -10093,10 +10093,9 @@ Create_field::Create_field(Field *old_field,Field *orig_field) orig_field->move_field_offset(diff); // Points now at default_values if (!orig_field->is_real_null()) { - char buff[MAX_FIELD_WIDTH], *pos; - String tmp(buff, sizeof(buff), charset), *res; - res= orig_field->val_str(&tmp); - pos= (char*) sql_strmake(res->ptr(), res->length()); + StringBuffer<MAX_FIELD_WIDTH> tmp(charset); + String *res= orig_field->val_str(&tmp); + char *pos= (char*) sql_strmake(res->ptr(), res->length()); def= new Item_string(pos, res->length(), charset); } orig_field->move_field_offset(-diff); // Back to record[0] diff --git a/sql/handler.cc b/sql/handler.cc index 82a2e784aa0..f85575fa208 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -5662,8 +5662,7 @@ static int write_locked_table_maps(THD *thd) } -typedef bool Log_func(THD*, TABLE*, bool, MY_BITMAP*, - uint, const uchar*, const uchar*); +typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*); static int binlog_log_row(TABLE* table, const uchar *before_record, @@ -5680,40 +5679,24 @@ static int binlog_log_row(TABLE* table, if (check_table_binlog_row_based(thd, table)) { - MY_BITMAP cols; - /* Potential buffer on the stack for the bitmap */ - uint32 bitbuf[BITMAP_STACKBUF_SIZE/sizeof(uint32)]; - uint n_fields= table->s->fields; - my_bool use_bitbuf= n_fields <= sizeof(bitbuf)*8; - /* If there are no table maps written to the binary log, this is the first row handled in this statement. In that case, we need to write table maps for all locked tables to the binary log. */ - if (likely(!(error= my_bitmap_init(&cols, - use_bitbuf ? bitbuf : NULL, - (n_fields + 7) & ~7UL, - FALSE)))) + if (likely(!(error= write_locked_table_maps(thd)))) { - bitmap_set_all(&cols); - if (likely(!(error= write_locked_table_maps(thd)))) - { - /* - We need to have a transactional behavior for SQLCOM_CREATE_TABLE - (i.e. CREATE TABLE... SELECT * FROM TABLE) in order to keep a - compatible behavior with the STMT based replication even when - the table is not transactional. In other words, if the operation - fails while executing the insert phase nothing is written to the - binlog. - */ - bool const has_trans= thd->lex->sql_command == SQLCOM_CREATE_TABLE || - table->file->has_transactions(); - error= (*log_func)(thd, table, has_trans, &cols, table->s->fields, - before_record, after_record); - } - if (!use_bitbuf) - my_bitmap_free(&cols); + /* + We need to have a transactional behavior for SQLCOM_CREATE_TABLE + (i.e. CREATE TABLE... SELECT * FROM TABLE) in order to keep a + compatible behavior with the STMT based replication even when + the table is not transactional. In other words, if the operation + fails while executing the insert phase nothing is written to the + binlog. + */ + bool const has_trans= thd->lex->sql_command == SQLCOM_CREATE_TABLE || + table->file->has_transactions(); + error= (*log_func)(thd, table, has_trans, before_record, after_record); } } return error ? HA_ERR_RBR_LOGGING_FAILED : 0; diff --git a/sql/item.cc b/sql/item.cc index a6a1d6a5cb8..d14701dbd70 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1715,7 +1715,7 @@ public: SPLIT_FUNC_SKIP_REGISTERED: Function be must skipped for registered SUM SUM items - SPLIT_FUNC_SELECT + SPLIT_SUM_SELECT We are called on the select level and have to register items operated on sum function @@ -7593,6 +7593,19 @@ bool Item_cache_wrapper::set_cache(THD *thd) DBUG_RETURN(expr_cache == NULL); } +Expression_cache_tracker* Item_cache_wrapper::init_tracker(MEM_ROOT *mem_root) +{ + if (expr_cache) + { + Expression_cache_tracker* tracker= + new(mem_root) Expression_cache_tracker(expr_cache); + if (tracker) + ((Expression_cache_tmptable *)expr_cache)->set_tracker(tracker); + return tracker; + } + return NULL; +} + /** Check if the current values of the parameters are in the expression cache diff --git a/sql/item.h b/sql/item.h index 8f1adea7a35..b611194d67e 100644 --- a/sql/item.h +++ b/sql/item.h @@ -3808,6 +3808,7 @@ public: class Item_cache; class Expression_cache; +class Expression_cache_tracker; /** The objects of this class can store its values in an expression cache. @@ -3842,6 +3843,7 @@ public: enum Type real_type() const { return orig_item->type(); } bool set_cache(THD *thd); + Expression_cache_tracker* init_tracker(MEM_ROOT *mem_root); bool fix_fields(THD *thd, Item **it); void cleanup(); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 6cdabd05601..e64f9dbab7b 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -591,6 +591,7 @@ public: Item_func_ne(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {} longlong val_int(); enum Functype functype() const { return NE_FUNC; } + enum Functype rev_functype() const { return NE_FUNC; } cond_result eq_cmp_result() const { return COND_FALSE; } const char *func_name() const { return "<>"; } Item *negated_item(); diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index cad44a2f4e7..4eb10cf71f3 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1204,7 +1204,10 @@ Item* Item_singlerow_subselect::expr_cache_insert_transformer(uchar *thd_arg) if (expr_cache_is_needed(tmp_thd) && (expr_cache= set_expr_cache(tmp_thd))) + { + init_expr_cache_tracker(tmp_thd); DBUG_RETURN(expr_cache); + } DBUG_RETURN(this); } @@ -1501,7 +1504,10 @@ Item* Item_exists_subselect::expr_cache_insert_transformer(uchar *thd_arg) if (substype() == EXISTS_SUBS && expr_cache_is_needed(tmp_thd) && (expr_cache= set_expr_cache(tmp_thd))) + { + init_expr_cache_tracker(tmp_thd); DBUG_RETURN(expr_cache); + } DBUG_RETURN(this); } @@ -6561,3 +6567,23 @@ void subselect_table_scan_engine::cleanup() { } + +/* + Create an execution tracker for the expression cache we're using for this + subselect; add the tracker to the query plan. +*/ + +void Item_subselect::init_expr_cache_tracker(THD *thd) +{ + if(!expr_cache) + return; + + Explain_query *qw= thd->lex->explain; + DBUG_ASSERT(qw); + Explain_node *node= qw->get_node(unit->first_select()->select_number); + if (!node) + return; + DBUG_ASSERT(expr_cache->type() == Item::EXPR_CACHE_ITEM); + node->cache_tracker= ((Item_cache_wrapper *)expr_cache)->init_tracker(qw->mem_root); +} + diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 01d454d62f0..4702d5abbfa 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -244,7 +244,10 @@ public: bool limit_index_condition_pushdown_processor(uchar *opt_arg) { return TRUE; - } + } + + void init_expr_cache_tracker(THD *thd); + friend class select_result_interceptor; friend class Item_in_optimizer; diff --git a/sql/log_event.cc b/sql/log_event.cc index 6d03dca69f9..1ba7dcade44 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -9499,6 +9499,18 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length) DBUG_ENTER("Rows_log_event::do_add_row_data"); DBUG_PRINT("enter", ("row_data: 0x%lx length: %lu", (ulong) row_data, (ulong) length)); + + /* + If length is zero, there is nothing to write, so we just + return. Note that this is not an optimization, since calling + realloc() with size 0 means free(). + */ + if (length == 0) + { + m_row_count++; + DBUG_RETURN(0); + } + /* Don't print debug messages when running valgrind since they can trigger false warnings. @@ -9855,12 +9867,19 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) longer if slave has extra columns. */ - DBUG_PRINT_BITSET("debug", "Setting table's write_set from: %s", &m_cols); + DBUG_PRINT_BITSET("debug", "Setting table's read_set from: %s", &m_cols); bitmap_set_all(table->read_set); + if (get_general_type_code() == DELETE_ROWS_EVENT || + get_general_type_code() == UPDATE_ROWS_EVENT) + bitmap_intersect(table->read_set,&m_cols); + bitmap_set_all(table->write_set); - if (!get_flags(COMPLETE_ROWS_F)) - bitmap_intersect(table->write_set,&m_cols); + + /* WRITE ROWS EVENTS store the bitmap in m_cols instead of m_cols_ai */ + MY_BITMAP *after_image= ((get_general_type_code() == UPDATE_ROWS_EVENT) ? + &m_cols_ai : &m_cols); + bitmap_intersect(table->write_set, after_image); this->slave_exec_mode= slave_exec_mode_options; // fix the mode @@ -9888,7 +9907,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) rgi->set_row_stmt_start_timestamp(); THD_STAGE_INFO(thd, stage_executing); - while (error == 0 && m_curr_row < m_rows_end) + do { /* in_use can have been set to NULL in close_tables_for_reopen */ THD* old_thd= table->in_use; @@ -9936,18 +9955,14 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) if (!m_curr_row_end && !error) error= unpack_current_row(rgi); - - // at this moment m_curr_row_end should be set - DBUG_ASSERT(error || m_curr_row_end != NULL); - DBUG_ASSERT(error || m_curr_row < m_curr_row_end); - DBUG_ASSERT(error || m_curr_row_end <= m_rows_end); - + m_curr_row= m_curr_row_end; if (error == 0 && !transactional_table) thd->transaction.all.modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table= TRUE; } // row processing loop + while (error == 0 && (m_curr_row != m_rows_end)); /* Restore the sql_mode after the rows event is processed. @@ -11118,9 +11133,9 @@ void Table_map_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info) #if !defined(MYSQL_CLIENT) Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid_arg, - MY_BITMAP const *cols, bool is_transactional) - : Rows_log_event(thd_arg, tbl_arg, tid_arg, cols, is_transactional, WRITE_ROWS_EVENT_V1) + : Rows_log_event(thd_arg, tbl_arg, tid_arg, tbl_arg->write_set, + is_transactional, WRITE_ROWS_EVENT_V1) { } #endif @@ -11377,7 +11392,16 @@ Rows_log_event::write_row(rpl_group_info *rgi, the size of the first row and use that value to initialize storage engine for bulk insertion. */ - ulong estimated_rows= (m_rows_end - m_curr_row) / (m_curr_row_end - m_curr_row); + /* this is the first row to be inserted, we estimate the rows with + the size of the first row and use that value to initialize + storage engine for bulk insertion */ + DBUG_ASSERT(!(m_curr_row > m_curr_row_end)); + ulong estimated_rows= 0; + if (m_curr_row < m_curr_row_end) + estimated_rows= (m_rows_end - m_curr_row) / (m_curr_row_end - m_curr_row); + else if (m_curr_row == m_curr_row_end) + estimated_rows= 1; + table->file->ha_start_bulk_insert(estimated_rows); } @@ -12132,9 +12156,9 @@ end: #ifndef MYSQL_CLIENT Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg, - ulong tid, MY_BITMAP const *cols, - bool is_transactional) - : Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional, DELETE_ROWS_EVENT_V1) + ulong tid, bool is_transactional) + : Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional, + DELETE_ROWS_EVENT_V1) { } #endif /* #if !defined(MYSQL_CLIENT) */ @@ -12262,21 +12286,11 @@ uint8 Delete_rows_log_event::get_trg_event_map() #if !defined(MYSQL_CLIENT) Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, - MY_BITMAP const *cols_bi, - MY_BITMAP const *cols_ai, - bool is_transactional) -: Rows_log_event(thd_arg, tbl_arg, tid, cols_bi, is_transactional, UPDATE_ROWS_EVENT_V1) -{ - init(cols_ai); -} - -Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg, - ulong tid, - MY_BITMAP const *cols, bool is_transactional) -: Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional, UPDATE_ROWS_EVENT_V1) +: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional, + UPDATE_ROWS_EVENT_V1) { - init(cols); + init(tbl_arg->write_set); } void Update_rows_log_event::init(MY_BITMAP const *cols) @@ -12378,7 +12392,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi) able to skip to the next pair of updates */ m_curr_row= m_curr_row_end; - unpack_current_row(rgi); + unpack_current_row(rgi, &m_cols_ai); thd_proc_info(thd, tmp); return error; } @@ -12407,7 +12421,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi) /* this also updates m_curr_row_end */ thd_proc_info(thd, message); - if ((error= unpack_current_row(rgi))) + if ((error= unpack_current_row(rgi, &m_cols_ai))) goto err; /* @@ -12440,9 +12454,15 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi) goto err; } + // Temporary fix to find out why it fails [/Matz] + memcpy(m_table->read_set->bitmap, m_cols.bitmap, (m_table->read_set->n_bits + 7) / 8); + memcpy(m_table->write_set->bitmap, m_cols_ai.bitmap, (m_table->write_set->n_bits + 7) / 8); + + m_table->mark_columns_per_binlog_row_image(); error= m_table->file->ha_update_row(m_table->record[1], m_table->record[0]); if (error == HA_ERR_RECORD_IS_THE_SAME) error= 0; + m_table->default_column_bitmaps(); if (invoke_triggers && !error && process_triggers(TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE)) diff --git a/sql/log_event.h b/sql/log_event.h index b57ef35aad2..95b68e627ff 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -4264,9 +4264,58 @@ public: virtual int get_data_size(); MY_BITMAP const *get_cols() const { return &m_cols; } + MY_BITMAP const *get_cols_ai() const { return &m_cols_ai; } size_t get_width() const { return m_width; } ulong get_table_id() const { return m_table_id; } +#if defined(MYSQL_SERVER) + /* + This member function compares the table's read/write_set + with this event's m_cols and m_cols_ai. Comparison takes + into account what type of rows event is this: Delete, Write or + Update, therefore it uses the correct m_cols[_ai] according + to the event type code. + + Note that this member function should only be called for the + following events: + - Delete_rows_log_event + - Write_rows_log_event + - Update_rows_log_event + + @param[IN] table The table to compare this events bitmaps + against. + + @return TRUE if sets match, FALSE otherwise. (following + bitmap_cmp return logic). + + */ + virtual bool read_write_bitmaps_cmp(TABLE *table) + { + bool res= FALSE; + + switch (get_general_type_code()) + { + case DELETE_ROWS_EVENT: + res= bitmap_cmp(get_cols(), table->read_set); + break; + case UPDATE_ROWS_EVENT: + res= (bitmap_cmp(get_cols(), table->read_set) && + bitmap_cmp(get_cols_ai(), table->write_set)); + break; + case WRITE_ROWS_EVENT: + res= bitmap_cmp(get_cols(), table->write_set); + break; + default: + /* + We should just compare bitmaps for Delete, Write + or Update rows events. + */ + DBUG_ASSERT(0); + } + return res; + } +#endif + #ifdef MYSQL_SERVER virtual bool write_data_header(IO_CACHE *file); virtual bool write_data_body(IO_CACHE *file); @@ -4360,12 +4409,23 @@ protected: int find_row(rpl_group_info *); int write_row(rpl_group_info *, const bool); + // Unpack the current row into m_table->record[0], but with + // a different columns bitmap. + int unpack_current_row(rpl_group_info *rgi, MY_BITMAP const *cols) + { + DBUG_ASSERT(m_table); + + ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT); + return ::unpack_row(rgi, m_table, m_width, m_curr_row, cols, + &m_curr_row_end, &m_master_reclength, m_rows_end); + } + // Unpack the current row into m_table->record[0] int unpack_current_row(rpl_group_info *rgi) { DBUG_ASSERT(m_table); - ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT); + ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT); return ::unpack_row(rgi, m_table, m_width, m_curr_row, &m_cols, &m_curr_row_end, &m_master_reclength, m_rows_end); } @@ -4469,8 +4529,8 @@ public: }; #if defined(MYSQL_SERVER) - Write_rows_log_event(THD*, TABLE*, ulong table_id, - MY_BITMAP const *cols, bool is_transactional); + Write_rows_log_event(THD*, TABLE*, ulong table_id, + bool is_transactional); #endif #ifdef HAVE_REPLICATION Write_rows_log_event(const char *buf, uint event_len, @@ -4479,14 +4539,11 @@ public: #if defined(MYSQL_SERVER) static bool binlog_row_logging_function(THD *thd, TABLE *table, bool is_transactional, - MY_BITMAP *cols, - uint fields, const uchar *before_record __attribute__((unused)), const uchar *after_record) { - return thd->binlog_write_row(table, is_transactional, - cols, fields, after_record); + return thd->binlog_write_row(table, is_transactional, after_record); } #endif @@ -4532,12 +4589,6 @@ public: #ifdef MYSQL_SERVER Update_rows_log_event(THD*, TABLE*, ulong table_id, - MY_BITMAP const *cols_bi, - MY_BITMAP const *cols_ai, - bool is_transactional); - - Update_rows_log_event(THD*, TABLE*, ulong table_id, - MY_BITMAP const *cols, bool is_transactional); void init(MY_BITMAP const *cols); @@ -4553,13 +4604,11 @@ public: #ifdef MYSQL_SERVER static bool binlog_row_logging_function(THD *thd, TABLE *table, bool is_transactional, - MY_BITMAP *cols, - uint fields, const uchar *before_record, const uchar *after_record) { return thd->binlog_update_row(table, is_transactional, - cols, fields, before_record, after_record); + before_record, after_record); } #endif @@ -4616,8 +4665,7 @@ public: }; #ifdef MYSQL_SERVER - Delete_rows_log_event(THD*, TABLE*, ulong, - MY_BITMAP const *cols, bool is_transactional); + Delete_rows_log_event(THD*, TABLE*, ulong, bool is_transactional); #endif #ifdef HAVE_REPLICATION Delete_rows_log_event(const char *buf, uint event_len, @@ -4626,14 +4674,12 @@ public: #ifdef MYSQL_SERVER static bool binlog_row_logging_function(THD *thd, TABLE *table, bool is_transactional, - MY_BITMAP *cols, - uint fields, const uchar *before_record, const uchar *after_record __attribute__((unused))) { return thd->binlog_delete_row(table, is_transactional, - cols, fields, before_record); + before_record); } #endif diff --git a/sql/log_event_old.h b/sql/log_event_old.h index 7408e121f96..ed07f753e7a 100644 --- a/sql/log_event_old.h +++ b/sql/log_event_old.h @@ -369,14 +369,11 @@ public: #if !defined(MYSQL_CLIENT) static bool binlog_row_logging_function(THD *thd, TABLE *table, bool is_transactional, - MY_BITMAP *cols, - uint fields, const uchar *before_record __attribute__((unused)), const uchar *after_record) { - return thd->binlog_write_row(table, is_transactional, - cols, fields, after_record); + return thd->binlog_write_row(table, is_transactional, after_record); } #endif @@ -452,7 +449,7 @@ public: const uchar *after_record) { return thd->binlog_update_row(table, is_transactional, - cols, fields, before_record, after_record); + before_record, after_record); } #endif @@ -526,8 +523,7 @@ public: const uchar *after_record __attribute__((unused))) { - return thd->binlog_delete_row(table, is_transactional, - cols, fields, before_record); + return thd->binlog_delete_row(table, is_transactional, before_record); } #endif diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6ecd4ba5e4a..0cb4b601ee0 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1902,7 +1902,10 @@ static void __cdecl kill_server(int sig_ptr) #endif /* Stop wsrep threads in case they are running. */ - wsrep_stop_replication(NULL); + if (wsrep_running_threads > 0) + { + wsrep_stop_replication(NULL); + } close_connections(); @@ -5808,10 +5811,6 @@ int mysqld_main(int argc, char **argv) wsrep_create_appliers(wsrep_slave_threads - 1); } } - else - { - wsrep_init_startup (false); - } if (opt_bootstrap) { @@ -7523,7 +7522,6 @@ struct my_option my_long_options[]= MYSQL_COMPATIBILITY_OPTION("log-bin-use-v1-row-events"), MYSQL_TO_BE_IMPLEMENTED_OPTION("default-authentication-plugin"), MYSQL_COMPATIBILITY_OPTION("binlog-max-flush-queue-time"), - MYSQL_TO_BE_IMPLEMENTED_OPTION("binlog-row-image"), MYSQL_TO_BE_IMPLEMENTED_OPTION("explicit-defaults-for-timestamp"), MYSQL_COMPATIBILITY_OPTION("master-info-repository"), MYSQL_COMPATIBILITY_OPTION("relay-log-info-repository"), diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc index 19b193729fd..caa84d867ad 100644 --- a/sql/rpl_injector.cc +++ b/sql/rpl_injector.cc @@ -118,62 +118,6 @@ int injector::transaction::use_table(server_id_type sid, table tbl) } -int injector::transaction::write_row (server_id_type sid, table tbl, - MY_BITMAP const* cols, size_t colcnt, - record_type record) -{ - DBUG_ENTER("injector::transaction::write_row(...)"); - - int error= check_state(ROW_STATE); - if (error) - DBUG_RETURN(error); - - server_id_type save_id= m_thd->variables.server_id; - m_thd->set_server_id(sid); - error= m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(), - cols, colcnt, record); - m_thd->set_server_id(save_id); - DBUG_RETURN(error); -} - - -int injector::transaction::delete_row(server_id_type sid, table tbl, - MY_BITMAP const* cols, size_t colcnt, - record_type record) -{ - DBUG_ENTER("injector::transaction::delete_row(...)"); - - int error= check_state(ROW_STATE); - if (error) - DBUG_RETURN(error); - - server_id_type save_id= m_thd->variables.server_id; - m_thd->set_server_id(sid); - error= m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(), - cols, colcnt, record); - m_thd->set_server_id(save_id); - DBUG_RETURN(error); -} - - -int injector::transaction::update_row(server_id_type sid, table tbl, - MY_BITMAP const* cols, size_t colcnt, - record_type before, record_type after) -{ - DBUG_ENTER("injector::transaction::update_row(...)"); - - int error= check_state(ROW_STATE); - if (error) - DBUG_RETURN(error); - - server_id_type save_id= m_thd->variables.server_id; - m_thd->set_server_id(sid); - error= m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(), - cols, colcnt, before, after); - m_thd->set_server_id(save_id); - DBUG_RETURN(error); -} - injector::transaction::binlog_pos injector::transaction::start_pos() const { diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h index 6be3d7cf4ec..41e1fcf460c 100644 --- a/sql/rpl_injector.h +++ b/sql/rpl_injector.h @@ -181,27 +181,6 @@ public: int use_table(server_id_type sid, table tbl); /* - Add a 'write row' entry to the transaction. - */ - int write_row (server_id_type sid, table tbl, - MY_BITMAP const *cols, size_t colcnt, - record_type record); - - /* - Add a 'delete row' entry to the transaction. - */ - int delete_row(server_id_type sid, table tbl, - MY_BITMAP const *cols, size_t colcnt, - record_type record); - - /* - Add an 'update row' entry to the transaction. - */ - int update_row(server_id_type sid, table tbl, - MY_BITMAP const *cols, size_t colcnt, - record_type before, record_type after); - - /* Commit a transaction. This member function will clean up after a sequence of *_row calls by, diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index 7a412b25af3..ee222f02f07 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -209,6 +209,16 @@ unpack_row(rpl_group_info *rgi, Field **field_ptr; Field **const end_ptr= begin_ptr + colcnt; + if (bitmap_is_clear_all(cols)) + { + /** + There was no data sent from the master, so there is + nothing to unpack. + */ + *current_row_end= pack_ptr; + *master_reclength= 0; + DBUG_RETURN(error); + } DBUG_ASSERT(null_ptr < row_data + master_null_byte_count); // Mask to mask out the correct bit among the null bits diff --git a/sql/sql_class.cc b/sql/sql_class.cc index fda4f5848be..8e4d35c4688 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -5922,13 +5922,11 @@ int THD::decide_logging_format(TABLE_LIST *tables) If error, NULL. */ -template <class RowsEventT> Rows_log_event* +template <class RowsEventT> Rows_log_event* THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, - MY_BITMAP const* cols, - size_t colcnt, size_t needed, bool is_transactional, - RowsEventT *hint __attribute__((unused))) + RowsEventT *hint __attribute__((unused))) { DBUG_ENTER("binlog_prepare_pending_rows_event"); /* Pre-conditions */ @@ -5964,16 +5962,15 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, event. */ if (!pending || - pending->server_id != serv_id || + pending->server_id != serv_id || pending->get_table_id() != table->s->table_map_id || - pending->get_general_type_code() != general_type_code || - pending->get_data_size() + needed > opt_binlog_rows_event_max_size || - pending->get_width() != colcnt || - !bitmap_cmp(pending->get_cols(), cols)) + pending->get_general_type_code() != general_type_code || + pending->get_data_size() + needed > opt_binlog_rows_event_max_size || + pending->read_write_bitmaps_cmp(table) == FALSE) { /* Create a new RowsEventT... */ Rows_log_event* const - ev= new RowsEventT(this, table, table->s->table_map_id, cols, + ev= new RowsEventT(this, table, table->s->table_map_id, is_transactional); if (unlikely(!ev)) DBUG_RETURN(NULL); @@ -6118,9 +6115,8 @@ CPP_UNNAMED_NS_START CPP_UNNAMED_NS_END -int THD::binlog_write_row(TABLE* table, bool is_trans, - MY_BITMAP const* cols, size_t colcnt, - uchar const *record) +int THD::binlog_write_row(TABLE* table, bool is_trans, + uchar const *record) { DBUG_ASSERT(is_current_stmt_binlog_format_row() && @@ -6135,14 +6131,14 @@ int THD::binlog_write_row(TABLE* table, bool is_trans, uchar *row_data= memory.slot(0); - size_t const len= pack_row(table, cols, row_data, record); + size_t const len= pack_row(table, table->write_set, row_data, record); /* Ensure that all events in a GTID group are in the same cache */ if (variables.option_bits & OPTION_GTID_BEGIN) is_trans= 1; Rows_log_event* const ev= - binlog_prepare_pending_rows_event(table, variables.server_id, cols, colcnt, + binlog_prepare_pending_rows_event(table, variables.server_id, len, is_trans, static_cast<Write_rows_log_event*>(0)); @@ -6153,13 +6149,19 @@ int THD::binlog_write_row(TABLE* table, bool is_trans, } int THD::binlog_update_row(TABLE* table, bool is_trans, - MY_BITMAP const* cols, size_t colcnt, const uchar *before_record, const uchar *after_record) { DBUG_ASSERT(is_current_stmt_binlog_format_row() && ((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open())); + /** + Save a reference to the original read and write set bitmaps. + We will need this to restore the bitmaps at the end. + */ + MY_BITMAP *old_read_set= table->read_set; + MY_BITMAP *old_write_set= table->write_set; + size_t const before_maxlen = max_row_length(table, before_record); size_t const after_maxlen = max_row_length(table, after_record); @@ -6170,9 +6172,9 @@ int THD::binlog_update_row(TABLE* table, bool is_trans, uchar *before_row= row_data.slot(0); uchar *after_row= row_data.slot(1); - size_t const before_size= pack_row(table, cols, before_row, + size_t const before_size= pack_row(table, table->read_set, before_row, before_record); - size_t const after_size= pack_row(table, cols, after_row, + size_t const after_size= pack_row(table, table->write_set, after_row, after_record); /* Ensure that all events in a GTID group are in the same cache */ @@ -6191,26 +6193,44 @@ int THD::binlog_update_row(TABLE* table, bool is_trans, #endif Rows_log_event* const ev= - binlog_prepare_pending_rows_event(table, variables.server_id, cols, colcnt, - before_size + after_size, is_trans, - static_cast<Update_rows_log_event*>(0)); + binlog_prepare_pending_rows_event(table, variables.server_id, + before_size + after_size, is_trans, + static_cast<Update_rows_log_event*>(0)); if (unlikely(ev == 0)) return HA_ERR_OUT_OF_MEM; - return - ev->add_row_data(before_row, before_size) || - ev->add_row_data(after_row, after_size); + int error= ev->add_row_data(before_row, before_size) || + ev->add_row_data(after_row, after_size); + + /* restore read/write set for the rest of execution */ + table->column_bitmaps_set_no_signal(old_read_set, + old_write_set); + + return error; + } int THD::binlog_delete_row(TABLE* table, bool is_trans, - MY_BITMAP const* cols, size_t colcnt, uchar const *record) { DBUG_ASSERT(is_current_stmt_binlog_format_row() && ((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open())); + /** + Save a reference to the original read and write set bitmaps. + We will need this to restore the bitmaps at the end. + */ + MY_BITMAP *old_read_set= table->read_set; + MY_BITMAP *old_write_set= table->write_set; - /* + /** + This will remove spurious fields required during execution but + not needed for binlogging. This is done according to the: + binlog-row-image option. + */ + binlog_prepare_row_images(table); + + /* Pack records into format for transfer. We are allocating more memory than needed, but that doesn't matter. */ @@ -6220,24 +6240,96 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans, uchar *row_data= memory.slot(0); - size_t const len= pack_row(table, cols, row_data, record); + DBUG_DUMP("table->read_set", (uchar*) table->read_set->bitmap, (table->s->fields + 7) / 8); + size_t const len= pack_row(table, table->read_set, row_data, record); /* Ensure that all events in a GTID group are in the same cache */ if (variables.option_bits & OPTION_GTID_BEGIN) is_trans= 1; Rows_log_event* const ev= - binlog_prepare_pending_rows_event(table, variables.server_id, cols, colcnt, - len, is_trans, - static_cast<Delete_rows_log_event*>(0)); + binlog_prepare_pending_rows_event(table, variables.server_id, + len, is_trans, + static_cast<Delete_rows_log_event*>(0)); if (unlikely(ev == 0)) return HA_ERR_OUT_OF_MEM; - return ev->add_row_data(row_data, len); + + int error= ev->add_row_data(row_data, len); + + /* restore read/write set for the rest of execution */ + table->column_bitmaps_set_no_signal(old_read_set, + old_write_set); + + return error; } +void THD::binlog_prepare_row_images(TABLE *table) +{ + DBUG_ENTER("THD::binlog_prepare_row_images"); + /** + Remove from read_set spurious columns. The write_set has been + handled before in table->mark_columns_needed_for_update. + */ + + DBUG_PRINT_BITSET("debug", "table->read_set (before preparing): %s", table->read_set); + THD *thd= table->in_use; + + /** + if there is a primary key in the table (ie, user declared PK or a + non-null unique index) and we dont want to ship the entire image, + and the handler involved supports this. + */ + if (table->s->primary_key < MAX_KEY && + (thd->variables.binlog_row_image < BINLOG_ROW_IMAGE_FULL) && + !ha_check_storage_engine_flag(table->s->db_type(), HTON_NO_BINLOG_ROW_OPT)) + { + /** + Just to be sure that tmp_set is currently not in use as + the read_set already. + */ + DBUG_ASSERT(table->read_set != &table->tmp_set); + + bitmap_clear_all(&table->tmp_set); + + switch(thd->variables.binlog_row_image) + { + case BINLOG_ROW_IMAGE_MINIMAL: + /* MINIMAL: Mark only PK */ + table->mark_columns_used_by_index_no_reset(table->s->primary_key, + &table->tmp_set); + break; + case BINLOG_ROW_IMAGE_NOBLOB: + /** + NOBLOB: Remove unnecessary BLOB fields from read_set + (the ones that are not part of PK). + */ + bitmap_union(&table->tmp_set, table->read_set); + for (Field **ptr=table->field ; *ptr ; ptr++) + { + Field *field= (*ptr); + if ((field->type() == MYSQL_TYPE_BLOB) && + !(field->flags & PRI_KEY_FLAG)) + bitmap_clear_bit(&table->tmp_set, field->field_index); + } + break; + default: + DBUG_ASSERT(0); // impossible. + } + + /* set the temporary read_set */ + table->column_bitmaps_set_no_signal(&table->tmp_set, + table->write_set); + } + + DBUG_PRINT_BITSET("debug", "table->read_set (after preparing): %s", table->read_set); + DBUG_VOID_RETURN; +} + + + int THD::binlog_remove_pending_rows_event(bool clear_maps, bool is_transactional) { diff --git a/sql/sql_class.h b/sql/sql_class.h index 72b3b135eac..d318061c90a 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -96,6 +96,16 @@ enum enum_mark_columns { MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE}; enum enum_filetype { FILETYPE_CSV, FILETYPE_XML }; +enum enum_binlog_row_image { + /** PKE in the before image and changed columns in the after image */ + BINLOG_ROW_IMAGE_MINIMAL= 0, + /** Whenever possible, before and after image contain all columns except blobs. */ + BINLOG_ROW_IMAGE_NOBLOB= 1, + /** All columns in both before and after image. */ + BINLOG_ROW_IMAGE_FULL= 2 +}; + + /* Bits for different SQL modes modes (including ANSI mode) */ #define MODE_REAL_AS_FLOAT (1ULL << 0) #define MODE_PIPES_AS_CONCAT (1ULL << 1) @@ -588,6 +598,7 @@ typedef struct system_variables /* Flags for slow log filtering */ ulong log_slow_rate_limit; ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format) + ulong binlog_row_image; ulong progress_report_time; ulong completion_type; ulong query_cache_type; @@ -2118,14 +2129,12 @@ public: int binlog_write_table_map(TABLE *table, bool is_transactional, my_bool *with_annotate= 0); int binlog_write_row(TABLE* table, bool is_transactional, - MY_BITMAP const* cols, size_t colcnt, const uchar *buf); int binlog_delete_row(TABLE* table, bool is_transactional, - MY_BITMAP const* cols, size_t colcnt, const uchar *buf); int binlog_update_row(TABLE* table, bool is_transactional, - MY_BITMAP const* cols, size_t colcnt, const uchar *old_data, const uchar *new_data); + static void binlog_prepare_row_images(TABLE* table); void set_server_id(uint32 sid) { variables.server_id = sid; } @@ -2134,11 +2143,9 @@ public: */ template <class RowsEventT> Rows_log_event* binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, - MY_BITMAP const* cols, - size_t colcnt, size_t needed, bool is_transactional, - RowsEventT* hint); + RowsEventT* hint); Rows_log_event* binlog_get_pending_rows_event(bool is_transactional) const; void binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional); inline int binlog_flush_pending_rows_event(bool stmt_end) diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 21959423084..41d4268748c 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -23,6 +23,7 @@ #include "sql_select.h" #include "my_json_writer.h" #include "opt_range.h" +#include "sql_expression_cache.h" const char * STR_DELETING_ALL_ROWS= "Deleting all rows"; const char * STR_IMPOSSIBLE_WHERE= "Impossible WHERE"; @@ -520,6 +521,8 @@ void Explain_union::print_explain_json(Explain_query *query, Json_writer_nesting_guard guard(writer); char table_name_buffer[SAFE_NAME_LEN]; + bool started_object= print_explain_json_cache(writer, is_analyze); + writer->add_member("query_block").start_object(); writer->add_member("union_result").start_object(); // using_temporary_table @@ -560,6 +563,9 @@ void Explain_union::print_explain_json(Explain_query *query, writer->end_object(); // union_result writer->end_object(); // query_block + + if (started_object) + writer->end_object(); } @@ -640,6 +646,35 @@ void Explain_node::print_explain_json_for_children(Explain_query *query, } +bool Explain_node::print_explain_json_cache(Json_writer *writer, + bool is_analyze) +{ + if (cache_tracker) + { + cache_tracker->fetch_current_stats(); + writer->add_member("expression_cache").start_object(); + if (cache_tracker->state != Expression_cache_tracker::OK) + { + writer->add_member("state"). + add_str(Expression_cache_tracker::state_str[cache_tracker->state]); + } + + if (is_analyze) + { + longlong cache_reads= cache_tracker->hit + cache_tracker->miss; + writer->add_member("r_loops").add_ll(cache_reads); + if (cache_reads != 0) + { + double hit_ratio= double(cache_tracker->hit) / cache_reads * 100.0; + writer->add_member("r_hit_ratio").add_double(hit_ratio); + } + } + return true; + } + return false; +} + + void Explain_select::replace_table(uint idx, Explain_table_access *new_tab) { delete join_tabs[idx]; @@ -691,8 +726,36 @@ int Explain_select::print_explain(Explain_query *query, } else { - bool using_tmp= using_temporary; - bool using_fs= using_filesort; + bool using_tmp; + bool using_fs; + + if (is_analyze) + { + /* + Get the data about "Using temporary; Using filesort" from execution + tracking system. + */ + using_tmp= false; + using_fs= false; + Sort_and_group_tracker::Iterator iter(&ops_tracker); + enum_qep_action action; + Filesort_tracker *dummy; + + while ((action= iter.get_next(&dummy)) != EXPL_ACTION_EOF) + { + if (action == EXPL_ACTION_FILESORT) + using_fs= true; + else if (action == EXPL_ACTION_TEMPTABLE) + using_tmp= true; + } + } + else + { + /* Use imprecise "estimates" we got with the query plan */ + using_tmp= using_temporary; + using_fs= using_filesort; + } + for (uint i=0; i< n_join_tabs; i++) { join_tabs[i]->print_explain(output, explain_flags, is_analyze, select_id, @@ -740,6 +803,8 @@ void Explain_select::print_explain_json(Explain_query *query, Json_writer *writer, bool is_analyze) { Json_writer_nesting_guard guard(writer); + + bool started_cache= print_explain_json_cache(writer, is_analyze); if (message) { @@ -757,12 +822,13 @@ void Explain_select::print_explain_json(Explain_query *query, { writer->add_member("query_block").start_object(); writer->add_member("select_id").add_ll(select_id); - + if (is_analyze && time_tracker.get_loops()) { writer->add_member("r_loops").add_ll(time_tracker.get_loops()); writer->add_member("r_total_time_ms").add_double(time_tracker.get_time_ms()); } + if (exec_const_cond) { writer->add_member("const_condition"); @@ -859,6 +925,8 @@ void Explain_select::print_explain_json(Explain_query *query, writer->end_object(); } + if (started_cache) + writer->end_object(); } diff --git a/sql/sql_explain.h b/sql/sql_explain.h index dd2b5783b41..1b6a1be5649 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -84,9 +84,10 @@ class Explain_query; class Explain_node : public Sql_alloc { public: - Explain_node(MEM_ROOT *root) : - connection_type(EXPLAIN_NODE_OTHER), - children(root) + Explain_node(MEM_ROOT *root) : + cache_tracker(NULL), + connection_type(EXPLAIN_NODE_OTHER), + children(root) {} /* A type specifying what kind of node this is */ enum explain_node_type @@ -106,10 +107,14 @@ public: EXPLAIN_NODE_NON_MERGED_SJ /* aka JTBM semi-join */ }; - virtual enum explain_node_type get_type()= 0; virtual int get_select_id()= 0; + /** + expression cache statistics + */ + Expression_cache_tracker* cache_tracker; + /* How this node is connected to its parent. (NOTE: EXPLAIN_NODE_NON_MERGED_SJ is set very late currently) @@ -135,6 +140,7 @@ public: uint8 explain_flags, bool is_analyze); void print_explain_json_for_children(Explain_query *query, Json_writer *writer, bool is_analyze); + bool print_explain_json_cache(Json_writer *writer, bool is_analyze); virtual ~Explain_node(){} }; @@ -221,7 +227,7 @@ public: members have no info */ const char *message; - + /* Expensive constant condition */ Item *exec_const_cond; diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc index 824d21eea20..cc922c3bcfe 100644 --- a/sql/sql_expression_cache.cc +++ b/sql/sql_expression_cache.cc @@ -43,7 +43,7 @@ ulong subquery_cache_miss, subquery_cache_hit; Expression_cache_tmptable::Expression_cache_tmptable(THD *thd, List<Item> &dependants, Item *value) - :cache_table(NULL), table_thd(thd), items(dependants), val(value), + :cache_table(NULL), table_thd(thd), tracker(NULL), items(dependants), val(value), hit(0), miss(0), inited (0) { DBUG_ENTER("Expression_cache_tmptable::Expression_cache_tmptable"); @@ -61,6 +61,9 @@ void Expression_cache_tmptable::disable_cache() cache_table->file->ha_index_end(); free_tmp_table(table_thd, cache_table); cache_table= NULL; + update_tracker(); + if (tracker) + tracker->cache= NULL; } @@ -164,6 +167,7 @@ void Expression_cache_tmptable::init() goto error; } + update_tracker(); DBUG_VOID_RETURN; error: @@ -180,6 +184,11 @@ Expression_cache_tmptable::~Expression_cache_tmptable() if (cache_table) disable_cache(); + else + { + update_tracker(); + tracker= NULL; + } } @@ -323,3 +332,7 @@ void Expression_cache_tmptable::print(String *str, enum_query_type query_type) } str->append('>'); } + + +const char *Expression_cache_tracker::state_str[3]= +{"uninitialized", "disabled", "enabled"}; diff --git a/sql/sql_expression_cache.h b/sql/sql_expression_cache.h index 48a8e33a787..87be6ddb4f4 100644 --- a/sql/sql_expression_cache.h +++ b/sql/sql_expression_cache.h @@ -19,6 +19,7 @@ #include "sql_select.h" + /** Interface for expression cache @@ -62,6 +63,11 @@ public: Initialize this cache */ virtual void init()= 0; + + /** + Save this object's statistics into Expression_cache_tracker object + */ + virtual void update_tracker()= 0; }; struct st_table_ref; @@ -69,6 +75,30 @@ struct st_join_table; class Item_field; +class Expression_cache_tracker :public Sql_alloc +{ +public: + enum expr_cache_state {UNINITED, STOPPED, OK}; + Expression_cache_tracker(Expression_cache *c) : + cache(c), hit(0), miss(0), state(UNINITED) + {} + + Expression_cache *cache; + ulong hit, miss; + enum expr_cache_state state; + + static const char* state_str[3]; + void set(ulong h, ulong m, enum expr_cache_state s) + {hit= h; miss= m; state= s;} + + void fetch_current_stats() + { + if (cache) + cache->update_tracker(); + } +}; + + /** Implementation of expression cache over a temporary table */ @@ -85,6 +115,22 @@ public: bool is_inited() { return inited; }; void init(); + void set_tracker(Expression_cache_tracker *st) + { + tracker= st; + update_tracker(); + } + virtual void update_tracker() + { + if (tracker) + { + tracker->set(hit, miss, (inited ? (cache_table ? + Expression_cache_tracker::OK : + Expression_cache_tracker::STOPPED) : + Expression_cache_tracker::UNINITED)); + } + } + private: void disable_cache(); @@ -94,6 +140,8 @@ private: TABLE *cache_table; /* Thread handle for the temporary table */ THD *table_thd; + /* EXPALIN/ANALYZE statistics */ + Expression_cache_tracker *tracker; /* TABLE_REF for index lookup */ struct st_table_ref ref; /* Cached result */ @@ -103,7 +151,7 @@ private: /* Value Item example */ Item *val; /* hit/miss counters */ - uint hit, miss; + ulong hit, miss; /* Set on if the object has been succesfully initialized with init() */ bool inited; }; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index ac2eda2d0de..6c835c4293f 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3505,6 +3505,8 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only) bool empty_union_result= true; bool is_correlated_unit= false; + bool first= true; + bool union_plan_saved= false; /* If the subquery is a UNION, optimize all the subqueries in the UNION. If there is no UNION, then the loop will execute once for the subquery. @@ -3512,6 +3514,17 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only) for (SELECT_LEX *sl= un->first_select(); sl; sl= sl->next_select()) { JOIN *inner_join= sl->join; + if (first) + first= false; + else + { + if (!union_plan_saved) + { + union_plan_saved= true; + if (un->save_union_explain(un->thd->lex->explain)) + return true; /* Failure */ + } + } if (!inner_join) continue; SELECT_LEX *save_select= un->thd->lex->current_select; @@ -4365,10 +4378,15 @@ void LEX::restore_set_statement_var() int st_select_lex_unit::save_union_explain(Explain_query *output) { SELECT_LEX *first= first_select(); + + if (output->get_union(first->select_number)) + return 0; /* Already added */ + Explain_union *eu= new (output->mem_root) Explain_union(output->mem_root, thd->lex->analyze_stmt); + if (derived) eu->connection_type= Explain_node::EXPLAIN_NODE_DERIVED; /* diff --git a/sql/sql_select.cc b/sql/sql_select.cc index abd9d3123f5..026377d7b46 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4764,12 +4764,25 @@ Item_func_ne::add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, SARGABLE_PARAM **sargables) { - if (is_local_field(args[0]) && !(used_tables() & OUTER_REF_TABLE_BIT)) + if (!(used_tables() & OUTER_REF_TABLE_BIT)) { - Item **values= is_local_field(args[1]) ? args : args + 1; - add_key_equal_fields(join, key_fields, *and_level, this, - (Item_field*) (args[0]->real_item()), false, - values, 1, usable_tables, sargables); + /* + QQ: perhaps test for !is_local_field(args[1]) is not really needed here. + Other comparison functions, e.g. Item_func_le, Item_func_gt, etc, + do not have this test. See Item_bool_func2::add_key_field_optimize_op(). + Check with the optimizer team. + */ + if (is_local_field(args[0]) && !is_local_field(args[1])) + add_key_equal_fields(join, key_fields, *and_level, this, + (Item_field*) (args[0]->real_item()), false, + &args[1], 1, usable_tables, sargables); + /* + QQ: perhaps test for !is_local_field(args[0]) is not really needed here. + */ + if (is_local_field(args[1]) && !is_local_field(args[0])) + add_key_equal_fields(join, key_fields, *and_level, this, + (Item_field*) (args[1]->real_item()), false, + &args[0], 1, usable_tables, sargables); } } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 8188f73a680..eda8e2daf96 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -8619,7 +8619,7 @@ ST_FIELD_INFO variables_fields_info[]= { {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name", SKIP_OPEN_TABLE}, - {"VARIABLE_VALUE", 1024, MYSQL_TYPE_STRING, 0, 0, "Value", SKIP_OPEN_TABLE}, + {"VARIABLE_VALUE", 2048, MYSQL_TYPE_STRING, 0, 0, "Value", SKIP_OPEN_TABLE}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} }; @@ -8627,10 +8627,10 @@ ST_FIELD_INFO variables_fields_info[]= ST_FIELD_INFO sysvars_fields_info[]= { {"VARIABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"SESSION_VALUE", 1024, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, - {"GLOBAL_VALUE", 1024, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, + {"SESSION_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, + {"GLOBAL_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, {"GLOBAL_VALUE_ORIGIN", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, - {"DEFAULT_VALUE", 1024, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, + {"DEFAULT_VALUE", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, 0}, {"VARIABLE_SCOPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, {"VARIABLE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, {"VARIABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, 0, 0}, diff --git a/sql/sql_time.h b/sql/sql_time.h index dc8e4668e1e..8e13ee1870a 100644 --- a/sql/sql_time.h +++ b/sql/sql_time.h @@ -143,13 +143,24 @@ extern DATE_TIME_FORMAT global_time_format; extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[]; extern LEX_STRING interval_type_to_name[]; - static inline bool -non_zero_date(const MYSQL_TIME *ltime) +non_zero_hhmmssuu(const MYSQL_TIME *ltime) +{ + return ltime->hour || ltime->minute || ltime->second || ltime->second_part; +} +static inline bool +non_zero_YYMMDD(const MYSQL_TIME *ltime) { return ltime->year || ltime->month || ltime->day; } static inline bool +non_zero_date(const MYSQL_TIME *ltime) +{ + return non_zero_YYMMDD(ltime) || + (ltime->time_type == MYSQL_TIMESTAMP_DATETIME && + non_zero_hhmmssuu(ltime)); +} +static inline bool check_date(const MYSQL_TIME *ltime, ulonglong flags, int *was_cut) { return check_date(ltime, non_zero_date(ltime), flags, was_cut); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index adbf3532925..cda8b5cc327 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5213,6 +5213,22 @@ static Sys_var_mybool Sys_encrypt_tmp_files( READ_ONLY GLOBAL_VAR(encrypt_tmp_files), CMD_LINE(OPT_ARG), DEFAULT(TRUE)); +static const char *binlog_row_image_names[]= {"MINIMAL", "NOBLOB", "FULL", NullS}; +static Sys_var_enum Sys_binlog_row_image( + "binlog_row_image", + "Controls whether rows should be logged in 'FULL', 'NOBLOB' or " + "'MINIMAL' formats. 'FULL', means that all columns in the before " + "and after image are logged. 'NOBLOB', means that mysqld avoids logging " + "blob columns whenever possible (eg, blob column was not changed or " + "is not part of primary key). 'MINIMAL', means that a PK equivalent (PK " + "columns or full row if there is no PK in the table) is logged in the " + "before image, and only changed columns are logged in the after image. " + "(Default: FULL).", + SESSION_VAR(binlog_row_image), CMD_LINE(REQUIRED_ARG), + binlog_row_image_names, DEFAULT(BINLOG_ROW_IMAGE_FULL), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL), + ON_UPDATE(NULL)); + static bool check_pseudo_slave_mode(sys_var *self, THD *thd, set_var *var) { longlong previous_val= thd->variables.pseudo_slave_mode; diff --git a/sql/table.cc b/sql/table.cc index 5b31ea0de3e..7a56be14731 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -5829,6 +5829,8 @@ void TABLE::mark_auto_increment_column() void TABLE::mark_columns_needed_for_delete() { + mark_columns_per_binlog_row_image(); + if (triggers) triggers->mark_fields_used(TRG_EVENT_DELETE); if (file->ha_table_flags() & HA_REQUIRES_KEY_COLUMNS_FOR_DELETE) @@ -5880,6 +5882,9 @@ void TABLE::mark_columns_needed_for_delete() void TABLE::mark_columns_needed_for_update() { DBUG_ENTER("mark_columns_needed_for_update"); + + mark_columns_per_binlog_row_image(); + if (triggers) triggers->mark_fields_used(TRG_EVENT_UPDATE); if (file->ha_table_flags() & HA_REQUIRES_KEY_COLUMNS_FOR_DELETE) @@ -5924,6 +5929,8 @@ void TABLE::mark_columns_needed_for_update() void TABLE::mark_columns_needed_for_insert() { + mark_columns_per_binlog_row_image(); + if (triggers) { /* @@ -5941,6 +5948,101 @@ void TABLE::mark_columns_needed_for_insert() mark_virtual_columns_for_write(TRUE); } +/* + Mark columns according the binlog row image option. + + When logging in RBR, the user can select whether to + log partial or full rows, depending on the table + definition, and the value of binlog_row_image. + + Semantics of the binlog_row_image are the following + (PKE - primary key equivalent, ie, PK fields if PK + exists, all fields otherwise): + + binlog_row_image= MINIMAL + - This marks the PKE fields in the read_set + - This marks all fields where a value was specified + in the write_set + + binlog_row_image= NOBLOB + - This marks PKE + all non-blob fields in the read_set + - This marks all fields where a value was specified + and all non-blob fields in the write_set + + binlog_row_image= FULL + - all columns in the read_set + - all columns in the write_set + + This marking is done without resetting the original + bitmaps. This means that we will strip extra fields in + the read_set at binlogging time (for those cases that + we only want to log a PK and we needed other fields for + execution). +*/ +void TABLE::mark_columns_per_binlog_row_image() +{ + DBUG_ENTER("mark_columns_per_binlog_row_image"); + DBUG_ASSERT(read_set->bitmap); + DBUG_ASSERT(write_set->bitmap); + + /** + If in RBR we may need to mark some extra columns, + depending on the binlog-row-image command line argument. + */ + if ((mysql_bin_log.is_open() && in_use && + in_use->is_current_stmt_binlog_format_row() && + !ha_check_storage_engine_flag(s->db_type(), HTON_NO_BINLOG_ROW_OPT))) + { + + THD *thd= current_thd; + + /* if there is no PK, then mark all columns for the BI. */ + if (s->primary_key >= MAX_KEY) + bitmap_set_all(read_set); + + switch (thd->variables.binlog_row_image) + { + case BINLOG_ROW_IMAGE_FULL: + if (s->primary_key < MAX_KEY) + bitmap_set_all(read_set); + bitmap_set_all(write_set); + break; + case BINLOG_ROW_IMAGE_NOBLOB: + /* for every field that is not set, mark it unless it is a blob */ + for (Field **ptr=field ; *ptr ; ptr++) + { + Field *my_field= *ptr; + /* + bypass blob fields. These can be set or not set, we don't care. + Later, at binlogging time, if we don't need them in the before + image, we will discard them. + + If set in the AI, then the blob is really needed, there is + nothing we can do about it. + */ + if ((s->primary_key < MAX_KEY) && + ((my_field->flags & PRI_KEY_FLAG) || + (my_field->type() != MYSQL_TYPE_BLOB))) + bitmap_set_bit(read_set, my_field->field_index); + + if (my_field->type() != MYSQL_TYPE_BLOB) + bitmap_set_bit(write_set, my_field->field_index); + } + break; + case BINLOG_ROW_IMAGE_MINIMAL: + /* mark the primary key if available in the read_set */ + if (s->primary_key < MAX_KEY) + mark_columns_used_by_index_no_reset(s->primary_key, read_set); + break; + + default: + DBUG_ASSERT(FALSE); + } + file->column_bitmaps_signal(); + } + + DBUG_VOID_RETURN; +} /* @brief Mark a column as virtual used by the query diff --git a/sql/table.h b/sql/table.h index c0501b58fc3..b150e4f2238 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1275,6 +1275,7 @@ public: void mark_columns_needed_for_update(void); void mark_columns_needed_for_delete(void); void mark_columns_needed_for_insert(void); + void mark_columns_per_binlog_row_image(void); bool mark_virtual_col(Field *field); void mark_virtual_columns_for_write(bool insert_fl); void mark_default_fields_for_write(); diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index a6c2bafef13..6da8bbc2b74 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -552,33 +552,34 @@ int wsrep_show_status (THD *thd, SHOW_VAR *var, char *buff, *v++= wsrep_status_vars[i]; DBUG_ASSERT(i < maxi); - DBUG_ASSERT(wsrep != NULL); - wsrep_stats_var* stats= wsrep->stats_get(wsrep); - for (wsrep_stats_var *sv= stats; i < maxi && sv && sv->name; i++, sv++, v++) - { - v->name = thd->strdup(sv->name); - switch (sv->type) { - case WSREP_VAR_INT64: - v->value = (char*)thd->memdup(&sv->value._int64, sizeof(longlong)); - v->type = SHOW_LONGLONG; - break; - case WSREP_VAR_STRING: - v->value = thd->strdup(sv->value._string); - v->type = SHOW_CHAR; - break; - case WSREP_VAR_DOUBLE: - v->value = (char*)thd->memdup(&sv->value._double, sizeof(double)); - v->type = SHOW_DOUBLE; - break; + if (wsrep != NULL) { + wsrep_stats_var* stats= wsrep->stats_get(wsrep); + for (wsrep_stats_var *sv= stats; i < maxi && sv && sv->name; i++, sv++, v++) + { + v->name = thd->strdup(sv->name); + switch (sv->type) { + case WSREP_VAR_INT64: + v->value = (char*)thd->memdup(&sv->value._int64, sizeof(longlong)); + v->type = SHOW_LONGLONG; + break; + case WSREP_VAR_STRING: + v->value = thd->strdup(sv->value._string); + v->type = SHOW_CHAR; + break; + case WSREP_VAR_DOUBLE: + v->value = (char*)thd->memdup(&sv->value._double, sizeof(double)); + v->type = SHOW_DOUBLE; + break; + } + DBUG_ASSERT(i < maxi); } - DBUG_ASSERT(i < maxi); + wsrep->stats_free(wsrep, stats); } - wsrep->stats_free(wsrep, stats); my_qsort(buff, i, sizeof(*v), show_var_cmp); - v->name= 0; // terminator + v->name= 0; // terminator return 0; } diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 324c78e9c7c..d5b942a652b 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -2049,7 +2049,7 @@ fil_crypt_complete_rotate_space( fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space); /* Space might already be dropped */ - if (crypt_data || !crypt_data->inited) { + if (crypt_data != NULL && crypt_data->inited) { mutex_enter(&crypt_data->mutex); /** diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index e508d4733db..ff8541a40a5 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -355,12 +355,16 @@ fil_compress_page( write_size+=header_len; + if (block_size <= 0) { + block_size = 512; + } + + ut_ad(write_size > 0 && block_size > 0); + /* Actual write needs to be alligned on block size */ if (write_size % block_size) { size_t tmp = write_size; -#ifdef UNIV_DEBUG - ut_a(block_size > 0); -#endif + write_size = (size_t)ut_uint64_align_up((ib_uint64_t)write_size, block_size); #ifdef UNIV_DEBUG ut_a(write_size > 0 && ((write_size % block_size) == 0)); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b9b8ecd4916..a01fd8e59ce 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -11398,12 +11398,12 @@ ha_innobase::check_table_options( if (encrypt == FIL_SPACE_ENCRYPTION_ON || (encrypt == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) { - if (!encryption_key_id_exists(options->encryption_key_id)) { + if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) { push_warning_printf( thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, - "InnoDB: ENCRYPTION_KEY_ID %lu not available", - options->encryption_key_id + "InnoDB: ENCRYPTION_KEY_ID %u not available", + (uint)options->encryption_key_id ); return "ENCRYPTION_KEY_ID"; } @@ -11469,7 +11469,7 @@ ha_innobase::create( /* Cache table options */ ha_table_option_struct *options= form->s->option_struct; fil_encryption_t encrypt = (fil_encryption_t)options->encryption; - ulint key_id = options->encryption_key_id; + uint key_id = (uint)options->encryption_key_id; DBUG_ENTER("ha_innobase::create"); @@ -17897,7 +17897,7 @@ innodb_encrypt_tables_update( const void* save) /*!< in: immediate result from check function */ { - fil_crypt_set_encrypt_tables(*static_cast<const uint*>(save)); + fil_crypt_set_encrypt_tables(*static_cast<const ulong*>(save)); } static SHOW_VAR innodb_status_variables_export[]= { @@ -20140,7 +20140,7 @@ innodb_encrypt_tables_validate( if (check_sysvar_enum(thd, var, save, value)) return 1; - long encrypt_tables = *(long*)save; + ulong encrypt_tables = *(ulong*)save; if (encrypt_tables && !encryption_key_id_exists(FIL_DEFAULT_ENCRYPTION_KEY)) { diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index b613053a992..4f4a0b2f999 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -60,18 +60,18 @@ struct row_prebuilt_t; /** Engine specific table options are defined using this struct */ struct ha_table_option_struct { - bool page_compressed; /*!< Table is using page compression - if this option is true. */ - int page_compression_level; /*!< Table page compression level - or UNIV_UNSPECIFIED. */ - uint atomic_writes; /*!< Use atomic writes for this - table if this options is ON or - in DEFAULT if - srv_use_atomic_writes=1. - Atomic writes are not used if - value OFF.*/ - uint encryption; /*!< DEFAULT, ON, OFF */ - int encryption_key_id; /*!< encryption key id*/ + bool page_compressed; /*!< Table is using page compression + if this option is true. */ + ulonglong page_compression_level; /*!< Table page compression level + 0-9. */ + uint atomic_writes; /*!< Use atomic writes for this + table if this options is ON or + in DEFAULT if + srv_use_atomic_writes=1. + Atomic writes are not used if + value OFF.*/ + uint encryption; /*!< DEFAULT, ON, OFF */ + ulonglong encryption_key_id; /*!< encryption key id */ }; diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index 8ca052af4ac..8b48119390a 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -394,7 +394,7 @@ struct st_myisam_info #define PACK_TYPE_SELECTED 1 /* Bits in field->pack_type */ #define PACK_TYPE_SPACE_FIELDS 2 #define PACK_TYPE_ZERO_FILL 4 -#define MI_FOUND_WRONG_KEY 32738 /* Impossible value from ha_key_cmp */ +#define MI_FOUND_WRONG_KEY 0x7FFFFFFF /* Impossible value from ha_key_cmp */ #define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_MIN_KEY_BLOCK_LENGTH) #define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer,block_size) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/(block_size)+1)*(block_size)) diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index 98a6d0dbf29..a60e55f3de6 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -2049,7 +2049,7 @@ fil_crypt_complete_rotate_space( fil_space_crypt_t *crypt_data = fil_space_get_crypt_data(space); /* Space might already be dropped */ - if (crypt_data || !crypt_data->inited) { + if (crypt_data != NULL && crypt_data->inited) { mutex_enter(&crypt_data->mutex); /** diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc index e508d4733db..ff8541a40a5 100644 --- a/storage/xtradb/fil/fil0pagecompress.cc +++ b/storage/xtradb/fil/fil0pagecompress.cc @@ -355,12 +355,16 @@ fil_compress_page( write_size+=header_len; + if (block_size <= 0) { + block_size = 512; + } + + ut_ad(write_size > 0 && block_size > 0); + /* Actual write needs to be alligned on block size */ if (write_size % block_size) { size_t tmp = write_size; -#ifdef UNIV_DEBUG - ut_a(block_size > 0); -#endif + write_size = (size_t)ut_uint64_align_up((ib_uint64_t)write_size, block_size); #ifdef UNIV_DEBUG ut_a(write_size > 0 && ((write_size % block_size) == 0)); diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 8ec276dcbc3..b9674f75684 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -11915,12 +11915,12 @@ ha_innobase::check_table_options( if (encrypt == FIL_SPACE_ENCRYPTION_ON || (encrypt == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) { - if (!encryption_key_id_exists(options->encryption_key_id)) { + if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) { push_warning_printf( thd, Sql_condition::WARN_LEVEL_WARN, HA_WRONG_CREATE_OPTION, - "InnoDB: ENCRYPTION_KEY_ID %lu not available", - options->encryption_key_id + "InnoDB: ENCRYPTION_KEY_ID %u not available", + (uint)options->encryption_key_id ); return "ENCRYPTION_KEY_ID"; @@ -11987,7 +11987,7 @@ ha_innobase::create( /* Cache table options */ ha_table_option_struct *options= form->s->option_struct; fil_encryption_t encrypt = (fil_encryption_t)options->encryption; - ulint key_id = options->encryption_key_id; + uint key_id = (uint)options->encryption_key_id; DBUG_ENTER("ha_innobase::create"); @@ -18823,7 +18823,7 @@ innodb_encrypt_tables_update( const void* save) /*!< in: immediate result from check function */ { - fil_crypt_set_encrypt_tables(*static_cast<const uint*>(save)); + fil_crypt_set_encrypt_tables(*static_cast<const ulong*>(save)); } static SHOW_VAR innodb_status_variables_export[]= { @@ -21370,7 +21370,7 @@ innodb_encrypt_tables_validate( if (check_sysvar_enum(thd, var, save, value)) return 1; - long encrypt_tables = *(long*)save; + ulong encrypt_tables = *(ulong*)save; if (encrypt_tables && !encryption_key_id_exists(FIL_DEFAULT_ENCRYPTION_KEY)) { diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h index aadd2fc5bb8..2027a593140 100644 --- a/storage/xtradb/handler/ha_innodb.h +++ b/storage/xtradb/handler/ha_innodb.h @@ -61,18 +61,18 @@ struct row_prebuilt_t; /** Engine specific table options are defined using this struct */ struct ha_table_option_struct { - bool page_compressed; /*!< Table is using page compression - if this option is true. */ - int page_compression_level; /*!< Table page compression level - or UNIV_UNSPECIFIED. */ - uint atomic_writes; /*!< Use atomic writes for this - table if this options is ON or - in DEFAULT if - srv_use_atomic_writes=1. - Atomic writes are not used if - value OFF.*/ - uint encryption; /*!< DEFAULT, ON, OFF */ - int encryption_key_id; /*!< encryption key id */ + bool page_compressed; /*!< Table is using page compression + if this option is true. */ + ulonglong page_compression_level; /*!< Table page compression level + 0-9. */ + uint atomic_writes; /*!< Use atomic writes for this + table if this options is ON or + in DEFAULT if + srv_use_atomic_writes=1. + Atomic writes are not used if + value OFF.*/ + uint encryption; /*!< DEFAULT, ON, OFF */ + ulonglong encryption_key_id; /*!< encryption key id */ }; /** The class defining a handle to an Innodb table */ diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index 827feda927b..d331f643079 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -194,6 +194,7 @@ static const uchar sort_order_eucjpms[]= #define MY_FUNCTION_NAME(x) my_ ## x ## _eucjpms +#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80) #define IS_MB2_JIS(x,y) (iseucjpms(x) && iseucjpms(y)) #define IS_MB2_KATA(x,y) (iseucjpms_ss2(x) && iskata(y)) #define IS_MB2_CHAR(x,y) (IS_MB2_KATA(x,y) || IS_MB2_JIS(x,y)) @@ -201,6 +202,23 @@ static const uchar sort_order_eucjpms[]= #define DEFINE_ASIAN_ROUTINES #include "ctype-mb.ic" +#define MY_FUNCTION_NAME(x) my_ ## x ## _eucjpms_japanese_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) ((int) sort_order_eucjpms[(uchar) (x)]) +#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \ + (((uint) (uchar) (y)) << 8)) +#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z)) +#include "strcoll.ic" + + +#define MY_FUNCTION_NAME(x) my_ ## x ## _eucjpms_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) ((int) (uchar) (x)) +#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \ + (((uint) (uchar) (y)) << 8)) +#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z)) +#include "strcoll.ic" + static uint ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) @@ -67467,11 +67485,11 @@ size_t my_numcells_eucjpms(CHARSET_INFO *cs __attribute__((unused)), } -static MY_COLLATION_HANDLER my_collation_ci_handler = +static MY_COLLATION_HANDLER my_collation_eucjpms_japanese_ci_handler = { NULL, /* init */ - my_strnncoll_simple,/* strnncoll */ - my_strnncollsp_simple, + my_strnncoll_eucjpms_japanese_ci, + my_strnncollsp_eucjpms_japanese_ci, my_strnxfrm_mb, /* strnxfrm */ my_strnxfrmlen_simple, my_like_range_mb, /* like_range */ @@ -67482,6 +67500,23 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = my_propagate_simple }; + +static MY_COLLATION_HANDLER my_collation_eucjpms_bin_handler = +{ + NULL, /* init */ + my_strnncoll_eucjpms_bin, + my_strnncollsp_eucjpms_bin, + my_strnxfrm_mb, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_bin, + my_propagate_simple +}; + + static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ @@ -67547,7 +67582,7 @@ struct charset_info_st my_charset_eucjpms_japanese_ci= 0, /* escape_with_backslash_is_dangerous */ 1, /* levels_for_order */ &my_charset_handler, - &my_collation_ci_handler + &my_collation_eucjpms_japanese_ci_handler }; @@ -67580,7 +67615,7 @@ struct charset_info_st my_charset_eucjpms_bin= 0, /* escape_with_backslash_is_dangerous */ 1, /* levels_for_order */ &my_charset_handler, - &my_collation_mb_bin_handler + &my_collation_eucjpms_bin_handler }; diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 5947c3d4f4a..a7f9e144fe8 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -1560,20 +1560,4 @@ int my_mb_ctype_mb(CHARSET_INFO *cs, int *ctype, } -MY_COLLATION_HANDLER my_collation_mb_bin_handler = -{ - NULL, /* init */ - my_strnncoll_mb_bin, - my_strnncollsp_mb_bin, - my_strnxfrm_mb, - my_strnxfrmlen_simple, - my_like_range_mb, - my_wildcmp_mb_bin, - my_strcasecmp_mb_bin, - my_instr_mb, - my_hash_sort_mb_bin, - my_propagate_simple -}; - - #endif diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index d1441a4d3a5..02adc1492c4 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1186,11 +1186,14 @@ my_lengthsp_mb2(CHARSET_INFO *cs __attribute__((unused)), #define MY_UTF16_SURROGATE_LOW_FIRST 0xDC00 #define MY_UTF16_SURROGATE_LOW_LAST 0xDFFF -#define MY_UTF16_HIGH_HEAD(x) ((((uchar) (x)) & 0xFC) == 0xD8) -#define MY_UTF16_LOW_HEAD(x) ((((uchar) (x)) & 0xFC) == 0xDC) -#define MY_UTF16_SURROGATE(x) (((x) & 0xF800) == 0xD800) +#define MY_UTF16_HIGH_HEAD(x) ((((uchar) (x)) & 0xFC) == 0xD8) +#define MY_UTF16_LOW_HEAD(x) ((((uchar) (x)) & 0xFC) == 0xDC) +/* Test if a byte is a leading byte of a high or low surrogate head: */ +#define MY_UTF16_SURROGATE_HEAD(x) ((((uchar) (x)) & 0xF8) == 0xD8) +/* Test if a Unicode code point is a high or low surrogate head */ +#define MY_UTF16_SURROGATE(x) (((x) & 0xF800) == 0xD800) -#define MY_UTF16_WC2(a, b) ((a << 8) + b) +#define MY_UTF16_WC2(a, b) ((a << 8) + b) /* a= 110110?? (<< 18) @@ -1201,6 +1204,30 @@ my_lengthsp_mb2(CHARSET_INFO *cs __attribute__((unused)), #define MY_UTF16_WC4(a, b, c, d) (((a & 3) << 18) + (b << 10) + \ ((c & 3) << 8) + d + 0x10000) +#define IS_MB2_CHAR(b0,b1) (!MY_UTF16_SURROGATE_HEAD(b0)) +#define IS_MB4_CHAR(b0,b1,b2,b3) (MY_UTF16_HIGH_HEAD(b0) && MY_UTF16_LOW_HEAD(b2)) + +static inline int my_weight_mb2_utf16mb2_general_ci(uchar b0, uchar b1) +{ + my_wc_t wc= MY_UTF16_WC2(b0, b1); + MY_UNICASE_CHARACTER *page= my_unicase_default.page[wc >> 8]; + return (int) (page ? page[wc & 0xFF].sort : wc); +} +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16_general_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf16mb2_general_ci(b0,b1) +#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER +#include "strcoll.ic" + +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) ((int) MY_UTF16_WC2(b0, b1)) +#define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF16_WC4(b0, b1, b2, b3)) +#include "strcoll.ic" + +#undef IS_MB2_CHAR +#undef IS_MB4_CHAR + static int my_utf16_uni(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *pwc, const uchar *s, const uchar *e) @@ -1371,146 +1398,6 @@ my_casedn_utf16(CHARSET_INFO *cs, char *src, size_t srclen, } -static int -my_strnncoll_utf16(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool t_is_prefix) -{ - int s_res, t_res; - my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); - my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc; - const uchar *se= s + slen; - const uchar *te= t + tlen; - MY_UNICASE_INFO *uni_plane= cs->caseinfo; - - while (s < se && t < te) - { - s_res= mb_wc(cs, &s_wc, s, se); - t_res= mb_wc(cs, &t_wc, t, te); - - if (s_res <= 0 || t_res <= 0) - { - /* Incorrect string, compare by char value */ - return my_bincmp(s, se, t, te); - } - - my_tosort_utf16(uni_plane, &s_wc); - my_tosort_utf16(uni_plane, &t_wc); - - if (s_wc != t_wc) - { - return s_wc > t_wc ? 1 : -1; - } - - s+= s_res; - t+= t_res; - } - return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t))); -} - - -/** - Compare strings, discarding end space - - If one string is shorter as the other, then we space extend the other - so that the strings have equal length. - - This will ensure that the following things hold: - - "a" == "a " - "a\0" < "a" - "a\0" < "a " - - @param cs Character set pinter. - @param a First string to compare. - @param a_length Length of 'a'. - @param b Second string to compare. - @param b_length Length of 'b'. - - IMPLEMENTATION - - @return Comparison result. - @retval Negative number, if a less than b. - @retval 0, if a is equal to b - @retval Positive number, if a > b -*/ - -static int -my_strnncollsp_utf16(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool diff_if_only_endspace_difference) -{ - int res; - my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); - my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc; - const uchar *se= s + slen, *te= t + tlen; - MY_UNICASE_INFO *uni_plane= cs->caseinfo; - - DBUG_ASSERT((slen % 2) == 0); - DBUG_ASSERT((tlen % 2) == 0); - -#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE - diff_if_only_endspace_difference= FALSE; -#endif - - while (s < se && t < te) - { - int s_res= mb_wc(cs, &s_wc, s, se); - int t_res= mb_wc(cs, &t_wc, t, te); - - if (s_res <= 0 || t_res <= 0) - { - /* Incorrect string, compare bytewise */ - return my_bincmp(s, se, t, te); - } - - my_tosort_utf16(uni_plane, &s_wc); - my_tosort_utf16(uni_plane, &t_wc); - - if (s_wc != t_wc) - { - return s_wc > t_wc ? 1 : -1; - } - - s+= s_res; - t+= t_res; - } - - slen= (size_t) (se - s); - tlen= (size_t) (te - t); - res= 0; - - if (slen != tlen) - { - int s_res, swap= 1; - if (diff_if_only_endspace_difference) - res= 1; /* Assume 's' is bigger */ - if (slen < tlen) - { - slen= tlen; - s= t; - se= te; - swap= -1; - res= -res; - } - - for ( ; s < se; s+= s_res) - { - if ((s_res= mb_wc(cs, &s_wc, s, se)) < 0) - { - DBUG_ASSERT(0); - return 0; - } - if (s_wc != ' ') - return (s_wc < ' ') ? -swap : swap; - } - } - return res; -} - - static uint my_ismbchar_utf16(CHARSET_INFO *cs, const char *b, const char *e) { @@ -1623,111 +1510,6 @@ my_wildcmp_utf16_bin(CHARSET_INFO *cs, } -static int -my_strnncoll_utf16_bin(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool t_is_prefix) -{ - int s_res,t_res; - my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); - my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc; - const uchar *se=s+slen; - const uchar *te=t+tlen; - - while ( s < se && t < te ) - { - s_res= mb_wc(cs, &s_wc, s, se); - t_res= mb_wc(cs, &t_wc, t, te); - - if (s_res <= 0 || t_res <= 0) - { - /* Incorrect string, compare by char value */ - return my_bincmp(s, se, t, te); - } - if (s_wc != t_wc) - { - return s_wc > t_wc ? 1 : -1; - } - - s+= s_res; - t+= t_res; - } - return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t))); -} - - -static int -my_strnncollsp_utf16_bin(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool diff_if_only_endspace_difference) -{ - int res; - my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); - my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc; - const uchar *se= s + slen, *te= t + tlen; - - DBUG_ASSERT((slen % 2) == 0); - DBUG_ASSERT((tlen % 2) == 0); - -#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE - diff_if_only_endspace_difference= FALSE; -#endif - - while (s < se && t < te) - { - int s_res= mb_wc(cs, &s_wc, s, se); - int t_res= mb_wc(cs, &t_wc, t, te); - - if (s_res <= 0 || t_res <= 0) - { - /* Incorrect string, compare bytewise */ - return my_bincmp(s, se, t, te); - } - - if (s_wc != t_wc) - { - return s_wc > t_wc ? 1 : -1; - } - - s+= s_res; - t+= t_res; - } - - slen= (size_t) (se - s); - tlen= (size_t) (te - t); - res= 0; - - if (slen != tlen) - { - int s_res, swap= 1; - if (diff_if_only_endspace_difference) - res= 1; /* Assume 's' is bigger */ - if (slen < tlen) - { - slen= tlen; - s= t; - se= te; - swap= -1; - res= -res; - } - - for ( ; s < se; s+= s_res) - { - if ((s_res= mb_wc(cs, &s_wc, s, se)) < 0) - { - DBUG_ASSERT(0); - return 0; - } - if (s_wc != ' ') - return (s_wc < ' ') ? -swap : swap; - } - } - return res; -} - - static void my_hash_sort_utf16_bin(CHARSET_INFO *cs, const uchar *pos, size_t len, ulong *nr1, ulong *nr2) @@ -1747,8 +1529,8 @@ my_hash_sort_utf16_bin(CHARSET_INFO *cs, static MY_COLLATION_HANDLER my_collation_utf16_general_ci_handler = { NULL, /* init */ - my_strnncoll_utf16, - my_strnncollsp_utf16, + my_strnncoll_utf16_general_ci, + my_strnncollsp_utf16_general_ci, my_strnxfrm_unicode, my_strnxfrmlen_unicode, my_like_range_generic, @@ -1877,6 +1659,24 @@ struct charset_info_st my_charset_utf16_bin= }; +#define IS_MB2_CHAR(b0,b1) (!MY_UTF16_SURROGATE_HEAD(b1)) +#define IS_MB4_CHAR(b0,b1,b2,b3) (MY_UTF16_HIGH_HEAD(b1) && MY_UTF16_LOW_HEAD(b3)) + +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16le_general_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf16mb2_general_ci(b1,b0) +#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER +#include "strcoll.ic" + +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf16le_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) ((int) MY_UTF16_WC2(b1, b0)) +#define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF16_WC4(b1, b0, b3, b2)) +#include "strcoll.ic" + +#undef IS_MB2_CHAR +#undef IS_MB4_CHAR + static int my_utf16le_uni(CHARSET_INFO *cs __attribute__((unused)), my_wc_t *pwc, const uchar *s, const uchar *e) @@ -1948,6 +1748,38 @@ my_lengthsp_utf16le(CHARSET_INFO *cs __attribute__((unused)), } +static MY_COLLATION_HANDLER my_collation_utf16le_general_ci_handler = +{ + NULL, /* init */ + my_strnncoll_utf16le_general_ci, + my_strnncollsp_utf16le_general_ci, + my_strnxfrm_unicode, + my_strnxfrmlen_unicode, + my_like_range_generic, + my_wildcmp_utf16_ci, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf16, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_utf16le_bin_handler = +{ + NULL, /* init */ + my_strnncoll_utf16le_bin, + my_strnncollsp_utf16le_bin, + my_strnxfrm_unicode_full_bin, + my_strnxfrmlen_unicode_full_bin, + my_like_range_generic, + my_wildcmp_utf16_bin, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf16_bin, + my_propagate_simple +}; + + static MY_CHARSET_HANDLER my_charset_utf16le_handler= { NULL, /* init */ @@ -2012,7 +1844,7 @@ struct charset_info_st my_charset_utf16le_general_ci= 0, /* escape_with_backslash_is_dangerous */ 1, /* levels_for_order */ &my_charset_utf16le_handler, - &my_collation_utf16_general_ci_handler + &my_collation_utf16le_general_ci_handler }; @@ -2045,7 +1877,7 @@ struct charset_info_st my_charset_utf16le_bin= 0, /* escape_with_backslash_is_dangerous */ 1, /* levels_for_order */ &my_charset_utf16le_handler, - &my_collation_utf16_bin_handler + &my_collation_utf16le_bin_handler }; @@ -2060,6 +1892,34 @@ struct charset_info_st my_charset_utf16le_bin= */ #define IS_UTF32_MBHEAD4(b0,b1) (!(b0) && ((uchar) (b1) <= 0x10)) +#define IS_MB4_CHAR(b0,b1,b2,b3) (IS_UTF32_MBHEAD4(b0,b1)) + +#define MY_UTF32_WC4(b0,b1,b2,b3) ((b0 << 24) + (b1 << 16) + (b2 << 8) + (b3)) + +static inline int my_weight_utf32_general_ci(uchar b0, uchar b1, + uchar b2, uchar b3) +{ + my_wc_t wc= MY_UTF32_WC4(b0, b1, b2, b3); + if (wc <= 0xFFFF) + { + MY_UNICASE_CHARACTER *page= my_unicase_default.page[wc >> 8]; + return (int) (page ? page[wc & 0xFF].sort : wc); + } + return MY_CS_REPLACEMENT_CHARACTER; +} +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf32_general_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB4(b0,b1,b2,b3) my_weight_utf32_general_ci(b0, b1, b2, b3) +#include "strcoll.ic" + +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf32_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB4(b0,b1,b2,b3) ((int) MY_UTF32_WC4(b0, b1, b2, b3)) +#include "strcoll.ic" + +#undef IS_MB2_CHAR +#undef IS_MB4_CHAR + static int my_utf32_uni(CHARSET_INFO *cs __attribute__((unused)), @@ -2067,7 +1927,7 @@ my_utf32_uni(CHARSET_INFO *cs __attribute__((unused)), { if (s + 4 > e) return MY_CS_TOOSMALL4; - *pwc= (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + (s[3]); + *pwc= MY_UTF32_WC4(s[0], s[1], s[2], s[3]); return *pwc > 0x10FFFF ? MY_CS_ILSEQ : 4; } @@ -2197,144 +2057,6 @@ my_casedn_utf32(CHARSET_INFO *cs, char *src, size_t srclen, } -static int -my_strnncoll_utf32(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool t_is_prefix) -{ - my_wc_t UNINIT_VAR(s_wc),UNINIT_VAR(t_wc); - const uchar *se= s + slen; - const uchar *te= t + tlen; - MY_UNICASE_INFO *uni_plane= cs->caseinfo; - - while (s < se && t < te) - { - int s_res= my_utf32_uni(cs, &s_wc, s, se); - int t_res= my_utf32_uni(cs, &t_wc, t, te); - - if ( s_res <= 0 || t_res <= 0) - { - /* Incorrect string, compare by char value */ - return my_bincmp(s, se, t, te); - } - - my_tosort_utf32(uni_plane, &s_wc); - my_tosort_utf32(uni_plane, &t_wc); - - if (s_wc != t_wc) - { - return s_wc > t_wc ? 1 : -1; - } - - s+= s_res; - t+= t_res; - } - return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t))); -} - - -/** - Compare strings, discarding end space - - If one string is shorter as the other, then we space extend the other - so that the strings have equal length. - - This will ensure that the following things hold: - - "a" == "a " - "a\0" < "a" - "a\0" < "a " - - @param cs Character set pinter. - @param a First string to compare. - @param a_length Length of 'a'. - @param b Second string to compare. - @param b_length Length of 'b'. - - IMPLEMENTATION - - @return Comparison result. - @retval Negative number, if a less than b. - @retval 0, if a is equal to b - @retval Positive number, if a > b -*/ - - -static int -my_strnncollsp_utf32(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool diff_if_only_endspace_difference) -{ - int res; - my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); - const uchar *se= s + slen, *te= t + tlen; - MY_UNICASE_INFO *uni_plane= cs->caseinfo; - - DBUG_ASSERT((slen % 4) == 0); - DBUG_ASSERT((tlen % 4) == 0); - -#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE - diff_if_only_endspace_difference= FALSE; -#endif - - while ( s < se && t < te ) - { - int s_res= my_utf32_uni(cs, &s_wc, s, se); - int t_res= my_utf32_uni(cs, &t_wc, t, te); - - if ( s_res <= 0 || t_res <= 0 ) - { - /* Incorrect string, compare bytewise */ - return my_bincmp(s, se, t, te); - } - - my_tosort_utf32(uni_plane, &s_wc); - my_tosort_utf32(uni_plane, &t_wc); - - if ( s_wc != t_wc ) - { - return s_wc > t_wc ? 1 : -1; - } - - s+= s_res; - t+= t_res; - } - - slen= (size_t) (se - s); - tlen= (size_t) (te - t); - res= 0; - - if (slen != tlen) - { - int s_res, swap= 1; - if (diff_if_only_endspace_difference) - res= 1; /* Assume 's' is bigger */ - if (slen < tlen) - { - slen= tlen; - s= t; - se= te; - swap= -1; - res= -res; - } - - for ( ; s < se; s+= s_res) - { - if ((s_res= my_utf32_uni(cs, &s_wc, s, se)) < 0) - { - DBUG_ASSERT(0); - return 0; - } - if (s_wc != ' ') - return (s_wc < ' ') ? -swap : swap; - } - } - return res; -} - - static uint my_ismbchar_utf32(CHARSET_INFO *cs __attribute__((unused)), const char *b, @@ -2746,97 +2468,6 @@ my_wildcmp_utf32_bin(CHARSET_INFO *cs, } -static int -my_strnncoll_utf32_bin(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool t_is_prefix) -{ - my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); - const uchar *se= s + slen; - const uchar *te= t + tlen; - - while (s < se && t < te) - { - int s_res= my_utf32_uni(cs, &s_wc, s, se); - int t_res= my_utf32_uni(cs, &t_wc, t, te); - - if (s_res <= 0 || t_res <= 0) - { - /* Incorrect string, compare by char value */ - return my_bincmp(s, se, t, te); - } - if (s_wc != t_wc) - { - return s_wc > t_wc ? 1 : -1; - } - - s+= s_res; - t+= t_res; - } - return (int) (t_is_prefix ? (t-te) : ((se - s) - (te - t))); -} - - -static inline my_wc_t -my_utf32_get(const uchar *s) -{ - return - ((my_wc_t) s[0] << 24) + - ((my_wc_t) s[1] << 16) + - ((my_wc_t) s[2] << 8) + - s[3]; -} - - -static int -my_strnncollsp_utf32_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool diff_if_only_endspace_difference - __attribute__((unused))) -{ - const uchar *se, *te; - size_t minlen; - - DBUG_ASSERT((slen % 4) == 0); - DBUG_ASSERT((tlen % 4) == 0); - - se= s + slen; - te= t + tlen; - - for (minlen= MY_MIN(slen, tlen); minlen; minlen-= 4) - { - my_wc_t s_wc= my_utf32_get(s); - my_wc_t t_wc= my_utf32_get(t); - if (s_wc != t_wc) - return s_wc > t_wc ? 1 : -1; - - s+= 4; - t+= 4; - } - - if (slen != tlen) - { - int swap= 1; - if (slen < tlen) - { - s= t; - se= te; - swap= -1; - } - - for ( ; s < se ; s+= 4) - { - my_wc_t s_wc= my_utf32_get(s); - if (s_wc != ' ') - return (s_wc < ' ') ? -swap : swap; - } - } - return 0; -} - - static size_t my_scan_utf32(CHARSET_INFO *cs, const char *str, const char *end, int sequence_type) @@ -2864,8 +2495,8 @@ my_scan_utf32(CHARSET_INFO *cs, static MY_COLLATION_HANDLER my_collation_utf32_general_ci_handler = { NULL, /* init */ - my_strnncoll_utf32, - my_strnncollsp_utf32, + my_strnncoll_utf32_general_ci, + my_strnncollsp_utf32_general_ci, my_strnxfrm_unicode, my_strnxfrmlen_unicode, my_like_range_generic, @@ -3058,6 +2689,31 @@ static const uchar to_upper_ucs2[] = { }; +/* Definitions for strcoll.ic */ +#define IS_MB2_CHAR(x,y) (1) +#define UCS2_CODE(b0,b1) (((uchar) b0) << 8 | ((uchar) b1)) + + +static inline int my_weight_mb2_ucs2_general_ci(uchar b0, uchar b1) +{ + my_wc_t wc= UCS2_CODE(b0, b1); + MY_UNICASE_CHARACTER *page= my_unicase_default.page[wc >> 8]; + return (int) (page ? page[wc & 0xFF].sort : wc); +} + + +#define MY_FUNCTION_NAME(x) my_ ## x ## _ucs2_general_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) my_weight_mb2_ucs2_general_ci(b0,b1) +#include "strcoll.ic" + + +#define MY_FUNCTION_NAME(x) my_ ## x ## _ucs2_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB2(b0,b1) UCS2_CODE(b0,b1) +#include "strcoll.ic" + + static int my_charlen_ucs2(CHARSET_INFO *cs __attribute__((unused)), const uchar *s, const uchar *e) @@ -3208,120 +2864,6 @@ my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)), } -static int my_strnncoll_ucs2(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool t_is_prefix) -{ - int s_res,t_res; - my_wc_t UNINIT_VAR(s_wc),UNINIT_VAR(t_wc); - const uchar *se=s+slen; - const uchar *te=t+tlen; - MY_UNICASE_INFO *uni_plane= cs->caseinfo; - - while ( s < se && t < te ) - { - s_res=my_ucs2_uni(cs,&s_wc, s, se); - t_res=my_ucs2_uni(cs,&t_wc, t, te); - - if ( s_res <= 0 || t_res <= 0 ) - { - /* Incorrect string, compare by char value */ - return ((int)s[0]-(int)t[0]); - } - - my_tosort_ucs2(uni_plane, &s_wc); - my_tosort_ucs2(uni_plane, &t_wc); - - if ( s_wc != t_wc ) - { - return s_wc > t_wc ? 1 : -1; - } - - s+=s_res; - t+=t_res; - } - return (int) (t_is_prefix ? t-te : ((se-s) - (te-t))); -} - -/* - Compare strings, discarding end space - - SYNOPSIS - my_strnncollsp_ucs2() - cs character set handler - a First string to compare - a_length Length of 'a' - b Second string to compare - b_length Length of 'b' - - IMPLEMENTATION - If one string is shorter as the other, then we space extend the other - so that the strings have equal length. - - This will ensure that the following things hold: - - "a" == "a " - "a\0" < "a" - "a\0" < "a " - - RETURN - < 0 a < b - = 0 a == b - > 0 a > b -*/ - -static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool diff_if_only_endspace_difference - __attribute__((unused))) -{ - const uchar *se, *te; - size_t minlen; - MY_UNICASE_INFO *uni_plane= cs->caseinfo; - - /* extra safety to make sure the lengths are even numbers */ - slen&= ~1; - tlen&= ~1; - - se= s + slen; - te= t + tlen; - - for (minlen= MY_MIN(slen, tlen); minlen; minlen-= 2) - { - int s_wc = uni_plane->page[s[0]] ? (int) uni_plane->page[s[0]][s[1]].sort : - (((int) s[0]) << 8) + (int) s[1]; - - int t_wc = uni_plane->page[t[0]] ? (int) uni_plane->page[t[0]][t[1]].sort : - (((int) t[0]) << 8) + (int) t[1]; - if ( s_wc != t_wc ) - return s_wc > t_wc ? 1 : -1; - - s+= 2; - t+= 2; - } - - if (slen != tlen) - { - int swap= 1; - if (slen < tlen) - { - s= t; - se= te; - swap= -1; - } - - for ( ; s < se ; s+= 2) - { - if (s[0] || s[1] != ' ') - return (s[0] == 0 && s[1] < ' ') ? -swap : swap; - } - } - return 0; -} - - static uint my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e) @@ -3418,85 +2960,6 @@ int my_wildcmp_ucs2_bin(CHARSET_INFO *cs, static -int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool t_is_prefix) -{ - int s_res,t_res; - my_wc_t UNINIT_VAR(s_wc),UNINIT_VAR(t_wc); - const uchar *se=s+slen; - const uchar *te=t+tlen; - - while ( s < se && t < te ) - { - s_res=my_ucs2_uni(cs,&s_wc, s, se); - t_res=my_ucs2_uni(cs,&t_wc, t, te); - - if ( s_res <= 0 || t_res <= 0 ) - { - /* Incorrect string, compare by char value */ - return ((int)s[0]-(int)t[0]); - } - if ( s_wc != t_wc ) - { - return s_wc > t_wc ? 1 : -1; - } - - s+=s_res; - t+=t_res; - } - return (int) (t_is_prefix ? t-te : ((se-s) - (te-t))); -} - -static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool diff_if_only_endspace_difference - __attribute__((unused))) -{ - const uchar *se, *te; - size_t minlen; - - /* extra safety to make sure the lengths are even numbers */ - slen= (slen >> 1) << 1; - tlen= (tlen >> 1) << 1; - - se= s + slen; - te= t + tlen; - - for (minlen= MY_MIN(slen, tlen); minlen; minlen-= 2) - { - int s_wc= s[0] * 256 + s[1]; - int t_wc= t[0] * 256 + t[1]; - if ( s_wc != t_wc ) - return s_wc > t_wc ? 1 : -1; - - s+= 2; - t+= 2; - } - - if (slen != tlen) - { - int swap= 1; - if (slen < tlen) - { - s= t; - se= te; - swap= -1; - } - - for ( ; s < se ; s+= 2) - { - if (s[0] || s[1] != ' ') - return (s[0] == 0 && s[1] < ' ') ? -swap : swap; - } - } - return 0; -} - - -static void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *key, size_t len,ulong *nr1, ulong *nr2) { @@ -3518,8 +2981,8 @@ void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler = { NULL, /* init */ - my_strnncoll_ucs2, - my_strnncollsp_ucs2, + my_strnncoll_ucs2_general_ci, + my_strnncollsp_ucs2_general_ci, my_strnxfrm_unicode, my_strnxfrmlen_unicode, my_like_range_generic, diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index cb000a2afa0..497ad67da05 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -193,6 +193,7 @@ static const uchar sort_order_ujis[]= #define isujis_ss3(c) ((uchar) (c) == 0x8f) #define MY_FUNCTION_NAME(x) my_ ## x ## _ujis +#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80) #define IS_MB2_JIS(x,y) (isujis(x) && isujis(y)) #define IS_MB2_KATA(x,y) (isujis_ss2(x) && iskata(y)) #define IS_MB2_CHAR(x, y) (IS_MB2_KATA(x,y) || IS_MB2_JIS(x,y)) @@ -200,6 +201,23 @@ static const uchar sort_order_ujis[]= #define DEFINE_ASIAN_ROUTINES #include "ctype-mb.ic" +#define MY_FUNCTION_NAME(x) my_ ## x ## _ujis_japanese_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) ((int) sort_order_ujis[(uchar) (x)]) +#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \ + (((uint) (uchar) (y)) << 8)) +#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z)) +#include "strcoll.ic" + + +#define MY_FUNCTION_NAME(x) my_ ## x ## _ujis_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) ((int) (uchar) (x)) +#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \ + (((uint) (uchar) (y)) << 8)) +#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z)) +#include "strcoll.ic" + static uint ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) @@ -67211,11 +67229,11 @@ my_caseup_ujis(CHARSET_INFO * cs, char *src, size_t srclen, #ifdef HAVE_CHARSET_ujis -static MY_COLLATION_HANDLER my_collation_ci_handler = +static MY_COLLATION_HANDLER my_collation_ujis_japanese_ci_handler = { NULL, /* init */ - my_strnncoll_simple,/* strnncoll */ - my_strnncollsp_simple, + my_strnncoll_ujis_japanese_ci, + my_strnncollsp_ujis_japanese_ci, my_strnxfrm_mb, /* strnxfrm */ my_strnxfrmlen_simple, my_like_range_mb, /* like_range */ @@ -67226,6 +67244,23 @@ static MY_COLLATION_HANDLER my_collation_ci_handler = my_propagate_simple }; + +static MY_COLLATION_HANDLER my_collation_ujis_bin_handler = +{ + NULL, /* init */ + my_strnncoll_ujis_bin, + my_strnncollsp_ujis_bin, + my_strnxfrm_mb, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_bin, + my_propagate_simple +}; + + static MY_CHARSET_HANDLER my_charset_handler= { NULL, /* init */ @@ -67291,7 +67326,7 @@ struct charset_info_st my_charset_ujis_japanese_ci= 0, /* escape_with_backslash_is_dangerous */ 1, /* levels_for_order */ &my_charset_handler, - &my_collation_ci_handler + &my_collation_ujis_japanese_ci_handler }; @@ -67324,7 +67359,7 @@ struct charset_info_st my_charset_ujis_bin= 0, /* escape_with_backslash_is_dangerous */ 1, /* levels_for_order */ &my_charset_handler, - &my_collation_mb_bin_handler + &my_collation_ujis_bin_handler }; diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index b7fb7e49cab..259928130b9 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -26,8 +26,86 @@ #define EILSEQ ENOENT #endif -#define IS_CONTINUATION_BYTE(c) (((c) ^ 0x80) < 0x40) +/* Detect special bytes and sequences */ +#define IS_CONTINUATION_BYTE(c) (((uchar) (c) ^ 0x80) < 0x40) +/* + Check MB2 character assuming that b0 is alredy known to be >= 0xC2. + Use this macro if the caller already checked b0 for: + - an MB1 character + - an unused gap between MB1 and MB2HEAD +*/ +#define IS_UTF8MB2_STEP2(b0,b1) (((uchar) (b0) < 0xE0) && \ + IS_CONTINUATION_BYTE((uchar) b1)) + +/* + Check MB3 character assuming that b0 is already known to be + in the valid MB3HEAD range [0xE0..0xEF]. +*/ +#define IS_UTF8MB3_STEP2(b0,b1,b2) (IS_CONTINUATION_BYTE(b1) && \ + IS_CONTINUATION_BYTE(b2) && \ + ((uchar) b0 >= 0xe1 || (uchar) b1 >= 0xa0)) + +/* + Check MB3 character assuming that b0 is already known to be >= 0xE0, + but is not checked for the high end 0xF0 yet. + Use this macro if the caller already checked b0 for: + - an MB1 character + - an unused gap between MB1 and MB2HEAD + - an MB2HEAD +*/ +#define IS_UTF8MB3_STEP3(b0,b1,b2) (((uchar) (b0) < 0xF0) && \ + IS_UTF8MB3_STEP2(b0,b1,b2)) + +/* + UTF-8 quick four-byte mask: + 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + Encoding allows to encode U+00010000..U+001FFFFF + + The maximum character defined in the Unicode standard is U+0010FFFF. + Higher characters U+00110000..U+001FFFFF are not used. + + 11110000.10010000.10xxxxxx.10xxxxxx == F0.90.80.80 == U+00010000 (min) + 11110100.10001111.10111111.10111111 == F4.8F.BF.BF == U+0010FFFF (max) + + Valid codes: + [F0][90..BF][80..BF][80..BF] + [F1][80..BF][80..BF][80..BF] + [F2][80..BF][80..BF][80..BF] + [F3][80..BF][80..BF][80..BF] + [F4][80..8F][80..BF][80..BF] +*/ + +/* + Check MB4 character assuming that b0 is already + known to be in the range [0xF0..0xF4] +*/ +#define IS_UTF8MB4_STEP2(b0,b1,b2,b3) (IS_CONTINUATION_BYTE(b1) && \ + IS_CONTINUATION_BYTE(b2) && \ + IS_CONTINUATION_BYTE(b3) && \ + (b0 >= 0xf1 || b1 >= 0x90) && \ + (b0 <= 0xf3 || b1 <= 0x8F)) +#define IS_UTF8MB4_STEP3(b0,b1,b2,b3) (((uchar) (b0) < 0xF5) && \ + IS_UTF8MB4_STEP2(b0,b1,b2,b3)) + +/* Convert individual bytes to Unicode code points */ +#define UTF8MB2_CODE(b0,b1) (((my_wc_t) ((uchar) b0 & 0x1f) << 6) |\ + ((my_wc_t) ((uchar) b1 ^ 0x80))) +#define UTF8MB3_CODE(b0,b1,b2) (((my_wc_t) ((uchar) b0 & 0x0f) << 12) |\ + ((my_wc_t) ((uchar) b1 ^ 0x80) << 6) |\ + ((my_wc_t) ((uchar) b2 ^ 0x80))) +#define UTF8MB4_CODE(b0,b1,b2,b3) (((my_wc_t) ((uchar) b0 & 0x07) << 18) |\ + ((my_wc_t) ((uchar) b1 ^ 0x80) << 12) |\ + ((my_wc_t) ((uchar) b2 ^ 0x80) << 6) |\ + (my_wc_t) ((uchar) b3 ^ 0x80)) + +/* Definitions for strcoll.ic */ +#define IS_MB1_CHAR(x) ((uchar) (x) < 0x80) +#define IS_MB1_MBHEAD_UNUSED_GAP(x) ((uchar) (x) < 0xC2) +#define IS_MB2_CHAR(x,y) IS_UTF8MB2_STEP2(x,y) +#define IS_MB3_CHAR(x,y,z) IS_UTF8MB3_STEP3(x,y,z) + +/* Collation names */ #define MY_UTF8MB3_GENERAL_CI MY_UTF8MB3 "_general_ci" #define MY_UTF8MB3_GENERAL_CS MY_UTF8MB3 "_general_cs" #define MY_UTF8MB3_BIN MY_UTF8MB3 "_bin" @@ -88,8 +166,7 @@ int my_valid_mbcharlen_utf8mb3(const uchar *s, const uchar *e) if (s+3 > e) /* We need 3 characters */ return MY_CS_TOOSMALL3; - if (!(IS_CONTINUATION_BYTE(s[1]) && IS_CONTINUATION_BYTE(s[2]) && - (c >= 0xe1 || s[1] >= 0xa0))) + if (!IS_UTF8MB3_STEP2(c, s[1], s[2])) return MY_CS_ILSEQ; return 3; @@ -4848,7 +4925,7 @@ static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)), if (!(IS_CONTINUATION_BYTE(s[1]))) return MY_CS_ILSEQ; - *pwc = ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80); + *pwc= UTF8MB2_CODE(c, s[1]); return 2; } else if (c < 0xf0) @@ -4856,76 +4933,12 @@ static int my_utf8_uni(CHARSET_INFO *cs __attribute__((unused)), if (s+3 > e) /* We need 3 characters */ return MY_CS_TOOSMALL3; - if (!(IS_CONTINUATION_BYTE(s[1]) && IS_CONTINUATION_BYTE(s[2]) && - (c >= 0xe1 || s[1] >= 0xa0))) + if (!IS_UTF8MB3_STEP2(c, s[1], s[2])) return MY_CS_ILSEQ; - *pwc = ((my_wc_t) (c & 0x0f) << 12) | - ((my_wc_t) (s[1] ^ 0x80) << 6) | - (my_wc_t) (s[2] ^ 0x80); - + *pwc= UTF8MB3_CODE(c, s[1], s[2]); return 3; } -#ifdef UNICODE_32BIT - else if (c < 0xf8 && sizeof(my_wc_t)*8 >= 32) - { - if (s+4 > e) /* We need 4 characters */ - return MY_CS_TOOSMALL4; - - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - IS_CONTINUATION_BYTE(s[3]) && - (c >= 0xf1 || s[1] >= 0x90))) - return MY_CS_ILSEQ; - - *pwc = ((my_wc_t) (c & 0x07) << 18) | - ((my_wc_t) (s[1] ^ 0x80) << 12) | - ((my_wc_t) (s[2] ^ 0x80) << 6) | - (my_wc_t) (s[3] ^ 0x80); - - return 4; - } - else if (c < 0xfc && sizeof(my_wc_t)*8 >= 32) - { - if (s+5 >e) /* We need 5 characters */ - return MY_CS_TOOSMALL5; - - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - IS_CONTINUATION_BYTE(s[3]) && - IS_CONTINUATION_BYTE(s[4]) && - (c >= 0xf9 || s[1] >= 0x88))) - return MY_CS_ILSEQ; - - *pwc = ((my_wc_t) (c & 0x03) << 24) | - ((my_wc_t) (s[1] ^ 0x80) << 18) | - ((my_wc_t) (s[2] ^ 0x80) << 12) | - ((my_wc_t) (s[3] ^ 0x80) << 6) | - (my_wc_t) (s[4] ^ 0x80); - return 5; - } - else if (c < 0xfe && sizeof(my_wc_t)*8 >= 32) - { - if ( s+6 >e ) /* We need 6 characters */ - return MY_CS_TOOSMALL6; - - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - IS_CONTINUATION_BYTE(s[3]) && - IS_CONTINUATION_BYTE(s[4]) && - IS_CONTINUATION_BYTE(s[5]) && - (c >= 0xfd || s[1] >= 0x84))) - return MY_CS_ILSEQ; - - *pwc = ((my_wc_t) (c & 0x01) << 30) - | ((my_wc_t) (s[1] ^ 0x80) << 24) - | ((my_wc_t) (s[2] ^ 0x80) << 18) - | ((my_wc_t) (s[3] ^ 0x80) << 12) - | ((my_wc_t) (s[4] ^ 0x80) << 6) - | (my_wc_t) (s[5] ^ 0x80); - return 6; - } -#endif return MY_CS_ILSEQ; } @@ -4954,21 +4967,16 @@ static int my_utf8_uni_no_range(CHARSET_INFO *cs __attribute__((unused)), if (!((s[1] ^ 0x80) < 0x40)) return MY_CS_ILSEQ; - *pwc = ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80); + *pwc= UTF8MB2_CODE(c, s[1]); return 2; } if (c < 0xf0) { - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - (c >= 0xe1 || s[1] >= 0xa0))) + if (!IS_UTF8MB3_STEP2(c, s[1], s[2])) return MY_CS_ILSEQ; - *pwc= ((my_wc_t) (c & 0x0f) << 12) | - ((my_wc_t) (s[1] ^ 0x80) << 6) | - (my_wc_t) (s[2] ^ 0x80); - + *pwc= UTF8MB3_CODE(c, s[1], s[2]); return 3; } return MY_CS_ILSEQ; @@ -5193,148 +5201,6 @@ static size_t my_casedn_str_utf8(CHARSET_INFO *cs, char *src) } -static int my_strnncoll_utf8(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool t_is_prefix) -{ - int s_res,t_res; - my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); - const uchar *se=s+slen; - const uchar *te=t+tlen; - MY_UNICASE_INFO *uni_plane= cs->caseinfo; - - while ( s < se && t < te ) - { - s_res=my_utf8_uni(cs,&s_wc, s, se); - t_res=my_utf8_uni(cs,&t_wc, t, te); - - if ( s_res <= 0 || t_res <= 0 ) - { - /* Incorrect string, compare byte by byte value */ - return bincmp(s, se, t, te); - } - - my_tosort_unicode(uni_plane, &s_wc, cs->state); - my_tosort_unicode(uni_plane, &t_wc, cs->state); - - if ( s_wc != t_wc ) - { - return s_wc > t_wc ? 1 : -1; - } - - s+=s_res; - t+=t_res; - } - return (int) (t_is_prefix ? t-te : ((se-s) - (te-t))); -} - - - -/* - Compare strings, discarding end space - - SYNOPSIS - my_strnncollsp_utf8() - cs character set handler - a First string to compare - a_length Length of 'a' - b Second string to compare - b_length Length of 'b' - diff_if_only_endspace_difference - Set to 1 if the strings should be regarded as different - if they only difference in end space - - IMPLEMENTATION - If one string is shorter as the other, then we space extend the other - so that the strings have equal length. - - This will ensure that the following things hold: - - "a" == "a " - "a\0" < "a" - "a\0" < "a " - - RETURN - < 0 a < b - = 0 a == b - > 0 a > b -*/ - -static int my_strnncollsp_utf8(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool diff_if_only_endspace_difference) -{ - int s_res, t_res, res; - my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); - const uchar *se= s+slen, *te= t+tlen; - MY_UNICASE_INFO *uni_plane= cs->caseinfo; - -#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE - diff_if_only_endspace_difference= 0; -#endif - - while ( s < se && t < te ) - { - s_res=my_utf8_uni(cs,&s_wc, s, se); - t_res=my_utf8_uni(cs,&t_wc, t, te); - - if ( s_res <= 0 || t_res <= 0 ) - { - /* Incorrect string, compare byte by byte value */ - return bincmp(s, se, t, te); - } - - my_tosort_unicode(uni_plane, &s_wc, cs->state); - my_tosort_unicode(uni_plane, &t_wc, cs->state); - - if ( s_wc != t_wc ) - { - return s_wc > t_wc ? 1 : -1; - } - - s+=s_res; - t+=t_res; - } - - slen= (size_t) (se-s); - tlen= (size_t) (te-t); - res= 0; - - if (slen != tlen) - { - int swap= 1; - if (diff_if_only_endspace_difference) - res= 1; /* Assume 'a' is bigger */ - if (slen < tlen) - { - slen= tlen; - s= t; - se= te; - swap= -1; - res= -res; - } - /* - This following loop uses the fact that in UTF-8 - all multibyte characters are greater than space, - and all multibyte head characters are greater than - space. It means if we meet a character greater - than space, it always means that the longer string - is greater. So we can reuse the same loop from the - 8bit version, without having to process full multibute - sequences. - */ - for ( ; s < se; s++) - { - if (*s != ' ') - return (*s < ' ') ? -swap : swap; - } - } - return res; -} - - /* Compare 0-terminated UTF8 strings. @@ -5456,50 +5322,6 @@ int my_charlen_utf8(CHARSET_INFO *cs __attribute__((unused)), if (c < 0xf0) return my_valid_mbcharlen_utf8mb3(s, e); -#ifdef UNICODE_32BIT - if (c < 0xf8 && sizeof(my_wc_t)*8 >= 32) - { - if (s+4 > e) /* We need 4 characters */ - return MY_CS_TOOSMALL4; - - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - IS_CONTINUATION_BYTE(s[3]) && - (c >= 0xf1 || s[1] >= 0x90))) - return MY_CS_ILSEQ; - - return 4; - } - if (c < 0xfc && sizeof(my_wc_t)*8 >= 32) - { - if (s+5 >e) /* We need 5 characters */ - return MY_CS_TOOSMALL5; - - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - IS_CONTINUATION_BYTE(s[3]) && - IS_CONTINUATION_BYTE(s[4]) && - (c >= 0xf9 || s[1] >= 0x88))) - return MY_CS_ILSEQ; - - return 5; - } - if (c < 0xfe && sizeof(my_wc_t)*8 >= 32) - { - if ( s+6 >e ) /* We need 6 characters */ - return MY_CS_TOOSMALL6; - - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - IS_CONTINUATION_BYTE(s[3]) && - IS_CONTINUATION_BYTE(s[4]) && - IS_CONTINUATION_BYTE(s[5]) && - (c >= 0xfd || s[1] >= 0x84))) - return MY_CS_ILSEQ; - - return 6; - } -#endif return MY_CS_ILSEQ; } @@ -5535,6 +5357,75 @@ my_well_formed_len_utf8(CHARSET_INFO *cs, const char *b, const char *e, /* my_well_formed_char_length_utf8 */ +static inline int my_weight_mb1_utf8_general_ci(uchar b) +{ + return (int) plane00[b & 0xFF].sort; +} + + +static inline int my_weight_mb2_utf8_general_ci(uchar b0, uchar b1) +{ + my_wc_t wc= UTF8MB2_CODE(b0, b1); + MY_UNICASE_CHARACTER *page= my_unicase_pages_default[wc >> 8]; + return (int) (page ? page[wc & 0xFF].sort : wc); +} + + +static inline int my_weight_mb3_utf8_general_ci(uchar b0, uchar b1, uchar b2) +{ + my_wc_t wc= UTF8MB3_CODE(b0, b1, b2); + MY_UNICASE_CHARACTER *page= my_unicase_pages_default[wc >> 8]; + return (int) (page ? page[wc & 0xFF].sort : wc); +} + + +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_general_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) my_weight_mb1_utf8_general_ci(x) +#define WEIGHT_MB2(x,y) my_weight_mb2_utf8_general_ci(x,y) +#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8_general_ci(x,y,z) +#include "strcoll.ic" + + +static inline int my_weight_mb1_utf8_general_mysql500_ci(uchar b) +{ + return (int) plane00_mysql500[b & 0xFF].sort; +} + + +static inline int my_weight_mb2_utf8_general_mysql500_ci(uchar b0, uchar b1) +{ + my_wc_t wc= UTF8MB2_CODE(b0, b1); + MY_UNICASE_CHARACTER *page= my_unicase_pages_mysql500[wc >> 8]; + return (int) (page ? page[wc & 0xFF].sort : wc); +} + + +static inline int +my_weight_mb3_utf8_general_mysql500_ci(uchar b0, uchar b1, uchar b2) +{ + my_wc_t wc= UTF8MB3_CODE(b0, b1, b2); + MY_UNICASE_CHARACTER *page= my_unicase_pages_mysql500[wc >> 8]; + return (int) (page ? page[wc & 0xFF].sort : wc); +} + + +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_general_mysql500_ci +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) my_weight_mb1_utf8_general_mysql500_ci(x) +#define WEIGHT_MB2(x,y) my_weight_mb2_utf8_general_mysql500_ci(x,y) +#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8_general_mysql500_ci(x,y,z) +#include "strcoll.ic" + + +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(x) ((int) (uchar) (x)) +#define WEIGHT_MB2(x,y) ((int) UTF8MB2_CODE(x,y)) +#define WEIGHT_MB3(x,y,z) ((int) UTF8MB3_CODE(x,y,z)) +#include "strcoll.ic" + + static uint my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e) { int res= my_charlen_utf8(cs, (const uchar*) b, (const uchar*) e); @@ -5552,14 +5443,6 @@ static uint my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)), return 2; else if (c < 0xf0) return 3; -#ifdef UNICODE_32BIT - else if (c < 0xf8) - return 4; - else if (c < 0xfc) - return 5; - else if (c < 0xfe) - return 6; -#endif return 0; /* Illegal mb head */; } @@ -5567,8 +5450,24 @@ static uint my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)), static MY_COLLATION_HANDLER my_collation_utf8_general_ci_handler = { NULL, /* init */ - my_strnncoll_utf8, - my_strnncollsp_utf8, + my_strnncoll_utf8_general_ci, + my_strnncollsp_utf8_general_ci, + my_strnxfrm_unicode, + my_strnxfrmlen_unicode, + my_like_range_mb, + my_wildcmp_utf8, + my_strcasecmp_utf8, + my_instr_mb, + my_hash_sort_utf8, + my_propagate_complex +}; + + +static MY_COLLATION_HANDLER my_collation_utf8_general_mysql500_ci_handler = +{ + NULL, /* init */ + my_strnncoll_utf8_general_mysql500_ci, + my_strnncollsp_utf8_general_mysql500_ci, my_strnxfrm_unicode, my_strnxfrmlen_unicode, my_like_range_mb, @@ -5583,8 +5482,8 @@ static MY_COLLATION_HANDLER my_collation_utf8_general_ci_handler = static MY_COLLATION_HANDLER my_collation_utf8_bin_handler = { NULL, /* init */ - my_strnncoll_mb_bin, - my_strnncollsp_mb_bin, + my_strnncoll_utf8_bin, + my_strnncollsp_utf8_bin, my_strnxfrm_unicode, my_strnxfrmlen_unicode, my_like_range_mb, @@ -5693,7 +5592,7 @@ struct charset_info_st my_charset_utf8_general_mysql500_ci= 0, /* escape_with_backslash_is_dangerous */ 1, /* levels_for_order */ &my_charset_utf8_handler, - &my_collation_utf8_general_ci_handler + &my_collation_utf8_general_mysql500_ci_handler }; @@ -7166,8 +7065,8 @@ my_ismbchar_filename(CHARSET_INFO *cs, const char *str, const char *end) static MY_COLLATION_HANDLER my_collation_filename_handler = { NULL, /* init */ - my_strnncoll_utf8, - my_strnncollsp_utf8, + my_strnncoll_simple, + my_strnncollsp_simple, my_strnxfrm_unicode, my_strnxfrmlen_unicode, my_like_range_mb, @@ -7410,7 +7309,7 @@ my_mb_wc_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), if (!(IS_CONTINUATION_BYTE(s[1]))) return MY_CS_ILSEQ; - *pwc= ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80); + *pwc= UTF8MB2_CODE(c, s[1]); return 2; } else if (c < 0xf0) @@ -7418,13 +7317,10 @@ my_mb_wc_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), if (s + 3 > e) /* We need 3 characters */ return MY_CS_TOOSMALL3; - if (!(IS_CONTINUATION_BYTE(s[1]) && IS_CONTINUATION_BYTE(s[2]) && - (c >= 0xe1 || s[1] >= 0xa0))) + if (!IS_UTF8MB3_STEP2(c, s[1], s[2])) return MY_CS_ILSEQ; - *pwc= ((my_wc_t) (c & 0x0f) << 12) | - ((my_wc_t) (s[1] ^ 0x80) << 6) | - (my_wc_t) (s[2] ^ 0x80); + *pwc= UTF8MB3_CODE(c, s[1], s[2]); return 3; } else if (c < 0xf5) @@ -7432,35 +7328,9 @@ my_mb_wc_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), if (s + 4 > e) /* We need 4 characters */ return MY_CS_TOOSMALL4; - /* - UTF-8 quick four-byte mask: - 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - Encoding allows to encode U+00010000..U+001FFFFF - - The maximum character defined in the Unicode standard is U+0010FFFF. - Higher characters U+00110000..U+001FFFFF are not used. - - 11110000.10010000.10xxxxxx.10xxxxxx == F0.90.80.80 == U+00010000 (min) - 11110100.10001111.10111111.10111111 == F4.8F.BF.BF == U+0010FFFF (max) - - Valid codes: - [F0][90..BF][80..BF][80..BF] - [F1][80..BF][80..BF][80..BF] - [F2][80..BF][80..BF][80..BF] - [F3][80..BF][80..BF][80..BF] - [F4][80..8F][80..BF][80..BF] - */ - - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - IS_CONTINUATION_BYTE(s[3]) && - (c >= 0xf1 || s[1] >= 0x90) && - (c <= 0xf3 || s[1] <= 0x8F))) + if (!IS_UTF8MB4_STEP2(c, s[1], s[2], s[3])) return MY_CS_ILSEQ; - *pwc = ((my_wc_t) (c & 0x07) << 18) | - ((my_wc_t) (s[1] ^ 0x80) << 12) | - ((my_wc_t) (s[2] ^ 0x80) << 6) | - (my_wc_t) (s[3] ^ 0x80); + *pwc= UTF8MB4_CODE(c, s[1], s[2], s[3]); return 4; } return MY_CS_ILSEQ; @@ -7492,34 +7362,22 @@ my_mb_wc_utf8mb4_no_range(CHARSET_INFO *cs __attribute__((unused)), if (!IS_CONTINUATION_BYTE(s[1])) return MY_CS_ILSEQ; - *pwc = ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80); + *pwc= UTF8MB2_CODE(c, s[1]); return 2; } if (c < 0xf0) { - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - (c >= 0xe1 || s[1] >= 0xa0))) + if (!IS_UTF8MB3_STEP2(c, s[1], s[2])) return MY_CS_ILSEQ; - *pwc= ((my_wc_t) (c & 0x0f) << 12) | - ((my_wc_t) (s[1] ^ 0x80) << 6) | - (my_wc_t) (s[2] ^ 0x80); - + *pwc= UTF8MB3_CODE(c, s[1], s[2]); return 3; } else if (c < 0xf5) { - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - IS_CONTINUATION_BYTE(s[3]) && - (c >= 0xf1 || s[1] >= 0x90) && - (c <= 0xf3 || s[1] <= 0x8F))) + if (!IS_UTF8MB4_STEP2(c, s[1], s[2], s[3])) return MY_CS_ILSEQ; - *pwc = ((my_wc_t) (c & 0x07) << 18) | - ((my_wc_t) (s[1] ^ 0x80) << 12) | - ((my_wc_t) (s[2] ^ 0x80) << 6) | - (my_wc_t) (s[3] ^ 0x80); + *pwc= UTF8MB4_CODE(c, s[1], s[2], s[3]); return 4; } return MY_CS_ILSEQ; @@ -7765,146 +7623,6 @@ my_casedn_str_utf8mb4(CHARSET_INFO *cs, char *src) } -static int -my_strnncoll_utf8mb4(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool t_is_prefix) -{ - my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); - const uchar *se= s + slen; - const uchar *te= t + tlen; - MY_UNICASE_INFO *uni_plane= cs->caseinfo; - - while ( s < se && t < te ) - { - int s_res= my_mb_wc_utf8mb4(cs, &s_wc, s, se); - int t_res= my_mb_wc_utf8mb4(cs, &t_wc, t, te); - - if ( s_res <= 0 || t_res <= 0 ) - { - /* Incorrect string, compare bytewise */ - return bincmp_utf8mb4(s, se, t, te); - } - - my_tosort_unicode(uni_plane, &s_wc, cs->state); - my_tosort_unicode(uni_plane, &t_wc, cs->state); - - if ( s_wc != t_wc ) - { - return s_wc > t_wc ? 1 : -1; - } - - s+= s_res; - t+= t_res; - } - return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t))); -} - - -/** - - Compare strings, discarding end space - - If one string is shorter as the other, then we space extend the other - so that the strings have equal length. - - This will ensure that the following things hold: - - "a" == "a " - "a\0" < "a" - "a\0" < "a " - - @param cs Character set pinter. - @param a First string to compare. - @param a_length Length of 'a'. - @param b Second string to compare. - @param b_length Length of 'b'. - @param diff_if_only_endspace_difference - Set to 1 if the strings should be regarded as different - if they only difference in end space - - @return Comparison result. - @retval Negative number, if a less than b. - @retval 0, if a is equal to b - @retval Positive number, if a > b -*/ - -static int -my_strnncollsp_utf8mb4(CHARSET_INFO *cs, - const uchar *s, size_t slen, - const uchar *t, size_t tlen, - my_bool diff_if_only_endspace_difference) -{ - int res; - my_wc_t UNINIT_VAR(s_wc), UNINIT_VAR(t_wc); - const uchar *se= s + slen, *te= t + tlen; - MY_UNICASE_INFO *uni_plane= cs->caseinfo; - -#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE - diff_if_only_endspace_difference= FALSE; -#endif - - while ( s < se && t < te ) - { - int s_res= my_mb_wc_utf8mb4(cs, &s_wc, s, se); - int t_res= my_mb_wc_utf8mb4(cs, &t_wc, t, te); - - if ( s_res <= 0 || t_res <= 0 ) - { - /* Incorrect string, compare bytewise */ - return bincmp_utf8mb4(s, se, t, te); - } - - my_tosort_unicode(uni_plane, &s_wc, cs->state); - my_tosort_unicode(uni_plane, &t_wc, cs->state); - - if ( s_wc != t_wc ) - { - return s_wc > t_wc ? 1 : -1; - } - - s+=s_res; - t+=t_res; - } - - slen= (size_t) (se-s); - tlen= (size_t) (te-t); - res= 0; - - if (slen != tlen) - { - int swap= 1; - if (diff_if_only_endspace_difference) - res= 1; /* Assume 'a' is bigger */ - if (slen < tlen) - { - slen= tlen; - s= t; - se= te; - swap= -1; - res= -res; - } - /* - This following loop uses the fact that in UTF-8 - all multibyte characters are greater than space, - and all multibyte head characters are greater than - space. It means if we meet a character greater - than space, it always means that the longer string - is greater. So we can reuse the same loop from the - 8bit version, without having to process full multibute - sequences. - */ - for ( ; s < se; s++) - { - if (*s != ' ') - return (*s < ' ') ? -swap : swap; - } - } - return res; -} - - /** Compare 0-terminated UTF8 strings. @@ -8007,30 +7725,7 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), if (s + 4 > e) /* We need 4 characters */ return MY_CS_TOOSMALL4; - /* - UTF-8 quick four-byte mask: - 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - Encoding allows to encode U+00010000..U+001FFFFF - - The maximum character defined in the Unicode standard is U+0010FFFF. - Higher characters U+00110000..U+001FFFFF are not used. - - 11110000.10010000.10xxxxxx.10xxxxxx == F0.90.80.80 == U+00010000 (min) - 11110100.10001111.10111111.10111111 == F4.8F.BF.BF == U+0010FFFF (max) - - Valid codes: - [F0][90..BF][80..BF][80..BF] - [F1][80..BF][80..BF][80..BF] - [F2][80..BF][80..BF][80..BF] - [F3][80..BF][80..BF][80..BF] - [F4][80..8F][80..BF][80..BF] - */ - - if (!(IS_CONTINUATION_BYTE(s[1]) && - IS_CONTINUATION_BYTE(s[2]) && - IS_CONTINUATION_BYTE(s[3]) && - (c >= 0xf1 || s[1] >= 0x90) && - (c <= 0xf3 || s[1] <= 0x8F))) + if (!IS_UTF8MB4_STEP2(c, s[1], s[2], s[3])) return MY_CS_ILSEQ; return 4; @@ -8072,6 +7767,29 @@ size_t my_well_formed_len_utf8mb4(CHARSET_INFO *cs, #undef DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN /* my_well_formed_char_length_utf8mb4 */ + +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb4_general_ci +#define IS_MB4_CHAR(b0,b1,b2,b3) IS_UTF8MB4_STEP3(b0,b1,b2,b3) +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(b0) my_weight_mb1_utf8_general_ci(b0) +#define WEIGHT_MB2(b0,b1) my_weight_mb2_utf8_general_ci(b0,b1) +#define WEIGHT_MB3(b0,b1,b2) my_weight_mb3_utf8_general_ci(b0,b1,b2) +/* + All non-BMP characters have the same weight. +*/ +#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER +#include "strcoll.ic" + + +#define MY_FUNCTION_NAME(x) my_ ## x ## _utf8mb4_bin +#define WEIGHT_ILSEQ(x) (0xFF0000 + (uchar) (x)) +#define WEIGHT_MB1(b0) ((int) (uchar) (b0)) +#define WEIGHT_MB2(b0,b1) ((int) UTF8MB2_CODE(b0,b1)) +#define WEIGHT_MB3(b0,b1,b2) ((int) UTF8MB3_CODE(b0,b1,b2)) +#define WEIGHT_MB4(b0,b1,b2,b3) ((int) UTF8MB4_CODE(b0,b1,b2,b3)) +#include "strcoll.ic" + + static uint my_ismbchar_utf8mb4(CHARSET_INFO *cs, const char *b, const char *e) { @@ -8100,8 +7818,8 @@ my_mbcharlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), uint c) static MY_COLLATION_HANDLER my_collation_utf8mb4_general_ci_handler= { NULL, /* init */ - my_strnncoll_utf8mb4, - my_strnncollsp_utf8mb4, + my_strnncoll_utf8mb4_general_ci, + my_strnncollsp_utf8mb4_general_ci, my_strnxfrm_unicode, my_strnxfrmlen_unicode, my_like_range_mb, @@ -8116,8 +7834,8 @@ static MY_COLLATION_HANDLER my_collation_utf8mb4_general_ci_handler= static MY_COLLATION_HANDLER my_collation_utf8mb4_bin_handler = { NULL, /* init */ - my_strnncoll_mb_bin, - my_strnncollsp_mb_bin, + my_strnncoll_utf8mb4_bin, + my_strnncollsp_utf8mb4_bin, my_strnxfrm_unicode_full_bin, my_strnxfrmlen_unicode_full_bin, my_like_range_mb, diff --git a/strings/strcoll.ic b/strings/strcoll.ic index f230c4f7411..4bced593a23 100644 --- a/strings/strcoll.ic +++ b/strings/strcoll.ic @@ -64,11 +64,16 @@ @return - the number of bytes scanned The including source file must define the following macros: - IS_MB1_CHAR(x) - IS_MB2_CHAR(x,y) + IS_MB1_CHAR(b0) - for character sets that have MB1 characters + IS_MB1_MB2HEAD_GAP(b0) - optional, for better performance + IS_MB2_CHAR(b0,b1) - for character sets that have MB2 characters + IS_MB3_CHAR(b0,b1,b2) - for character sets that have MB3 characters + IS_MB4_CHAR(b0,b1,b2,b3) - for character sets with have MB4 characters WEIGHT_PAD_SPACE - WEIGHT_MB1(x) - WEIGHT_MB2(x,y) + WEIGHT_MB1(b0) - for character sets that have MB1 characters + WEIGHT_MB2(b0,b1) - for character sets that have MB2 characters + WEIGHT_MB3(b0,b1,b2) - for character sets that have MB3 characters + WEIGHT_MB4(b0,b1,b2,b3) - for character sets that have MB4 characters WEIGHT_ILSEQ(x) */ static inline uint @@ -80,12 +85,25 @@ MY_FUNCTION_NAME(scan_weight)(int *weight, const uchar *str, const uchar *end) return 0; } +#ifdef IS_MB1_CHAR if (IS_MB1_CHAR(*str)) { *weight= WEIGHT_MB1(*str); /* A valid single byte character*/ return 1; } +#endif + +#ifdef IS_MB1_MBHEAD_UNUSED_GAP + /* + Quickly filter out unused bytes that are neither MB1 nor MBHEAD. + E.g. [0x80..0xC1] in utf8. This allows using simplified conditions + in IS_MB2_CHAR(), IS_MB3_CHAR(), etc. + */ + if (IS_MB1_MBHEAD_UNUSED_GAP(*str)) + goto bad; +#endif +#ifdef IS_MB2_CHAR if (str + 2 > end) /* The string ended unexpectedly */ goto bad; /* Treat as a bad byte */ @@ -94,6 +112,30 @@ MY_FUNCTION_NAME(scan_weight)(int *weight, const uchar *str, const uchar *end) *weight= WEIGHT_MB2(str[0], str[1]); return 2; /* A valid two-byte character */ } +#endif + +#ifdef IS_MB3_CHAR + if (str + 3 > end) /* Incomplete three-byte character */ + goto bad; + + if (IS_MB3_CHAR(str[0], str[1], str[2])) + { + *weight= WEIGHT_MB3(str[0], str[1], str[2]); + return 3; /* A valid three-byte character */ + } +#endif + +#ifdef IS_MB4_CHAR + if (str + 4 > end) /* Incomplete four-byte character */ + goto bad; + + if (IS_MB4_CHAR(str[0], str[1], str[2], str[3])) + { + *weight= WEIGHT_MB4(str[0], str[1], str[2], str[3]); + return 4; /* A valid four-byte character */ + } + +#endif bad: *weight= WEIGHT_ILSEQ(str[0]); /* Bad byte */ @@ -228,4 +270,6 @@ MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)), #undef WEIGHT_ILSEQ #undef WEIGHT_MB1 #undef WEIGHT_MB2 +#undef WEIGHT_MB3 +#undef WEIGHT_MB4 #undef WEIGHT_PAD_SPACE diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c index c7824d07047..fe595a5c303 100644 --- a/unittest/strings/strings-t.c +++ b/unittest/strings/strings-t.c @@ -149,7 +149,7 @@ typedef struct A1A1 - MB2 or 8BIT+8BIT E0E0 - MB2 */ -STRNNCOLL_PARAM strcoll_mb2_common[]= +static STRNNCOLL_PARAM strcoll_mb2_common[]= { /* Compare two good sequences */ {CSTR(""), CSTR(""), 0}, @@ -210,7 +210,7 @@ STRNNCOLL_PARAM strcoll_mb2_common[]= /* For character sets that have good mb2 characters A1A1 and F9FE */ -STRNNCOLL_PARAM strcoll_mb2_A1A1_mb2_F9FE[]= +static STRNNCOLL_PARAM strcoll_mb2_A1A1_mb2_F9FE[]= { /* Compare two good characters */ {CSTR(""), CSTR("\xF9\xFE"), -1}, @@ -246,7 +246,7 @@ STRNNCOLL_PARAM strcoll_mb2_A1A1_mb2_F9FE[]= A1A1 - a good mb2 character F9FE - a bad sequence */ -STRNNCOLL_PARAM strcoll_mb2_A1A1_bad_F9FE[]= +static STRNNCOLL_PARAM strcoll_mb2_A1A1_bad_F9FE[]= { /* Compare a good character to an illegal or an incomplete sequence */ {CSTR(""), CSTR("\xF9\xFE"), -1}, @@ -283,7 +283,7 @@ STRNNCOLL_PARAM strcoll_mb2_A1A1_bad_F9FE[]= F9 - ILSEQ or H2 F9FE - a bad sequence (ILSEQ+XX or H2+ILSEQ) */ -STRNNCOLL_PARAM strcoll_mb1_A1_bad_F9FE[]= +static STRNNCOLL_PARAM strcoll_mb1_A1_bad_F9FE[]= { /* Compare two good characters */ {CSTR(""), CSTR("\xA1"), -1}, @@ -323,7 +323,7 @@ STRNNCOLL_PARAM strcoll_mb1_A1_bad_F9FE[]= and sort in this order: 8181 < A1 < E0E0 */ -STRNNCOLL_PARAM strcoll_8181_A1_E0E0[]= +static STRNNCOLL_PARAM strcoll_8181_A1_E0E0[]= { {CSTR("\x81\x81"), CSTR("\xA1"), -1}, {CSTR("\x81\x81"), CSTR("\xE0\xE0"), -1}, @@ -333,6 +333,263 @@ STRNNCOLL_PARAM strcoll_8181_A1_E0E0[]= }; +/* + A shared test for eucjpms and ujis. +*/ +static STRNNCOLL_PARAM strcoll_ujis[]= +{ + {CSTR("\x8E\xA1"), CSTR("\x8E"), -1}, /* Good MB2 vs incomplete MB2 */ + {CSTR("\x8E\xA1"), CSTR("\x8F\xA1"), -1}, /* Good MB2 vs incomplete MB3 */ + {CSTR("\x8E\xA1"), CSTR("\x8F\xA1\xA1"), -1}, /* Good MB2 vs good MB3 */ + {CSTR("\xA1\xA1"), CSTR("\x8F\xA1\xA1"), 1}, /* Good MB2 vs good MB3 */ + {CSTR("\x8E"), CSTR("\x8F\xA1"), -1}, /* Incomplete MB2 vs incomplete MB3 */ + {NULL, 0, NULL, 0, 0} +}; + + +static STRNNCOLL_PARAM strcoll_utf8mb3_common[]= +{ + {CSTR("\xC0"), CSTR("\xC1"), -1}, /* Unused byte vs unused byte */ + {CSTR("\xC0"), CSTR("\xFF"), -1}, /* Unused byte vs unused byte */ + {CSTR("\xC2\xA1"), CSTR("\xC0"), -1}, /* MB2 vs unused byte */ + {CSTR("\xC2\xA1"), CSTR("\xC2"), -1}, /* MB2 vs incomplete MB2 */ + {CSTR("\xC2\xA1"), CSTR("\xC2\xA2"), -1}, /* MB2 vs MB2 */ + {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\x7F"),-1}, /* MB2 vs broken MB3 */ + {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\x80"),-1}, /* MB2 vs MB3 */ + {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\xBF"),-1}, /* MB2 vs MB3 */ + {CSTR("\xC2\xA1"), CSTR("\xE0\xA0\xC0"),-1}, /* MB2 vs broken MB3 */ + {CSTR("\xC2\xA1"), CSTR("\xE0\xA0"), -1}, /* MB2 vs incomplete MB3 */ + {CSTR("\xE0\xA0\x7E"), CSTR("\xE0\xA0\x7F"),-1},/* Broken MB3 vs broken MB3 */ + {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0"), -1},/* MB3 vs incomplete MB3 */ + {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0\x7F"),-1},/* MB3 vs broken MB3 */ + {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0\xBF"),-1},/* MB3 vs MB3 */ + {CSTR("\xE0\xA0\x80"), CSTR("\xE0\xA0\xC0"),-1},/* MB3 vs broken MB3 */ + {CSTR("\xE0\xA0\xC0"), CSTR("\xE0\xA0\xC1"),-1},/* Broken MB3 vs broken MB3 */ + {NULL, 0, NULL, 0, 0} +}; + + +static STRNNCOLL_PARAM strcoll_utf8mb4_common[]= +{ + /* Minimum four-byte character: U+10000 == _utf8 0xF0908080 */ + {CSTR("\xF0\x90\x80\x80"), CSTR("\xC0"), -1}, /* MB4 vs unused byte */ + {CSTR("\xF0\x90\x80\x80"), CSTR("\xC2"), -1}, /* MB4 vs incomplete MB2 */ + {CSTR("\xF0\x90\x80\x80"), CSTR("\xE0\xA0\x7F"),-1}, /* MB4 vs broken MB3 */ + {CSTR("\xF0\x90\x80\x80"), CSTR("\xE0\xA0\xC0"),-1}, /* MB4 vs broken MB3 */ + {CSTR("\xF0\x90\x80\x80"), CSTR("\xE0\xA0"), -1}, /* MB4 vs incomplete MB3 */ + {CSTR("\xF0\x90\x80\x80"), CSTR("\xF0\x90\x80"),-1}, /* MB4 vs incomplete MB4 */ + {CSTR("\xF0\x90\x80\x80"), CSTR("\xF0\x90\x80\x7F"),-1},/* MB4 vs broken MB4 */ + {CSTR("\xF0\x90\x80\x80"), CSTR("\xF0\x90\x80\xC0"),-1},/* MB4 vs broken MB4 */ + + /* Maximum four-byte character: U+10FFFF == _utf8 0xF48FBFBF */ + {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xC0"), -1}, /* MB4 vs unused byte */ + {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xC2"), -1}, /* MB4 vs incomplete MB2 */ + {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xE0\xA0\x7F"),-1}, /* MB4 vs broken MB3 */ + {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xE0\xA0\xC0"),-1}, /* MB4 vs broken MB3 */ + {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xE0\xA0"), -1}, /* MB4 vs incomplete MB3 */ + {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xF0\x90\x80"),-1}, /* MB4 vs incomplete MB4 */ + {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xF0\x90\x80\x7F"),-1},/* MB4 vs broken MB4 */ + {CSTR("\xF4\x8F\xBF\xBF"), CSTR("\xF0\x90\x80\xC0"),-1},/* MB4 vs broken MB4 */ + + /* Broken MB4 vs incomplete/broken MB3 */ + {CSTR("\xF0\x90\x80\x7F"), CSTR("\xE0\xA0"), 1}, /* Broken MB4 vs incomplete MB3 */ + {CSTR("\xF0\x90\x80\x7F"), CSTR("\xE0\xA0\x7F"),1}, /* Broken MB4 vs broken MB3 */ + {CSTR("\xF0\x90\x80\x7F"), CSTR("\xE0\xA0\xC0"),1}, /* Broken MB4 vs broken MB3 */ + + /* + Broken MB4 vs incomplete MB4: + The three leftmost bytes are compared binary, the fourth byte is compared + to auto-padded space. + */ + {CSTR("\xF0\x90\x80\x1F"), CSTR("\xF0\x90\x80"),-1}, /* Broken MB4 vs incomplete MB4 */ + {CSTR("\xF0\x90\x80\x7E"), CSTR("\xF0\x90\x80"),1}, /* Broken MB4 vs incomplete MB4 */ + + /* Broken MB4 vs broken MB4 */ + {CSTR("\xF0\x90\x80\x7E"), CSTR("\xF0\x90\x80\x7F"),-1},/* Broken MB4 vs broken MB4 */ + {CSTR("\xF0\x90\x80\x7E"), CSTR("\xF0\x90\x80\xC0"),-1},/* Broken MB4 vs broken MB4 */ + + {NULL, 0, NULL, 0, 0} +}; + + +static STRNNCOLL_PARAM strcoll_utf8mb4_general_ci[]= +{ + /* All non-BMP characters are equal in utf8mb4_general_ci */ + {CSTR("\xF0\x90\x80\x80"), CSTR("\xF0\x90\x80\x81"),0},/* Non-BMB MB4 vs non-BMP MB4 */ + {CSTR("\xF0\x90\x80\x80"), CSTR("\xF4\x8F\xBF\xBF"),0},/* Non-BMB MB4 vs non-BMP MB4 */ + {CSTR("\x00"), CSTR("\xF0\x90\x80\x80"),-1},/* U+0000 vs non-BMP MB4 */ + {CSTR("\x00"), CSTR("\xF0\x90\x80\x81"),-1},/* U+0000 vs non-BMP MB4 */ + {CSTR("\x00"), CSTR("\xF4\x8F\xBF\xBF"),-1},/* U+0000 vs non-BMP MB4 */ + {NULL, 0, NULL, 0, 0} +}; + + +static STRNNCOLL_PARAM strcoll_ucs2_common[]= +{ + {CSTR("\xC0"), CSTR("\xC1"), -1}, /* Incomlete MB2 vs incomplete MB2 */ + {CSTR("\xC0"), CSTR("\xFF"), -1}, /* Incomlete MB2 vs incomplete MB2 */ + {CSTR("\xC2\xA1"), CSTR("\xC0"), -1}, /* MB2 vs incomplete MB2 */ + {CSTR("\xC2\xA1"), CSTR("\xC2"), -1}, /* MB2 vs incomplete MB2 */ + {CSTR("\xC2\xA0"), CSTR("\xC2\xA1"), -1}, /* MB2 vs MB2 */ + {CSTR("\xC2\xA1"), CSTR("\xC2\xA2"), -1}, /* MB2 vs MB2 */ + + {CSTR("\xFF\xFF"), CSTR("\x00"),-1}, /* MB2 vs incomplete */ + {CSTR("\xFF\xFF\xFF\xFF"), CSTR("\x00"),-1}, /* MB2+MB2 vs incomplete */ + {CSTR("\xFF\xFF\xFF\xFF"), CSTR("\x00\x00\x00"), 1},/* MB2+MB2 vs MB2+incomplete */ + + {NULL, 0, NULL, 0, 0} +}; + + +/* Tests that involve comparison to SPACE (explicit, or padded) */ +static STRNNCOLL_PARAM strcoll_ucs2_space[]= +{ + {CSTR("\x00\x1F"), CSTR("\x00\x20"), -1}, /* MB2 vs MB2 */ + {CSTR("\x00\x20"), CSTR("\x00\x21"), -1}, /* MB2 vs MB2 */ + {CSTR("\x00\x1F"), CSTR(""), -1}, /* MB2 vs empty */ + {CSTR("\x00\x20"), CSTR(""), 0}, /* MB2 vs empty */ + {CSTR("\x00\x21"), CSTR(""), 1}, /* MB2 vs empty */ + + {NULL, 0, NULL, 0, 0} +}; + + +/* Tests that involve comparison to SPACE (explicit, or padded) */ +static STRNNCOLL_PARAM strcoll_utf16le_space[]= +{ + {CSTR("\x1F\x00"), CSTR("\x20\x00"), -1}, /* MB2 vs MB2 */ + {CSTR("\x20\x00"), CSTR("\x21\x00"), -1}, /* MB2 vs MB2 */ + {CSTR("\x1F\x00"), CSTR(""), -1}, /* MB2 vs empty */ + {CSTR("\x20\x00"), CSTR(""), 0}, /* MB2 vs empty */ + {CSTR("\x21\x00"), CSTR(""), 1}, /* MB2 vs empty */ + + {NULL, 0, NULL, 0, 0} +}; + + +static STRNNCOLL_PARAM strcoll_utf16_common[]= +{ + /* Minimum four-byte character: U+10000 == _utf16 0xD800DC00 */ + {CSTR("\xD8\x00\xDC\x00"), CSTR("\xC0"), -1},/* MB4 vs incomplete MB2 */ + {CSTR("\xD8\x00\xDC\x00"), CSTR("\xC2"), -1},/* MB4 vs incomplete MB2 */ + {CSTR("\xD8\x00\xDC\x00"), CSTR("\xD8\x00\xDB\x00"),-1},/* MB4 vs broken MB4 */ + {CSTR("\xD8\x00\xDC\x00"), CSTR("\xD8\x00\xE0\x00"),-1},/* MB4 vs broken MB4 */ + {CSTR("\xD8\x00\xDC\x00"), CSTR("\xDC\x00"), -1},/* MB4 vs broken MB2 */ + {CSTR("\xD8\x00\xDC\x00"), CSTR("\xD8\x00\xDC"), -1},/* MB4 vs incomplete MB4 */ + + /* Maximum four-byte character: U+10FFFF == _utf8 0xF48FBFBF */ + {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xC0"), -1},/* MB4 vs incomplete MB2 */ + {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xC2"), -1},/* MB4 vs incomplete MB2 */ + {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xD8\x00\xDB\x00"),-1},/* MB4 vs broken MB4 */ + {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xD8\x00\xE0\x00"),-1},/* MB4 vs broken MB4 */ + {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xDC\x00"), -1},/* MB4 vs broken MB2 */ + {CSTR("\xDB\xFF\xDF\xFF"), CSTR("\xDC\xFF\xDF"), -1},/* MB4 vs incomplete MB4 */ + + /* Broken MB4 vs broken MB4 */ + {CSTR("\xD8\x00\xDC\x00"), CSTR("\xD8\x00\xDB\x01"),-1},/* Broken MB4 vs broken MB4 */ + {CSTR("\xDB\xFF\xE0\xFE"), CSTR("\xDB\xFF\xE0\xFF"),-1},/* Broken MB4 vs broken MB4 */ + + {NULL, 0, NULL, 0, 0} +}; + + +static STRNNCOLL_PARAM strcoll_utf16_general_ci[]= +{ + /* All non-BMP characters are compared as equal */ + {CSTR("\xD8\x00\xDC\x00"), CSTR("\xD8\x00\xDC\x01"), 0},/* Non-BMP MB4 vs non-BMP MB4 */ + {CSTR("\xD8\x00\xDC\x00"), CSTR("\xDB\xFF\xDF\xFF"), 0},/* Non-BMP MB4 vs non-BMP MB4 */ + {CSTR("\x00\x00"), CSTR("\xD8\x00\xDC\x01"),-1},/* U+0000 vs non-BMP MB4 */ + {CSTR("\x00\x00"), CSTR("\xDB\xFF\xDF\xFF"),-1},/* U+0000 vs non-BMP MB4 */ + {NULL, 0, NULL, 0, 0} +}; + + +static STRNNCOLL_PARAM strcoll_utf16le_common[]= +{ + /* Minimum four-byte character: U+10000 == _utf16 0xD800DC00 */ + {CSTR("\x00\xD8\x00\xDC"), CSTR("\xC0"), -1},/* MB4 vs incomplete MB2 */ + {CSTR("\x00\xD8\x00\xDC"), CSTR("\xC2"), -1},/* MB4 vs incomplete MB2 */ + {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xD8\x00\xDB"),-1},/* MB4 vs broken MB4 */ + {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xD8\x00\xD0"),-1},/* MB4 vs broken MB4 */ + {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xDC"), -1},/* MB4 vs broken MB2 */ + {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xD8\x00"), -1},/* MB4 vs incomplete MB4 */ + + /* Maximum four-byte character: U+10FFFF == _utf8 0xF48FBFBF */ + {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\xC0"), -1},/* MB4 vs incomplete MB2 */ + {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\xC2"), -1},/* MB4 vs incomplete MB2 */ + {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\x00\xD8\x00\xDB"),-1},/* MB4 vs broken MB4 */ + {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\x00\xD8\x00\xE0"),-1},/* MB4 vs broken MB4 */ + {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\x00\xDC"), -1},/* MB4 vs broken MB2 */ + {CSTR("\xFF\xDB\xFF\xDF"), CSTR("\xFF\xDC\x00"), -1},/* MB4 vs incomplete MB4 */ + + /* Broken MB4 vs broken MB4 */ + {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xD8\x01\xDB"),-1},/* Broken MB4 vs broken MB4 */ + {CSTR("\xFF\xDB\xFE\xE0"), CSTR("\xFF\xDB\xFF\xE0"),-1},/* Broken MB4 vs broken MB4 */ + + {NULL, 0, NULL, 0, 0} +}; + + +static STRNNCOLL_PARAM strcoll_utf16le_general_ci[]= +{ + /* All non-BMP characters are compared as equal */ + {CSTR("\x00\xD8\x00\xDC"), CSTR("\x00\xD8\x01\xDC"), 0},/* Non-BMP MB4 vs non-BMP MB4 */ + {CSTR("\x00\xD8\x00\xDC"), CSTR("\xFF\xDB\xFF\xDF"), 0},/* Non-BMP MB4 vs non-BMP MB4 */ + {CSTR("\x00\x00"), CSTR("\x00\xD8\x01\xDC"), -1},/* U+0000 vs non-BMP MB4 */ + {CSTR("\x00\x00"), CSTR("\xFF\xDB\xFF\xDF"), -1},/* U+0000 vs non-BMP MB4 */ + + {NULL, 0, NULL, 0, 0} +}; + + +static STRNNCOLL_PARAM strcoll_utf32_common[]= +{ + /* Minimum character: U+0000 == _utf32 0x00000000 */ + {CSTR("\x00\x00\x00\x00"), CSTR("\x00"), -1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x00\x00\x00"), CSTR("\xFF"), -1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x00\x00\x00"), CSTR("\x00\x00"), -1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x00\x00\x00"), CSTR("\x00\x00\x00"),-1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x00\x00\x00"), CSTR("\x00\x20\x00\x00"),-1},/* MB4 vs broken MB4 */ + {CSTR("\x00\x00\x00\x00"), CSTR("\xFF\xFF\xFF\xFF"),-1},/* MB4 vs broken MB4 */ + + /* Minimum non-BMP character: U+10000 == _utf32 0x00010000 */ + {CSTR("\x00\x01\x00\x00"), CSTR("\x00"), -1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x01\x00\x00"), CSTR("\xFF"), -1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x01\x00\x00"), CSTR("\x00\x00"), -1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x01\x00\x00"), CSTR("\x00\x00\x00"),-1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x01\x00\x00"), CSTR("\x00\x20\x00\x00"),-1},/* MB4 vs broken MB4 */ + {CSTR("\x00\x01\x00\x00"), CSTR("\xFF\xFF\xFF\xFF"),-1},/* MB4 vs broken MB4 */ + + /* Maximum character: U+10FFFF == _utf32 0x0010FFFF */ + {CSTR("\x00\x10\xFF\xFF"), CSTR("\x00"), -1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x10\xFF\xFF"), CSTR("\xFF"), -1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x10\xFF\xFF"), CSTR("\x00\x00"), -1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x10\xFF\xFF"), CSTR("\x00\x00\x00"), -1}, /* MB4 vs incomplete MB4 */ + {CSTR("\x00\x10\xFF\xFF"), CSTR("\x20\x00\x00\x00"),-1},/* MB4 vs broken MB3 */ + {CSTR("\x00\x10\xFF\xFF"), CSTR("\xFF\xFF\xFF\xFF"),-1},/* MB4 vs broken MB4 */ + + + /* Broken MB4 vs incomplete/broken MB3 */ + {CSTR("\x00\x20\x00\x00"), CSTR("\x00"), 1}, /* Broken MB4 vs incomplete MB4 */ + {CSTR("\x00\x20\x00\x00"), CSTR("\x00\x00"), 1}, /* Broken MB4 vs incomplete MB4 */ + {CSTR("\x00\x20\x00\x00"), CSTR("\x00\x00\x00"), 1}, /* Broken MB4 vs incomplete MB4 */ + {CSTR("\x00\x20\x00\x00"), CSTR("\x00\x20\x00\x01"),-1},/* Broken MB4 vs broken MB4 */ + + {NULL, 0, NULL, 0, 0} +}; + + +static STRNNCOLL_PARAM strcoll_utf32_general_ci[]= +{ + /* Two non-BMP characters are compared as equal */ + {CSTR("\x00\x01\x00\x00"), CSTR("\x00\x01\x00\x01"), 0}, /* non-BMP MB4 vs non-BMP MB4 */ + {CSTR("\x00\x00\x00\x00"), CSTR("\x00\x01\x00\x00"), -1}, /* U+0000 vs non-BMP MB4 */ + {CSTR("\x00\x00\x00\x00"), CSTR("\x00\x01\x00\x01"), -1}, /* U+0000 vs non-BMP MB4 */ + + {NULL, 0, NULL, 0, 0} +}; + + static void str2hex(char *dst, size_t dstlen, const char *src, size_t srclen) { @@ -415,6 +672,14 @@ test_strcollsp() failed+= strcollsp(&my_charset_cp932_japanese_ci, strcoll_8181_A1_E0E0); failed+= strcollsp(&my_charset_cp932_bin, strcoll_8181_A1_E0E0); #endif +#ifdef HAVE_CHARSET_eucjpms + failed+= strcollsp(&my_charset_eucjpms_japanese_ci, strcoll_mb2_common); + failed+= strcollsp(&my_charset_eucjpms_bin, strcoll_mb2_common); + failed+= strcollsp(&my_charset_eucjpms_japanese_ci, strcoll_mb2_A1A1_mb2_F9FE); + failed+= strcollsp(&my_charset_eucjpms_bin, strcoll_mb2_A1A1_mb2_F9FE); + failed+= strcollsp(&my_charset_eucjpms_japanese_ci, strcoll_ujis); + failed+= strcollsp(&my_charset_eucjpms_bin, strcoll_ujis); +#endif #ifdef HAVE_CHARSET_euckr failed+= strcollsp(&my_charset_euckr_korean_ci, strcoll_mb2_common); failed+= strcollsp(&my_charset_euckr_korean_ci, strcoll_mb2_A1A1_mb2_F9FE); @@ -441,6 +706,54 @@ test_strcollsp() failed+= strcollsp(&my_charset_sjis_japanese_ci, strcoll_8181_A1_E0E0); failed+= strcollsp(&my_charset_sjis_bin, strcoll_8181_A1_E0E0); #endif +#ifdef HAVE_CHARSET_ucs2 + failed+= strcollsp(&my_charset_ucs2_general_ci, strcoll_ucs2_common); + failed+= strcollsp(&my_charset_ucs2_general_ci, strcoll_ucs2_space); + failed+= strcollsp(&my_charset_ucs2_bin, strcoll_ucs2_common); + failed+= strcollsp(&my_charset_ucs2_bin, strcoll_ucs2_space); +#endif +#ifdef HAVE_CHARSET_ujis + failed+= strcollsp(&my_charset_ujis_japanese_ci, strcoll_mb2_common); + failed+= strcollsp(&my_charset_ujis_bin, strcoll_mb2_common); + failed+= strcollsp(&my_charset_ujis_japanese_ci, strcoll_mb2_A1A1_mb2_F9FE); + failed+= strcollsp(&my_charset_ujis_bin, strcoll_mb2_A1A1_mb2_F9FE); + failed+= strcollsp(&my_charset_ujis_japanese_ci, strcoll_ujis); + failed+= strcollsp(&my_charset_ujis_bin, strcoll_ujis); +#endif +#ifdef HAVE_CHARSET_utf16 + failed+= strcollsp(&my_charset_utf16_general_ci, strcoll_ucs2_common); + failed+= strcollsp(&my_charset_utf16_general_ci, strcoll_ucs2_space); + failed+= strcollsp(&my_charset_utf16_general_ci, strcoll_utf16_common); + failed+= strcollsp(&my_charset_utf16_general_ci, strcoll_utf16_general_ci); + failed+= strcollsp(&my_charset_utf16_bin, strcoll_ucs2_common); + failed+= strcollsp(&my_charset_utf16_bin, strcoll_ucs2_space); + failed+= strcollsp(&my_charset_utf16_bin, strcoll_utf16_common); + + failed+= strcollsp(&my_charset_utf16le_general_ci,strcoll_ucs2_common); + failed+= strcollsp(&my_charset_utf16le_general_ci,strcoll_utf16le_space); + failed+= strcollsp(&my_charset_utf16le_general_ci,strcoll_utf16le_common); + failed+= strcollsp(&my_charset_utf16le_general_ci,strcoll_utf16le_general_ci); + failed+= strcollsp(&my_charset_utf16le_bin, strcoll_ucs2_common); + failed+= strcollsp(&my_charset_utf16le_bin, strcoll_utf16le_space); + failed+= strcollsp(&my_charset_utf16le_bin, strcoll_utf16le_common); +#endif +#ifdef HAVE_CHARSET_utf32 + failed+= strcollsp(&my_charset_utf32_general_ci, strcoll_utf32_common); + failed+= strcollsp(&my_charset_utf32_general_ci, strcoll_utf32_general_ci); + failed+= strcollsp(&my_charset_utf32_bin, strcoll_utf32_common); +#endif +#ifdef HAVE_CHARSET_utf8 + failed+= strcollsp(&my_charset_utf8_general_ci, strcoll_utf8mb3_common); + failed+= strcollsp(&my_charset_utf8_general_mysql500_ci, strcoll_utf8mb3_common); + failed+= strcollsp(&my_charset_utf8_bin, strcoll_utf8mb3_common); +#endif +#ifdef HAVE_CHARSET_utf8mb4 + failed+= strcollsp(&my_charset_utf8mb4_general_ci, strcoll_utf8mb3_common); + failed+= strcollsp(&my_charset_utf8mb4_bin, strcoll_utf8mb3_common); + failed+= strcollsp(&my_charset_utf8mb4_general_ci, strcoll_utf8mb4_common); + failed+= strcollsp(&my_charset_utf8mb4_general_ci, strcoll_utf8mb4_general_ci); + failed+= strcollsp(&my_charset_utf8mb4_bin, strcoll_utf8mb4_common); +#endif return failed; } |