初版
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
# This test case verifies that the mysqlbinlog --base64-output=X flags
|
||||
# work as expected, and that BINLOG statements with row events fail if
|
||||
# they are not preceded by BINLOG statements with Format description
|
||||
# events.
|
||||
#
|
||||
# See also BUG#32407.
|
||||
|
||||
|
||||
# BINLOG statement does not work in embedded mode.
|
||||
source include/not_embedded.inc;
|
||||
|
||||
disable_warnings;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
enable_warnings;
|
||||
|
||||
# Test to show BUG#32407. This reads a binlog created with the
|
||||
# mysql-5.1-telco-6.1 tree, specifically at the tag
|
||||
# mysql-5.1.15-ndb-6.1.23, and applies it to the database. The test
|
||||
# should fail before BUG#32407 was fixed and succeed afterwards.
|
||||
--echo ==== Test BUG#32407 ====
|
||||
|
||||
# The binlog contains row events equivalent to:
|
||||
# CREATE TABLE t1 (a int) engine = myisam
|
||||
# INSERT INTO t1 VALUES (1), (1)
|
||||
exec $MYSQL_BINLOG suite/binlog/std_data/bug32407.001 | $MYSQL;
|
||||
# The above line should succeed and t1 should contain two ones
|
||||
select * from t1;
|
||||
|
||||
|
||||
# Test that a BINLOG statement encoding a row event fails unless a
|
||||
# Format_description_event as been supplied with an earlier BINLOG
|
||||
# statement.
|
||||
--echo ==== Test BINLOG statement w/o FD event ====
|
||||
|
||||
# This is a binlog statement consisting of one Table_map_log_event and
|
||||
# one Write_rows_log_event. Together, they correspond to the
|
||||
# following query:
|
||||
# INSERT INTO TABLE test.t1 VALUES (2)
|
||||
|
||||
error ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT;
|
||||
BINLOG '
|
||||
SVtYRxMBAAAAKQAAADQBAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
|
||||
SVtYRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf/+AgAAAA==
|
||||
';
|
||||
# The above line should fail and 2 should not be in the table
|
||||
select * from t1;
|
||||
|
||||
|
||||
# Test that it works to read a Format_description_log_event with a
|
||||
# BINLOG statement, followed by a row-event in base64 from the same
|
||||
# version.
|
||||
--echo ==== Test BINLOG statement with FD event ====
|
||||
|
||||
# This is a binlog statement containing a Format_description_log_event
|
||||
# from the same version as the Table_map and Write_rows_log_event.
|
||||
BINLOG '
|
||||
ODdYRw8BAAAAZgAAAGoAAAABAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAA4N1hHEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
|
||||
';
|
||||
|
||||
# This is a Table_map_log_event+Write_rows_log_event corresponding to:
|
||||
# INSERT INTO TABLE test.t1 VALUES (3)
|
||||
BINLOG '
|
||||
TFtYRxMBAAAAKQAAAH8BAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
|
||||
TFtYRxcBAAAAIgAAAKEBAAAQABAAAAAAAAEAAf/+AwAAAA==
|
||||
';
|
||||
# The above line should succeed and 3 should be in the table
|
||||
select * from t1;
|
||||
|
||||
|
||||
# Test that mysqlbinlog stops with an error message when the
|
||||
# --base64-output=never flag is used on a binlog with base64 events.
|
||||
--echo ==== Test --base64-output=never on a binlog with row events ====
|
||||
|
||||
# mysqlbinlog should fail
|
||||
--replace_regex /#[0-9][0-9][0-9][0-9][0-9][0-9] .*/<#>/ /SET \@\@session.pseudo_thread_id.*/<#>/
|
||||
error 1;
|
||||
exec $MYSQL_BINLOG --base64-output=never suite/binlog/std_data/bug32407.001;
|
||||
# the above line should output the query log event and then stop
|
||||
|
||||
|
||||
# Test that the following fails cleanly: "First, read a
|
||||
# Format_description event which has N event types. Then, read an
|
||||
# event of type M>N"
|
||||
--echo ==== Test non-matching FD event and Row event ====
|
||||
|
||||
# This is the Format_description_log_event from
|
||||
# bug32407.001, encoded in base64. It contains only the old
|
||||
# row events (number of event types is 22)
|
||||
BINLOG '
|
||||
4CdYRw8BAAAAYgAAAGYAAAAAAAQANS4xLjE1LW5kYi02LjEuMjQtZGVidWctbG9nAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAADgJ1hHEzgNAAgAEgAEBAQEEgAATwAEGggICAg=
|
||||
';
|
||||
|
||||
# The following is a Write_rows_log_event with event type 23, i.e.,
|
||||
# not supported by the Format_description_log_event above. It
|
||||
# corresponds to the following query:
|
||||
# INSERT INTO t1 VALUES (5)
|
||||
error 1149;
|
||||
BINLOG '
|
||||
Dl1YRxMBAAAAKQAAADQBAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
|
||||
Dl1YRxcBAAAAIgAAAFYBAAAQABAAAAAAAAEAAf/+BQAAAA==
|
||||
';
|
||||
# the above line should fail and 5 should not be in the binlog.
|
||||
select * from t1;
|
||||
|
||||
# Test that BUG#37426 is triggered.
|
||||
|
||||
CREATE TABLE char128_utf8 (
|
||||
i1 INT NOT NULL,
|
||||
c CHAR(128) CHARACTER SET utf8 NOT NULL,
|
||||
i2 INT NOT NULL);
|
||||
CREATE TABLE char63_utf8 (
|
||||
i1 INT NOT NULL,
|
||||
c CHAR(63) CHARACTER SET utf8 NOT NULL,
|
||||
i2 INT NOT NULL);
|
||||
|
||||
#
|
||||
# This is the format description log event
|
||||
#
|
||||
|
||||
BINLOG '
|
||||
MuNkSA8BAAAAZgAAAGoAAAAAAAQANS4xLjI1LXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAy42RIEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
|
||||
';
|
||||
|
||||
# ... this event corresponding to
|
||||
#
|
||||
# INSERT INTO char63_utf8 VALUES ( 1, "123", 1 )
|
||||
#
|
||||
# The binlog event below shall not trigger the bug check
|
||||
|
||||
BINLOG '
|
||||
3u9kSBMBAAAANgAAAJYBAAAAABAAAAAAAAAABHRlc3QAC2NoYXI2M191dGY4AAMD/gMC/r0A
|
||||
3u9kSBcBAAAAKgAAAMABAAAQABAAAAAAAAEAA//4AQAAAAMxMjMBAAAA
|
||||
';
|
||||
SELECT * FROM char63_utf8;
|
||||
|
||||
# ... and this is an event corresponding to
|
||||
#
|
||||
# INSERT INTO char128_utf8 VALUES ( 1, "123", 1 )
|
||||
#
|
||||
# The binlog event below shall trigger the bug check and produce an error
|
||||
#
|
||||
|
||||
error ER_UNKNOWN_ERROR;
|
||||
BINLOG '
|
||||
iONkSBMBAAAANwAAAJkBAAAAABAAAAAAAAAABHRlc3QADGNoYXIxMjhfdXRmOAADA/4DAv6AAA==
|
||||
iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
|
||||
';
|
||||
|
||||
drop table t1, char63_utf8, char128_utf8;
|
||||
|
||||
call mtr.add_suppression("Slave SQL.*master suffers from this bug: http:..bugs.mysql.com.bug.php.id=37426.* Error_code: 1105");
|
||||
call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
|
||||
|
||||
--echo #
|
||||
--echo # Bug #54393: crash and/or valgrind errors in
|
||||
--echo # mysql_client_binlog_statement
|
||||
--echo #
|
||||
--error ER_SYNTAX_ERROR
|
||||
BINLOG '';
|
||||
BINLOG '123';
|
||||
--error ER_SYNTAX_ERROR
|
||||
BINLOG '-2079193929';
|
||||
--error ER_SYNTAX_ERROR
|
||||
BINLOG 'xç↓%~∙D╒ƒ╡';
|
||||
@@ -0,0 +1,50 @@
|
||||
#############################################################
|
||||
# Bug#23533: CREATE SELECT max_binlog_cache_size test
|
||||
# case needed
|
||||
#############################################################
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_log_bin.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
|
||||
SET AUTOCOMMIT=0;
|
||||
|
||||
# Create 1st table
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b TEXT, PRIMARY KEY(a)) ENGINE=InnoDB;
|
||||
--disable_query_log
|
||||
let $i= 1000;
|
||||
while ($i)
|
||||
{
|
||||
BEGIN;
|
||||
eval INSERT INTO t1 VALUES($i, REPEAT('x', 4096));
|
||||
COMMIT;
|
||||
dec $i;
|
||||
}
|
||||
--enable_query_log
|
||||
SELECT COUNT(*) FROM t1;
|
||||
|
||||
# Set small value for max_binlog_cache_size
|
||||
let $saved_binlog_cache_size= query_get_value(SELECT @@binlog_cache_size AS Value, Value, 1);
|
||||
let $saved_max_binlog_cache_size= query_get_value(SELECT @@max_binlog_cache_size AS Value, Value, 1);
|
||||
SET GLOBAL binlog_cache_size=4096;
|
||||
SET GLOBAL max_binlog_cache_size=4096;
|
||||
|
||||
# New value of max_binlog_cache_size will apply to new session
|
||||
disconnect default;
|
||||
connect(default,localhost,root,,test);
|
||||
|
||||
# Copied data from t1 into t2 large than max_binlog_cache_size
|
||||
START TRANSACTION;
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
COMMIT;
|
||||
SHOW TABLES LIKE 't%';
|
||||
|
||||
# 5.1 End of Test
|
||||
--disable_query_log
|
||||
eval SET GLOBAL max_binlog_cache_size=$saved_max_binlog_cache_size;
|
||||
eval SET GLOBAL binlog_cache_size=$saved_binlog_cache_size;
|
||||
--enable_query_log
|
||||
DROP TABLE t1;
|
||||
disconnect default;
|
||||
connect(default,localhost,root,,test);
|
||||
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# BUG#36391 and BUG#38731
|
||||
#
|
||||
# The fix for BUG#20103 "Escaping with backslash does not work as expected"
|
||||
# was implemented too greedy though in that it not only changes the behavior
|
||||
# of backslashes within strings but in general, so disabling command shortcuts
|
||||
# like \G or \C (which in turn leads to BUG#36391: "mysqlbinlog creates invalid charset statements".
|
||||
#
|
||||
# The test executes simple commands that are stored in the binary log and
|
||||
# re-execute them through the mysql client which should have to process
|
||||
# some command shortcuts. The backslashes within strings is disabled in the file
|
||||
# rpl_bug36391-master.opt by the option --sql_mode=NO_BACKSLASH_ESCAPES.
|
||||
#
|
||||
#
|
||||
|
||||
--source include/have_log_bin.inc
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
|
||||
CREATE TABLE t1(id INT);
|
||||
let $binlog= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
let $binlog_path= `SELECT CONCAT(@@DATADIR, '$binlog')`;
|
||||
SHOW TABLES;
|
||||
FLUSH LOGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--exec $MYSQL_BINLOG $binlog_path | $MYSQL test
|
||||
SHOW TABLES;
|
||||
|
||||
# Clean up
|
||||
DROP TABLE t1;
|
||||
@@ -0,0 +1,12 @@
|
||||
# A wrapper to test that dropping a database is binlogged
|
||||
# correctly. We test all three modes in the same file to avoid
|
||||
# unecessary server restarts.
|
||||
|
||||
set binlog_format=statement;
|
||||
source extra/binlog_tests/database.test;
|
||||
set binlog_format=mixed;
|
||||
source extra/binlog_tests/database.test;
|
||||
set binlog_format=row;
|
||||
source extra/binlog_tests/database.test;
|
||||
|
||||
show databases;
|
||||
@@ -0,0 +1,114 @@
|
||||
# BUG#34582: FLUSH LOGS does not close and reopen the binlog index
|
||||
# file
|
||||
#
|
||||
# WHAT
|
||||
# ====
|
||||
#
|
||||
# We want to test that FLUSH LOGS closes and reopens binlog index
|
||||
# file.
|
||||
#
|
||||
# HOW
|
||||
# ===
|
||||
#
|
||||
# PREPARE:
|
||||
# 1. create some binlog events
|
||||
# 2. show index content, binlog events and binlog contents
|
||||
# for mysql-bin.000001
|
||||
# 3. copy the mysql-bin.000001 to mysql-bin-b34582.000001
|
||||
# 4. change the index file so that mysql-bin.000001 is replaced
|
||||
# with mysql-bin-b34582.000001
|
||||
# 5. FLUSH the logs so that new index is closed and reopened
|
||||
#
|
||||
# ASSERTIONS:
|
||||
# 1. index file contents shows mysql-bin-b34582.000001 and
|
||||
# mysql-bin.000002
|
||||
# 1. show binary logs shows current index entries
|
||||
# 2. binlog contents for mysql-bin-b34582.000001 are displayed
|
||||
# 3. Purge binlogs up to the latest one succeeds
|
||||
# 4. SHOW BINARY LOGS presents the latest one only after purging
|
||||
# 5. Purged binlogs files don't exist in the filesystem
|
||||
# 6. Not purged binlog file exists in the filesystem
|
||||
#
|
||||
# CLEAN UP:
|
||||
# 1. RESET MASTER
|
||||
#
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
-- let $datadir= `SELECT @@datadir`
|
||||
-- let $index=$datadir/master-bin.index
|
||||
-- chmod 0644 $index
|
||||
|
||||
# action: issue one command so that binlog gets some event
|
||||
CREATE TABLE t1 (a int);
|
||||
|
||||
-- echo ### assertion: index file contains regular entries
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--echo ### assertion: show original binlogs
|
||||
-- source include/show_binary_logs.inc
|
||||
|
||||
--echo ### assertion: binlog contents from regular entries
|
||||
-- source include/show_binlog_events.inc
|
||||
|
||||
# action: copy binlogs to other names and change entries in index file
|
||||
-- copy_file $datadir/master-bin.000001 $datadir/master-bin-b34582.000001
|
||||
let INDEX_FILE=$index;
|
||||
perl;
|
||||
$file= $ENV{'INDEX_FILE'};
|
||||
open(FILE, ">$file") || die "Unable to open $file.";
|
||||
truncate(FILE,0);
|
||||
close ($file);
|
||||
EOF
|
||||
|
||||
-- append_file $index
|
||||
master-bin-b34582.000001
|
||||
EOF
|
||||
|
||||
# action: should cause rotation, and creation of new binlogs
|
||||
FLUSH LOGS;
|
||||
|
||||
# file is not used anymore - remove it (mysql closed on flush logs).
|
||||
-- remove_file $datadir/master-bin.000001
|
||||
|
||||
-- echo ### assertion: index file contains renamed binlog and the new one
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
-- echo ### assertion: original binlog content still exists, despite we
|
||||
-- echo ### renamed and changed the index file
|
||||
-- source include/show_binlog_events.inc
|
||||
|
||||
-- echo ### assertion: user changed binlog index shows correct entries
|
||||
-- source include/show_binary_logs.inc
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo ### assertion: purging binlogs up to binlog created after instrumenting index file should work
|
||||
-- let $current_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
-- eval PURGE BINARY LOGS TO '$current_binlog'
|
||||
|
||||
-- echo ### assertion: show binary logs should only contain latest binlog
|
||||
-- source include/show_binary_logs.inc
|
||||
|
||||
-- echo ### assertion: assert that binlog files were indeed purged (using file_exists calls)
|
||||
-- error 1
|
||||
-- file_exists $datadir/master-bin-b34852.000001
|
||||
|
||||
-- echo ### assertion: assert that not purged binlog file exists
|
||||
-- file_exists $datadir/$current_binlog
|
||||
|
||||
-- echo ### assertion: show index file contents and these should match show binary logs issued above
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
RESET MASTER;
|
||||
@@ -0,0 +1,115 @@
|
||||
# BUG#13684:
|
||||
# SP: DROP PROCEDURE|FUNCTION IF EXISTS not binlogged if routine
|
||||
# does not exist
|
||||
#
|
||||
# There is an inconsistency with DROP DATABASE IF EXISTS, DROP
|
||||
# TABLE IF EXISTS and DROP VIEW IF EXISTS: those are binlogged even
|
||||
# if the DB or TABLE does not exist, whereas DROP PROCEDURE IF
|
||||
# EXISTS does not. It would be nice or at least consistent if DROP
|
||||
# PROCEDURE/STATEMENT worked the same too.
|
||||
#
|
||||
# Description:
|
||||
# DROP PROCEDURE|FUNCTION IF EXISTS does not get binlogged whereas DROP
|
||||
# DATABASE|TABLE|TRIGGER|... IF EXISTS do.
|
||||
#
|
||||
# Fixed DROP PROCEDURE|FUNCTION IF EXISTS by adding a call to
|
||||
# write_bin_log in mysql_execute_command. Checked also if all
|
||||
# documented "DROP (...) IF EXISTS" get binlogged. Left out DROP
|
||||
# SERVER IF EXISTS because it seems that it only gets binlogged when
|
||||
# using row event (see BUG#25705).
|
||||
#
|
||||
# TODO: add DROP SERVER IF EXISTS to the test case when its
|
||||
# binlogging procedure gets fixed (BUG#25705). Furthermore, when
|
||||
# logging in RBR format the events that get logged are effectively in
|
||||
# RBR format and not in STATEMENT format meaning that one must needs
|
||||
# to be extra careful when writing a test for it, or change the CREATE
|
||||
# SERVER logging to always log as STATEMENT. You can quickly check this
|
||||
# by enabling the flag below $fixed_bug_25705=1 and watch the diff on
|
||||
# the STDOUT. More detail may be found on the generated reject file.
|
||||
#
|
||||
# Test is implemented as follows:
|
||||
#
|
||||
# i) test each "drop if exists" (DDL), found in MySQL 5.1 manual,
|
||||
# on inexistent objects (except for DROP SERVER);
|
||||
# ii) show binlog events;
|
||||
# iii) create an object for each drop if exists statement;
|
||||
# iv) issue "drop if exists" in existent objects.
|
||||
# v) show binlog events;
|
||||
#
|
||||
# References:
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html
|
||||
#
|
||||
--source include/have_log_bin.inc
|
||||
RESET MASTER;
|
||||
|
||||
disable_warnings;
|
||||
|
||||
# test all "drop if exists" in manual with inexistent objects
|
||||
DROP PROCEDURE IF EXISTS db_bug_13684.p;
|
||||
DROP FUNCTION IF EXISTS db_bug_13684.f;
|
||||
DROP TRIGGER IF EXISTS db_bug_13684.tr;
|
||||
DROP VIEW IF EXISTS db_bug_13684.v;
|
||||
DROP EVENT IF EXISTS db_bug_13684.e;
|
||||
DROP TABLE IF EXISTS db_bug_13684.t;
|
||||
DROP DATABASE IF EXISTS db_bug_13684;
|
||||
|
||||
let $fixed_bug_25705 = 0;
|
||||
|
||||
if($fixed_bug_25705)
|
||||
{
|
||||
DROP SERVER IF EXISTS s_bug_13684;
|
||||
}
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
# test drop with existing values
|
||||
|
||||
# create
|
||||
CREATE DATABASE db_bug_13684;
|
||||
|
||||
CREATE TABLE db_bug_13684.t (a int);
|
||||
|
||||
CREATE EVENT db_bug_13684.e
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
|
||||
DO
|
||||
UPDATE db_bug_13684.t SET a = a + 1;
|
||||
|
||||
CREATE VIEW db_bug_13684.v
|
||||
AS SELECT * FROM db_bug_13684.t;
|
||||
|
||||
CREATE TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t
|
||||
FOR EACH ROW BEGIN
|
||||
END;
|
||||
|
||||
CREATE PROCEDURE db_bug_13684.p (OUT p1 INT)
|
||||
BEGIN
|
||||
END;
|
||||
|
||||
CREATE FUNCTION db_bug_13684.f (s CHAR(20))
|
||||
RETURNS CHAR(50) DETERMINISTIC
|
||||
RETURN s;
|
||||
|
||||
if($fixed_bug_25705)
|
||||
{
|
||||
CREATE SERVER s_bug_13684
|
||||
FOREIGN DATA WRAPPER mysql
|
||||
OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test');
|
||||
}
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
# drop existing
|
||||
DROP PROCEDURE IF EXISTS db_bug_13684.p;
|
||||
DROP FUNCTION IF EXISTS db_bug_13684.f;
|
||||
DROP TRIGGER IF EXISTS db_bug_13684.tr;
|
||||
DROP VIEW IF EXISTS db_bug_13684.v;
|
||||
DROP EVENT IF EXISTS db_bug_13684.e;
|
||||
DROP TABLE IF EXISTS db_bug_13684.t;
|
||||
DROP DATABASE IF EXISTS db_bug_13684;
|
||||
if($fixed_bug_25705)
|
||||
{
|
||||
DROP SERVER IF EXISTS s_bug_13684;
|
||||
}
|
||||
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
enable_warnings;
|
||||
79
build/lib/mysql/mysql-test/suite/binlog/t/binlog_grant.test
Normal file
79
build/lib/mysql/mysql-test/suite/binlog/t/binlog_grant.test
Normal file
@@ -0,0 +1,79 @@
|
||||
# Test grants for various objects (especially variables) related to
|
||||
# the binary log
|
||||
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
connection default;
|
||||
--disable_warnings
|
||||
reset master;
|
||||
--enable_warnings
|
||||
|
||||
set @saved_binlog_format = @@global.binlog_format;
|
||||
create user mysqltest_1@localhost;
|
||||
show grants for mysqltest_1@localhost;
|
||||
|
||||
connect (plain,localhost,mysqltest_1,,test);
|
||||
connect (root,localhost,root,,test);
|
||||
|
||||
# Testing setting both session and global SQL_LOG_BIN variable both as
|
||||
# root and as plain user.
|
||||
|
||||
--echo **** Variable SQL_LOG_BIN ****
|
||||
|
||||
connection root;
|
||||
--echo [root]
|
||||
--error ER_LOCAL_VARIABLE
|
||||
set global sql_log_bin = 1;
|
||||
set session sql_log_bin = 1;
|
||||
|
||||
connection plain;
|
||||
--echo [plain]
|
||||
--error ER_LOCAL_VARIABLE
|
||||
set global sql_log_bin = 1;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
set session sql_log_bin = 1;
|
||||
|
||||
|
||||
# Testing setting both session and global BINLOG_FORMAT variable both
|
||||
# as root and as plain user.
|
||||
|
||||
--echo **** Variable BINLOG_FORMAT ****
|
||||
|
||||
connection root;
|
||||
--echo [root]
|
||||
set global binlog_format = row;
|
||||
set session binlog_format = row;
|
||||
|
||||
connection plain;
|
||||
--echo [plain]
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
set global binlog_format = row;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
set session binlog_format = row;
|
||||
|
||||
--echo **** Clean up ****
|
||||
disconnect plain;
|
||||
disconnect root;
|
||||
|
||||
connection default;
|
||||
set global binlog_format = @saved_binlog_format;
|
||||
drop user mysqltest_1@localhost;
|
||||
|
||||
|
||||
# Testing if REPLICATION CLIENT privilege is enough to execute
|
||||
# SHOW MASTER LOGS and SHOW BINARY.
|
||||
GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
|
||||
--connect(rpl,localhost,mysqltest_1,,)
|
||||
|
||||
--connection rpl
|
||||
# We are only interested if the following commands succeed and not on
|
||||
# their output.
|
||||
--disable_result_log
|
||||
SHOW MASTER LOGS;
|
||||
SHOW BINARY LOGS;
|
||||
--enable_result_log
|
||||
|
||||
# clean up
|
||||
--disconnect rpl
|
||||
connection default;
|
||||
DROP USER 'mysqltest_1'@'localhost';
|
||||
@@ -0,0 +1,28 @@
|
||||
# The purpose of this test is to provide a reference for how the
|
||||
# incident log event is represented in the output from the mysqlbinlog
|
||||
# program.
|
||||
|
||||
source include/have_log_bin.inc;
|
||||
source include/have_debug.inc;
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
RESET MASTER;
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SELECT * FROM t1;
|
||||
|
||||
# This will generate an incident log event and store it in the binary
|
||||
# log before the replace statement.
|
||||
REPLACE INTO t1 VALUES (4);
|
||||
|
||||
DROP TABLE t1;
|
||||
FLUSH LOGS;
|
||||
|
||||
exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
|
||||
--disable_query_log
|
||||
eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl;
|
||||
--enable_query_log
|
||||
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
|
||||
263
build/lib/mysql/mysql-test/suite/binlog/t/binlog_index.test
Normal file
263
build/lib/mysql/mysql-test/suite/binlog/t/binlog_index.test
Normal file
@@ -0,0 +1,263 @@
|
||||
#
|
||||
# testing of purging of binary log files bug#18199/Bug#18453
|
||||
#
|
||||
source include/have_log_bin.inc;
|
||||
source include/not_embedded.inc;
|
||||
# Don't test this under valgrind, memory leaks will occur
|
||||
--source include/not_valgrind.inc
|
||||
source include/have_debug.inc;
|
||||
# Avoid CrashReporter popup on Mac
|
||||
--source include/not_crashrep.inc
|
||||
call mtr.add_suppression('Attempting backtrace');
|
||||
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
|
||||
call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file');
|
||||
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.');
|
||||
call mtr.add_suppression('Could not open .*');
|
||||
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
|
||||
let $old=`select @@debug`;
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
let $INDEX=$MYSQLD_DATADIR/master-bin.index;
|
||||
|
||||
#
|
||||
# testing purge binary logs TO
|
||||
#
|
||||
|
||||
flush logs;
|
||||
flush logs;
|
||||
flush logs;
|
||||
|
||||
source include/show_binary_logs.inc;
|
||||
remove_file $MYSQLD_DATADIR/master-bin.000001;
|
||||
|
||||
# there must be a warning with file names
|
||||
replace_regex /\.[\\\/]master/master/;
|
||||
purge binary logs TO 'master-bin.000004';
|
||||
|
||||
--echo *** must show a list starting from the 'TO' argument of PURGE ***
|
||||
source include/show_binary_logs.inc;
|
||||
|
||||
#
|
||||
# testing purge binary logs BEFORE
|
||||
#
|
||||
|
||||
reset master;
|
||||
|
||||
flush logs;
|
||||
flush logs;
|
||||
flush logs;
|
||||
remove_file $MYSQLD_DATADIR/master-bin.000001;
|
||||
|
||||
--echo *** must be a warning master-bin.000001 was not found ***
|
||||
let $date=`select NOW() + INTERVAL 1 MINUTE`;
|
||||
--disable_query_log
|
||||
replace_regex /\.[\\\/]master/master/;
|
||||
eval purge binary logs BEFORE '$date';
|
||||
--enable_query_log
|
||||
|
||||
--echo *** must show one record, of the active binlog, left in the index file after PURGE ***
|
||||
source include/show_binary_logs.inc;
|
||||
|
||||
#
|
||||
# testing a fatal error
|
||||
# Turning a binlog file into a directory must be a portable setup
|
||||
#
|
||||
|
||||
reset master;
|
||||
|
||||
flush logs;
|
||||
flush logs;
|
||||
flush logs;
|
||||
|
||||
remove_file $MYSQLD_DATADIR/master-bin.000001;
|
||||
mkdir $MYSQLD_DATADIR/master-bin.000001;
|
||||
|
||||
--error ER_BINLOG_PURGE_FATAL_ERR
|
||||
purge binary logs TO 'master-bin.000002';
|
||||
replace_regex /\.[\\\/]master/master/;
|
||||
show warnings;
|
||||
rmdir $MYSQLD_DATADIR/master-bin.000001;
|
||||
--disable_warnings
|
||||
reset master;
|
||||
--enable_warnings
|
||||
|
||||
--echo # crash_purge_before_update_index
|
||||
flush logs;
|
||||
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
SET SESSION debug="+d,crash_purge_before_update_index";
|
||||
--error 2013
|
||||
purge binary logs TO 'master-bin.000002';
|
||||
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000001;
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000002;
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000003;
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--echo # crash_purge_non_critical_after_update_index
|
||||
flush logs;
|
||||
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
SET SESSION debug="+d,crash_purge_non_critical_after_update_index";
|
||||
--error 2013
|
||||
purge binary logs TO 'master-bin.000004';
|
||||
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
--error 1
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000001;
|
||||
--error 1
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000002;
|
||||
--error 1
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000003;
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--echo # crash_purge_critical_after_update_index
|
||||
flush logs;
|
||||
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
SET SESSION debug="+d,crash_purge_critical_after_update_index";
|
||||
--error 2013
|
||||
purge binary logs TO 'master-bin.000006';
|
||||
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
--error 1
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000004;
|
||||
--error 1
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000005;
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000006;
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000007;
|
||||
--error 1
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000008;
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--echo # crash_create_non_critical_before_update_index
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
SET SESSION debug="+d,crash_create_non_critical_before_update_index";
|
||||
--error 2013
|
||||
flush logs;
|
||||
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000008;
|
||||
--error 1
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000009;
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--echo # crash_create_critical_before_update_index
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
SET SESSION debug="+d,crash_create_critical_before_update_index";
|
||||
--error 2013
|
||||
flush logs;
|
||||
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000009;
|
||||
--error 1
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000010;
|
||||
--error 1
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000011;
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--echo # crash_create_after_update_index
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
SET SESSION debug="+d,crash_create_after_update_index";
|
||||
--error 2013
|
||||
flush logs;
|
||||
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000010;
|
||||
file_exists $MYSQLD_DATADIR/master-bin.000011;
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--echo #
|
||||
--echo # This should put the server in unsafe state and stop
|
||||
--echo # accepting any command. If we inject a fault at this
|
||||
--echo # point and continue the execution the server crashes.
|
||||
--echo #
|
||||
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--echo # fault_injection_registering_index
|
||||
SET SESSION debug="+d,fault_injection_registering_index";
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
-- error ER_CANT_OPEN_FILE
|
||||
flush logs;
|
||||
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--echo # fault_injection_updating_index
|
||||
SET SESSION debug="+d,fault_injection_updating_index";
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
-- error ER_CANT_OPEN_FILE
|
||||
flush logs;
|
||||
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
--chmod 0644 $INDEX
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @index=LOAD_FILE('$index')
|
||||
-- replace_regex /\.[\\\/]master/master/
|
||||
SELECT @index;
|
||||
|
||||
eval SET SESSION debug="$old";
|
||||
|
||||
--echo End of tests
|
||||
175
build/lib/mysql/mysql-test/suite/binlog/t/binlog_innodb.test
Normal file
175
build/lib/mysql/mysql-test/suite/binlog/t/binlog_innodb.test
Normal file
@@ -0,0 +1,175 @@
|
||||
source include/have_innodb.inc;
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
SET BINLOG_FORMAT=MIXED;
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=INNODB;
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
# Should be logged as statement
|
||||
UPDATE t1 SET b = 2*a WHERE a > 1;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
# Should be logged as rows
|
||||
UPDATE t1 SET b = a * a WHERE a > 3;
|
||||
COMMIT;
|
||||
|
||||
# Check that errors are generated when trying to use READ COMMITTED
|
||||
# transaction isolation level in STATEMENT binlog mode.
|
||||
|
||||
SET BINLOG_FORMAT=STATEMENT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1 SET b = 1*a WHERE a > 1;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1 SET b = 2*a WHERE a > 2;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
UPDATE t1 SET b = 3*a WHERE a > 3;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
UPDATE t1 SET b = 4*a WHERE a > 4;
|
||||
COMMIT;
|
||||
|
||||
SET BINLOG_FORMAT=MIXED;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
UPDATE t1 SET b = 1*a WHERE a > 1;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
UPDATE t1 SET b = 2*a WHERE a > 2;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
UPDATE t1 SET b = 3*a WHERE a > 3;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
UPDATE t1 SET b = 4*a WHERE a > 4;
|
||||
COMMIT;
|
||||
|
||||
SET BINLOG_FORMAT=ROW;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
UPDATE t1 SET b = 1*a WHERE a > 1;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
UPDATE t1 SET b = 2*a WHERE a > 2;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
UPDATE t1 SET b = 3*a WHERE a > 3;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
UPDATE t1 SET b = 4*a WHERE a > 4;
|
||||
COMMIT;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
|
||||
# Actually this test has nothing to do with innodb per se, it just requires
|
||||
# transactional table.
|
||||
#
|
||||
flush status;
|
||||
show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
|
||||
create table t1 (a int) engine=innodb;
|
||||
|
||||
# Now we are going to create transaction which is long enough so its
|
||||
# transaction binlog will be flushed to disk...
|
||||
let $1=2000;
|
||||
disable_query_log;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values( $1 );
|
||||
dec $1;
|
||||
}
|
||||
commit;
|
||||
enable_query_log;
|
||||
show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
|
||||
# Transaction which should not be flushed to disk and so should not
|
||||
# increase binlog_cache_disk_use.
|
||||
begin;
|
||||
delete from t1;
|
||||
commit;
|
||||
show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#27716 multi-update did partially and has not binlogged
|
||||
#
|
||||
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL auto_increment,
|
||||
`b` int(11) default NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) NOT NULL auto_increment,
|
||||
`b` int(11) default NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
|
||||
|
||||
# A. testing multi_update::send_eof() execution branch
|
||||
insert into t1 values (1,1),(2,2);
|
||||
insert into t2 values (1,1),(4,4);
|
||||
reset master;
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t2,t1 SET t2.a=t1.a+2;
|
||||
# check
|
||||
select * from t2 /* must be (3,1), (4,4) */;
|
||||
--echo # There must no UPDATE in binlog;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# B. testing multi_update::send_error() execution branch
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t1 values (1,2),(3,4),(4,4);
|
||||
insert into t2 values (1,2),(3,4),(4,4);
|
||||
reset master;
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
|
||||
--echo # There must be no UPDATE query event;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# cleanup bug#27716
|
||||
drop table t1, t2;
|
||||
|
||||
--echo End of tests
|
||||
@@ -0,0 +1,79 @@
|
||||
#
|
||||
# Tests of innodb/binlog with the row binlog format
|
||||
#
|
||||
source include/have_innodb.inc;
|
||||
source include/have_log_bin.inc;
|
||||
source include/have_binlog_format_row.inc;
|
||||
|
||||
#
|
||||
# Bug #40221 Replication failure on RBR + UPDATE the primary key
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (i int unique) ENGINE=innodb;
|
||||
reset master;
|
||||
|
||||
# part 1: update can cause the dup key
|
||||
|
||||
begin;
|
||||
insert into t1 values (1),(2);
|
||||
--echo *** the following UPDATE query wont generate any updates for the binlog ***
|
||||
--error ER_DUP_ENTRY
|
||||
update t1 set i = 3 where i < 3;
|
||||
commit;
|
||||
|
||||
--echo *** Results of the test: the binlog must have only Write_rows events not any Update_rows ***
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# part 2: insert can cause the dup key
|
||||
|
||||
delete from t1;
|
||||
reset master;
|
||||
|
||||
begin;
|
||||
insert into t1 values (1),(2);
|
||||
--echo *** the following UPDATE query wont generate any updates for the binlog ***
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 values (3),(4),(1),(2);
|
||||
commit;
|
||||
|
||||
--echo *** Results of the test: the binlog must have only one Write_rows event not two ***
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#51251
|
||||
#
|
||||
# The test case checks if truncating a temporary table created with
|
||||
# engine InnoDB will not cause the truncate statement to be binlogged.
|
||||
|
||||
# Before patch for BUG#51251, the TRUNCATE statements below would be
|
||||
# binlogged, which would cause the slave to fail with "table does not
|
||||
# exist".
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS t2 LIKE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo ###############################################
|
||||
-- echo ### assertion: No event for 'TRUNCATE TABLE t2'
|
||||
-- echo ###############################################
|
||||
-- source include/show_binlog_events.inc
|
||||
-- echo ###############################################
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
TRUNCATE t1;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
|
||||
-- echo ###############################################
|
||||
-- echo ### assertion: No event for 'TRUNCATE TABLE t1'
|
||||
-- echo ###############################################
|
||||
-- source include/show_binlog_events.inc
|
||||
-- echo ###############################################
|
||||
343
build/lib/mysql/mysql-test/suite/binlog/t/binlog_killed.test
Normal file
343
build/lib/mysql/mysql-test/suite/binlog/t/binlog_killed.test
Normal file
@@ -0,0 +1,343 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
# You cannot use `KILL' with the Embedded MySQL Server library,
|
||||
# because the embedded server merely runs inside the threads of the host
|
||||
# application. -- the docs
|
||||
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
###
|
||||
### bug#22725 : incorrect killed error in binlogged query
|
||||
###
|
||||
|
||||
connect (con1, localhost, root,,);
|
||||
connect (con2, localhost, root,,);
|
||||
|
||||
create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
|
||||
create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
|
||||
|
||||
#
|
||||
# effective test for bug#22725
|
||||
#
|
||||
|
||||
connection con1;
|
||||
select get_lock("a", 20);
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
|
||||
#
|
||||
# reset master does not reset binlogging on the embedded server.
|
||||
# the test is not run on the embedded for reason of using KILL query.
|
||||
# `reset master' problem is to be addressed by bug#15580 fixes.
|
||||
#
|
||||
reset master;
|
||||
send insert into t2 values (null, null), (null, get_lock("a", 10));
|
||||
|
||||
|
||||
connection con1;
|
||||
|
||||
disable_abort_on_error;
|
||||
disable_query_log;
|
||||
disable_result_log;
|
||||
|
||||
eval kill query $ID;
|
||||
|
||||
connection con2;
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $error_code= `select @a like "%#%error_code=0%" /* must return 1 or 0*/`;
|
||||
let $insert_binlogged= `select @a like "%insert into%" /* must return 1 or 0 */`;
|
||||
eval set @result= $rows- $error_code - $insert_binlogged;
|
||||
|
||||
enable_abort_on_error;
|
||||
enable_query_log;
|
||||
enable_result_log;
|
||||
|
||||
select @result /* must be zero either way */;
|
||||
|
||||
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
|
||||
connection con1;
|
||||
select RELEASE_LOCK("a");
|
||||
|
||||
#
|
||||
# bug#27571 asynchronous setting mysql_`query`::error and Query_log_e::error_code
|
||||
#
|
||||
|
||||
# checking that killing inside of select loops is safe as before
|
||||
# killing after the loop can be only simulated - another test
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t1 values (1,1),(2,2);
|
||||
|
||||
#
|
||||
# simple update
|
||||
#
|
||||
connection con1;
|
||||
begin; update t1 set b=11 where a=2;
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
begin;
|
||||
send update t1 set b=b+10;
|
||||
|
||||
connection con1;
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
rollback;
|
||||
|
||||
# Bug #32148 killi query may be ineffective
|
||||
# forced to comment out the test's outcome
|
||||
# and mask out ineffective ER_QUERY_INTERRUPTED
|
||||
# todo1: revert back upon fixing bug#32148
|
||||
# todo2: the tests need refining in that
|
||||
# killing should wait till the victim requested
|
||||
# its lock (wait_condition available in 5.1 tests)
|
||||
|
||||
connection con2;
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
rollback;
|
||||
select * from t1 order by a /* must be the same as before (1,1),(2,2) */;
|
||||
|
||||
#
|
||||
# multi update
|
||||
# commented out as Bug #31807 multi-update,delete killing does not report with ER_QUERY_INTERRUPTED
|
||||
# in the way
|
||||
#
|
||||
# connection con1;
|
||||
# begin; update t1 set b=b+10;
|
||||
|
||||
# connection con2;
|
||||
# send update t1 as t_1,t1 as t_2 set t_1.b=11 where t_2.a=2;
|
||||
|
||||
# connection con1;
|
||||
# --replace_result $ID ID
|
||||
# eval kill query $ID;
|
||||
# rollback;
|
||||
|
||||
# disable_abort_on_error;
|
||||
|
||||
# connection con2;
|
||||
# --error HY000,ER_QUERY_INTERRUPTED
|
||||
# reap;
|
||||
# select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
|
||||
# enable_abort_on_error;
|
||||
#
|
||||
# simple delete
|
||||
#
|
||||
connection con1;
|
||||
begin; delete from t1 where a=2;
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
begin;
|
||||
send delete from t1 where a=2;
|
||||
|
||||
connection con1;
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
rollback;
|
||||
|
||||
connection con2;
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
rollback;
|
||||
# todo1,2 above
|
||||
select * from t1 order by a /* must be the same as before (1,1),(2,2) */;
|
||||
|
||||
|
||||
#
|
||||
# multi delete
|
||||
# the same as for multi-update
|
||||
#
|
||||
# connection con1;
|
||||
# begin; delete from t1 where a=2;
|
||||
|
||||
# connection con2;
|
||||
# send delete t1 from t1 where t1.a=2;
|
||||
|
||||
# connection con1;
|
||||
# --replace_result $ID ID
|
||||
# eval kill query $ID;
|
||||
# rollback;
|
||||
|
||||
# connection con2;
|
||||
# --error 0,ER_QUERY_INTERRUPTED
|
||||
# reap;
|
||||
# select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
#
|
||||
# insert select
|
||||
#
|
||||
connection con1;
|
||||
--disable_warnings
|
||||
drop table if exists t4;
|
||||
--enable_warnings
|
||||
create table t4 (a int, b int) engine=innodb;
|
||||
insert into t4 values (3, 3);
|
||||
begin; insert into t1 values (3, 3);
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
begin;
|
||||
send insert into t1 select * from t4 for update;
|
||||
|
||||
connection con1;
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
rollback;
|
||||
|
||||
connection con2;
|
||||
--error 0,ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
# todo 1,2 above
|
||||
rollback;
|
||||
select * from t1 /* must be the same as before (1,1),(2,2) */;
|
||||
|
||||
drop table t4; # cleanup for the sub-case
|
||||
|
||||
###
|
||||
## non-ta table case: killing must be recorded in binlog
|
||||
###
|
||||
create table t4 (a int, b int) ENGINE=MyISAM /* for killing update and delete */;
|
||||
|
||||
delimiter |;
|
||||
create function bug27563(n int)
|
||||
RETURNS int(11)
|
||||
DETERMINISTIC
|
||||
begin
|
||||
if @b > 0 then
|
||||
select get_lock("a", 20) into @a;
|
||||
else
|
||||
set @b= 1;
|
||||
end if;
|
||||
return n;
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
#
|
||||
# update
|
||||
#
|
||||
|
||||
delete from t4;
|
||||
insert into t4 values (1,1), (1,1);
|
||||
reset master;
|
||||
connection con1;
|
||||
select get_lock("a", 20);
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
set @b= 0;
|
||||
send update t4 set b=b + bug27563(b);
|
||||
|
||||
connection con1;
|
||||
let $wait_condition= select count(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
|
||||
source include/wait_condition.inc;
|
||||
select count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
|
||||
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
|
||||
connection con2;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
select * from t4 order by b /* must be (1,1), (1,2) */;
|
||||
select @b /* must be 1 at the end of a stmt calling bug27563() */;
|
||||
--echo must have the update query event more to FD
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# a proof the query is binlogged with an error
|
||||
|
||||
--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
|
||||
eval select $error_code /* must return 0 to mean the killed query is in */;
|
||||
|
||||
# cleanup for the sub-case
|
||||
connection con1;
|
||||
select RELEASE_LOCK("a");
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
|
||||
#
|
||||
# delete
|
||||
#
|
||||
|
||||
delete from t4;
|
||||
insert into t4 values (1,1), (2,2);
|
||||
reset master;
|
||||
connection con1;
|
||||
select get_lock("a", 20);
|
||||
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
set @b= 0;
|
||||
send delete from t4 where b=bug27563(1) or b=bug27563(2);
|
||||
|
||||
connection con1;
|
||||
let $wait_condition= select count(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
|
||||
source include/wait_condition.inc;
|
||||
select count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
|
||||
--replace_result $ID ID
|
||||
eval kill query $ID;
|
||||
|
||||
connection con2;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
select count(*) from t4 /* must be 1 */;
|
||||
select @b /* must be 1 at the end of a stmt calling bug27563() */;
|
||||
--echo must have the delete query event more to FD
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# a proof the query is binlogged with an error
|
||||
|
||||
--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
|
||||
eval select $error_code /* must return 0 to mean the killed query is in */;
|
||||
|
||||
# cleanup for the sub-case
|
||||
connection con1;
|
||||
select RELEASE_LOCK("a");
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
|
||||
drop table t4;
|
||||
|
||||
#
|
||||
# load data - see simulation tests
|
||||
#
|
||||
|
||||
|
||||
# bug#27571 cleanup
|
||||
|
||||
drop function bug27563;
|
||||
|
||||
|
||||
#
|
||||
# common cleanup
|
||||
#
|
||||
|
||||
drop table t1,t2,t3;
|
||||
|
||||
--echo end of the tests
|
||||
@@ -0,0 +1,71 @@
|
||||
-- source include/have_debug.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
#
|
||||
# bug#27571 asynchronous setting mysql_$query()'s local error and
|
||||
# Query_log_event::error_code
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Checking that killing upon successful row-loop does not affect binlogging
|
||||
#
|
||||
|
||||
create table t1 (a int) engine=MyISAM;
|
||||
insert into t1 set a=1;
|
||||
reset master;
|
||||
|
||||
update t1 set a=2 /* will be "killed" after work has been done */;
|
||||
|
||||
# a proof the query is binlogged with no error
|
||||
--let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 2)
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_load_data $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $error_code= `select @a like "%#%error_code=0%" /* must return 1 */`;
|
||||
eval select $error_code /* must return 1 as query completed before got killed*/;
|
||||
|
||||
# cleanup for the sub-case
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
|
||||
|
||||
|
||||
#
|
||||
# Checking that killing inside of row-loop for LOAD DATA into
|
||||
# non-transactional table affects binlogging
|
||||
#
|
||||
|
||||
create table t2 (a int, b int) ENGINE=MyISAM;
|
||||
reset master;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
|
||||
|
||||
|
||||
--let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 2)
|
||||
# a proof the query is binlogged with an error
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--mkdir $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571
|
||||
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571 --force-if-open --start-position=$binlog_load_data $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
|
||||
is not null;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
|
||||
eval select $error_code /* must return 0 to mean the killed query is in */;
|
||||
|
||||
# cleanup for the sub-case
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
|
||||
|
||||
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571 *
|
||||
--rmdir $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
--echo end of the tests
|
||||
@@ -0,0 +1,5 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_mixed.inc
|
||||
-- source extra/binlog_tests/innodb_stat.test
|
||||
@@ -0,0 +1,4 @@
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--source extra/binlog_tests/binlog_failure_mixing_engines.test
|
||||
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Bug #34283 mysqlbinlog leaves tmpfile after termination
|
||||
# if binlog contains load data infile, so in mixed mode we
|
||||
# go to row-based for avoiding the problem.
|
||||
#
|
||||
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=MYISAM;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||
--source include/show_binlog_events.inc
|
||||
DROP TABLE t1;
|
||||
@@ -0,0 +1,104 @@
|
||||
# Test to test how logging is done depending on the capabilities of
|
||||
# the engines. Unfortunately, we don't have a good row-only logging
|
||||
# engine, and NDB does not really cut is since it is also
|
||||
# self-logging. I'm using it nevertheless.
|
||||
|
||||
source include/have_blackhole.inc;
|
||||
source include/have_ndb.inc;
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM;
|
||||
CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE;
|
||||
CREATE TABLE t1n (e INT, f INT) ENGINE=NDB;
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
SET SESSION BINLOG_FORMAT=STATEMENT;
|
||||
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
|
||||
# Here and below we need to wait when some event appears in binlog
|
||||
# to avoid unsrted mixing local events and from NDB
|
||||
let $wait_binlog_event= t1m, t1b;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
|
||||
echo *** Please look in binlog_multi_engine.test if you have a diff here ****;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
COMMIT;
|
||||
|
||||
let $wait_binlog_event= COMMIT;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
|
||||
TRUNCATE t1m;
|
||||
TRUNCATE t1b;
|
||||
TRUNCATE t1n;
|
||||
|
||||
let $wait_binlog_event= t1n;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
SET SESSION BINLOG_FORMAT=MIXED;
|
||||
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
let $wait_binlog_event= t1m;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
let $wait_binlog_event= COMMIT;
|
||||
source include/wait_for_binlog_event.inc;
|
||||
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
# Not possible to test this since NDB writes its own binlog, which
|
||||
# might cause it to be out of sync with the results from MyISAM.
|
||||
# This will generate an error once BUG#28722 is fixed.
|
||||
|
||||
#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
TRUNCATE t1m;
|
||||
TRUNCATE t1b;
|
||||
TRUNCATE t1n;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
SET SESSION BINLOG_FORMAT=ROW;
|
||||
|
||||
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
# Not possible to test this since NDB writes its own binlog, which
|
||||
# might cause it to be out of sync with the results from MyISAM.
|
||||
# This will generate an error once BUG#28722 is fixed.
|
||||
|
||||
#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
|
||||
error ER_BINLOG_LOGGING_IMPOSSIBLE;
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
DROP TABLE t1m, t1b, t1n;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# disabled in embedded until tools running is fixed with embedded
|
||||
--source include/not_embedded.inc
|
||||
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
-- source include/have_cp932.inc
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
# Bug#16217 (mysql client did not know how not switch its internal charset)
|
||||
create table t3 (f text character set utf8);
|
||||
create table t4 (f text character set cp932);
|
||||
--exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'ソ')"
|
||||
--exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');"
|
||||
flush logs;
|
||||
rename table t3 to t03, t4 to t04;
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8
|
||||
# original and recovered data must be equal
|
||||
select HEX(f) from t03;
|
||||
select HEX(f) from t3;
|
||||
select HEX(f) from t04;
|
||||
select HEX(f) from t4;
|
||||
|
||||
drop table t3, t4, t03, t04;
|
||||
--echo End of 5.0 tests
|
||||
@@ -0,0 +1,171 @@
|
||||
# Test for the new options --start-datetime, stop-datetime,
|
||||
# and a few others.
|
||||
|
||||
# TODO: Need to look at making row based version once new binlog client is complete.
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
reset master;
|
||||
|
||||
# We need this for getting fixed timestamps inside of this test.
|
||||
# I use a date in the future to keep a growing timestamp along the
|
||||
# binlog (including the Start_log_event). This test will work
|
||||
# unchanged everywhere, because mysql-test-run has fixed TZ, which it
|
||||
# exports (so mysqlbinlog has same fixed TZ).
|
||||
set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22");
|
||||
set timestamp=@a;
|
||||
create table t1 (a int auto_increment not null primary key, b char(3));
|
||||
insert into t1 values(null, "a");
|
||||
insert into t1 values(null, "b");
|
||||
set timestamp=@a+2;
|
||||
insert into t1 values(null, "c");
|
||||
set timestamp=@a+4;
|
||||
insert into t1 values(null, "d");
|
||||
insert into t1 values(null, "e");
|
||||
|
||||
flush logs;
|
||||
set timestamp=@a+1; # this could happen on a slave
|
||||
insert into t1 values(null, "f");
|
||||
|
||||
# delimiters are for easier debugging in future
|
||||
|
||||
--disable_query_log
|
||||
select "--- Local --" as "";
|
||||
--enable_query_log
|
||||
|
||||
#
|
||||
# We should use --short-form everywhere because in other case output will
|
||||
# be time dependent (the Start events). Better than nothing.
|
||||
#
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLD_DATADIR/master-bin.000001
|
||||
|
||||
--disable_query_log
|
||||
select "--- offset --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- start-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- stop-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- start and stop positions ---" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- start-datetime --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- stop-datetime --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001
|
||||
|
||||
--disable_query_log
|
||||
select "--- Local with 2 binlogs on command line --" as "";
|
||||
--enable_query_log
|
||||
|
||||
# This is to verify that some options apply only to first, or last binlog
|
||||
|
||||
flush logs;
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
|
||||
|
||||
--disable_query_log
|
||||
select "--- offset --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- start-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- stop-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- start-datetime --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- stop-datetime --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
|
||||
|
||||
--disable_query_log
|
||||
select "--- Remote --" as "";
|
||||
--enable_query_log
|
||||
|
||||
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
|
||||
--disable_query_log
|
||||
select "--- offset --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- start-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- stop-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- start and stop positions ---" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- start-datetime --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
--disable_query_log
|
||||
select "--- stop-datetime --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||
|
||||
--disable_query_log
|
||||
select "--- Remote with 2 binlogs on command line --" as "";
|
||||
--enable_query_log
|
||||
|
||||
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
|
||||
|
||||
--disable_query_log
|
||||
select "--- offset --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- start-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- stop-position --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form --stop-position=134 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- start-datetime --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form "--start-datetime=20200121153224" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
|
||||
--disable_query_log
|
||||
select "--- stop-datetime --" as "";
|
||||
--enable_query_log
|
||||
--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020/01/21 15@32@24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
|
||||
|
||||
--disable_query_log
|
||||
select "--- to-last-log --" as "";
|
||||
--enable_query_log
|
||||
|
||||
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001
|
||||
|
||||
# clean up
|
||||
--disable_query_log
|
||||
select "--- end of test --" as "";
|
||||
--enable_query_log
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,102 @@
|
||||
-- source include/have_binlog_format_row.inc
|
||||
#
|
||||
# Reset master to cleanup binlog
|
||||
#
|
||||
reset master;
|
||||
|
||||
#
|
||||
# Write different events to binlog
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
insert into t1 values (3);
|
||||
update t1 set a=a+2 where a=2;
|
||||
update t1 set a=a+2 where a=3;
|
||||
|
||||
create table t2 (word varchar(20));
|
||||
load data infile '../../std_data/words.dat' into table t2;
|
||||
|
||||
#
|
||||
# Save binlog
|
||||
#
|
||||
let $MYSQLD_DATADIR=`select @@datadir`;
|
||||
flush logs;
|
||||
--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
||||
|
||||
#
|
||||
# Clear database and restore from binlog
|
||||
#
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
||||
|
||||
#
|
||||
# Verify that all binlog events have been executed
|
||||
#
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
#
|
||||
# Verify that events larger than the default IO_CACHE buffer
|
||||
# are handled correctly (BUG#25628).
|
||||
#
|
||||
flush logs;
|
||||
drop table t2;
|
||||
create table t2 (word varchar(20));
|
||||
load data infile '../../std_data/words.dat' into table t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
insert into t2 select * from t2;
|
||||
select count(*) from t2;
|
||||
|
||||
flush logs;
|
||||
--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
||||
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
||||
|
||||
#
|
||||
# Verify that all binlog events have been executed
|
||||
#
|
||||
select count(*) from t2;
|
||||
|
||||
#
|
||||
# Test cleanup
|
||||
#
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
#
|
||||
# BUG#12354268
|
||||
#
|
||||
# This test verifies that using --start-position with DECODE-ROWS
|
||||
# does not make mysqlbinlog to output an error stating that it
|
||||
# does not contain any FD event.
|
||||
#
|
||||
|
||||
RESET MASTER;
|
||||
USE test;
|
||||
SET @old_binlog_format= @@binlog_format;
|
||||
SET SESSION binlog_format=ROW;
|
||||
CREATE TABLE t1(c1 INT);
|
||||
--let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
--let $MYSQLD_DATADIR= `SELECT @@datadir`
|
||||
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
--disable_result_log
|
||||
--exec $MYSQL_BINLOG --base64-output=DECODE-ROWS --start-position=$master_pos -v $MYSQLD_DATADIR/$master_binlog
|
||||
--enable_result_log
|
||||
|
||||
DROP TABLE t1;
|
||||
SET SESSION binlog_format= @old_binlog_format;
|
||||
RESET MASTER;
|
||||
@@ -0,0 +1,446 @@
|
||||
--source include/have_log_bin.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/have_ucs2.inc
|
||||
|
||||
--echo #
|
||||
--echo # Preparatory cleanup.
|
||||
--echo #
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # We need a fixed timestamp to avoid varying results.
|
||||
--echo #
|
||||
SET timestamp=1000000000;
|
||||
|
||||
--echo #
|
||||
--echo # Delete all existing binary logs.
|
||||
--echo #
|
||||
RESET MASTER;
|
||||
|
||||
|
||||
CREATE TABLE t1 (c01 BIT);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c01 BIT(7));
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
INSERT INTO t1 VALUES (8);
|
||||
INSERT INTO t1 VALUES (16);
|
||||
INSERT INTO t1 VALUES (32);
|
||||
INSERT INTO t1 VALUES (64);
|
||||
INSERT INTO t1 VALUES (127);
|
||||
DELETE FROM t1 WHERE c01=127;
|
||||
UPDATE t1 SET c01=15 WHERE c01=16;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a BIT(20), b CHAR(2));
|
||||
INSERT INTO t1 VALUES (b'00010010010010001001', 'ab');
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c02 BIT(64));
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (128);
|
||||
INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111');
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
CREATE TABLE t1 (c03 TINYINT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
INSERT INTO t1 VALUES (-128);
|
||||
UPDATE t1 SET c03=2 WHERE c03=1;
|
||||
DELETE FROM t1 WHERE c03=-128;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c04 TINYINT UNSIGNED);
|
||||
INSERT INTO t1 VALUES (128), (255);
|
||||
UPDATE t1 SET c04=2 WHERE c04=1;
|
||||
DELETE FROM t1 WHERE c04=255;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c06 BOOL);
|
||||
INSERT INTO t1 VALUES (TRUE);
|
||||
DELETE FROM t1 WHERE c06=TRUE;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c07 SMALLINT);
|
||||
INSERT INTO t1 VALUES (1234);
|
||||
DELETE FROM t1 WHERE c07=1234;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c08 SMALLINT UNSIGNED);
|
||||
INSERT INTO t1 VALUES (32768), (65535);
|
||||
UPDATE t1 SET c08=2 WHERE c08=32768;
|
||||
DELETE FROM t1 WHERE c08=65535;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c10 MEDIUMINT);
|
||||
INSERT INTO t1 VALUES (12345);
|
||||
DELETE FROM t1 WHERE c10=12345;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c11 MEDIUMINT UNSIGNED);
|
||||
INSERT INTO t1 VALUES (8388608), (16777215);
|
||||
UPDATE t1 SET c11=2 WHERE c11=8388608;
|
||||
DELETE FROM t1 WHERE c11=16777215;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c13 INT);
|
||||
INSERT INTO t1 VALUES (123456);
|
||||
DELETE FROM t1 WHERE c13=123456;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c14 INT UNSIGNED);
|
||||
INSERT INTO t1 VALUES (2147483648), (4294967295);
|
||||
UPDATE t1 SET c14=2 WHERE c14=2147483648;
|
||||
DELETE FROM t1 WHERE c14=4294967295;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c16 BIGINT);
|
||||
INSERT INTO t1 VALUES (1234567890);
|
||||
DELETE FROM t1 WHERE c16=1234567890;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c17 BIGINT UNSIGNED);
|
||||
INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615);
|
||||
UPDATE t1 SET c17=2 WHERE c17=9223372036854775808;
|
||||
DELETE FROM t1 WHERE c17=18446744073709551615;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c19 FLOAT);
|
||||
INSERT INTO t1 VALUES (123.2234);
|
||||
DELETE FROM t1 WHERE c19>123;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c22 DOUBLE);
|
||||
INSERT INTO t1 VALUES (123434.22344545);
|
||||
DELETE FROM t1 WHERE c22>123434;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c25 DECIMAL(10,5));
|
||||
INSERT INTO t1 VALUES (124.45);
|
||||
INSERT INTO t1 VALUES (-543.21);
|
||||
DELETE FROM t1 WHERE c25=124.45;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c28 DATE);
|
||||
INSERT INTO t1 VALUES ('2001-02-03');
|
||||
DELETE FROM t1 WHERE c28='2001-02-03';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c29 DATETIME);
|
||||
INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
|
||||
DELETE FROM t1 WHERE c29='2001-02-03 10:20:30';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c30 TIMESTAMP);
|
||||
INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
|
||||
DELETE FROM t1 WHERE c30='2001-02-03 10:20:30';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c31 TIME);
|
||||
INSERT INTO t1 VALUES ('11:22:33');
|
||||
DELETE FROM t1 WHERE c31='11:22:33';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c32 YEAR);
|
||||
INSERT INTO t1 VALUES ('2001');
|
||||
DELETE FROM t1 WHERE c32=2001;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c33 CHAR);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c33='a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c34 CHAR(0));
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DELETE FROM t1 WHERE c34='';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c35 CHAR(1));
|
||||
INSERT INTO t1 VALUES ('b');
|
||||
DELETE FROM t1 WHERE c35='b';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c36 CHAR(255));
|
||||
INSERT INTO t1 VALUES (repeat('c',255));
|
||||
DELETE FROM t1 WHERE c36>'c';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c37 NATIONAL CHAR);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c37='a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c38 NATIONAL CHAR(0));
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DELETE FROM t1 WHERE c38='';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c39 NATIONAL CHAR(1));
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c39='a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c40 NATIONAL CHAR(255));
|
||||
INSERT INTO t1 VALUES (repeat('a', 255));
|
||||
INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
|
||||
DELETE FROM t1 WHERE c40>'a';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c41 CHAR CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c41='a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c42 CHAR(0) CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DELETE FROM t1 WHERE c42='';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c43 CHAR(1) CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c43='a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c44 CHAR(255) CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES (repeat('a', 255));
|
||||
INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
|
||||
DELETE FROM t1 WHERE c44>'a';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c45 VARCHAR(0));
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DELETE FROM t1 WHERE c45='';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c46 VARCHAR(1));
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c46='a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c47 VARCHAR(255));
|
||||
INSERT INTO t1 VALUES (repeat('a',255));
|
||||
DELETE FROM t1 WHERE c47>'a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c48 VARCHAR(261));
|
||||
INSERT INTO t1 VALUES (repeat('a',261));
|
||||
DELETE FROM t1 WHERE c48>'a';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c49 NATIONAL VARCHAR(0));
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DELETE FROM t1 WHERE c49='';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c50 NATIONAL VARCHAR(1));
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c50='a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c51 NATIONAL VARCHAR(255));
|
||||
INSERT INTO t1 VALUES (repeat('a',255));
|
||||
INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
|
||||
DELETE FROM t1 WHERE c51>'a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c52 NATIONAL VARCHAR(261));
|
||||
INSERT INTO t1 VALUES (repeat('a',261));
|
||||
INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261));
|
||||
DELETE FROM t1 WHERE c52>'a';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c53 VARCHAR(0) CHARACTER SET ucs2);
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DELETE FROM t1 WHERE c53='';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c54 VARCHAR(1) CHARACTER SET ucs2);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c54='a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c55 VARCHAR(255) CHARACTER SET ucs2);
|
||||
INSERT INTO t1 VALUES (repeat('ab', 127));
|
||||
DELETE FROM t1 WHERE c55>'a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c56 VARCHAR(261) CHARACTER SET ucs2);
|
||||
INSERT INTO t1 VALUES (repeat('ab', 130));
|
||||
DELETE FROM t1 WHERE c56>'a';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c57 BINARY);
|
||||
INSERT INTO t1 VALUES (0x00);
|
||||
INSERT INTO t1 VALUES (0x02);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c57='a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c58 BINARY(0));
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DELETE FROM t1 WHERE c58='';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c59 BINARY(1));
|
||||
INSERT INTO t1 VALUES (0x00);
|
||||
INSERT INTO t1 VALUES (0x02);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c59='a';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c60 BINARY(255));
|
||||
INSERT INTO t1 VALUES (0x00);
|
||||
INSERT INTO t1 VALUES (0x02);
|
||||
INSERT INTO t1 VALUES (repeat('a\0',120));
|
||||
DELETE FROM t1 WHERE c60<0x02;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c61 VARBINARY(0));
|
||||
INSERT INTO t1 VALUES ('');
|
||||
DELETE FROM t1 WHERE c61='';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c62 VARBINARY(1));
|
||||
INSERT INTO t1 VALUES (0x00);
|
||||
INSERT INTO t1 VALUES (0x02);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
DELETE FROM t1 WHERE c62=0x02;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c63 VARBINARY(255));
|
||||
INSERT INTO t1 VALUES (0x00);
|
||||
INSERT INTO t1 VALUES (0x02);
|
||||
INSERT INTO t1 VALUES (repeat('a\0',120));
|
||||
DELETE FROM t1 WHERE c63=0x02;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c65 TINYBLOB);
|
||||
INSERT INTO t1 VALUES ('tinyblob1');
|
||||
DELETE FROM t1 WHERE c65='tinyblob1';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c68 BLOB);
|
||||
INSERT INTO t1 VALUES ('blob1');
|
||||
DELETE FROM t1 WHERE c68='blob1';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c71 MEDIUMBLOB);
|
||||
INSERT INTO t1 VALUES ('mediumblob1');
|
||||
DELETE FROM t1 WHERE c71='mediumblob1';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c74 LONGBLOB);
|
||||
INSERT INTO t1 VALUES ('longblob1');
|
||||
DELETE FROM t1 WHERE c74='longblob1';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c66 TINYTEXT);
|
||||
INSERT INTO t1 VALUES ('tinytext1');
|
||||
DELETE FROM t1 WHERE c66='tinytext1';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c69 TEXT);
|
||||
INSERT INTO t1 VALUES ('text1');
|
||||
DELETE FROM t1 WHERE c69='text1';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c72 MEDIUMTEXT);
|
||||
INSERT INTO t1 VALUES ('mediumtext1');
|
||||
DELETE FROM t1 WHERE c72='mediumtext1';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c75 LONGTEXT);
|
||||
INSERT INTO t1 VALUES ('longtext1');
|
||||
DELETE FROM t1 WHERE c75='longtext1';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c67 TINYTEXT CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES ('tinytext1');
|
||||
DELETE FROM t1 WHERE c67='tinytext1';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c70 TEXT CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES ('text1');
|
||||
DELETE FROM t1 WHERE c70='text1';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c73 MEDIUMTEXT CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES ('mediumtext1');
|
||||
DELETE FROM t1 WHERE c73='mediumtext1';
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c76 LONGTEXT CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES ('longtext1');
|
||||
DELETE FROM t1 WHERE c76='longtext1';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c77 ENUM('a','b','c'));
|
||||
INSERT INTO t1 VALUES ('b');
|
||||
DELETE FROM t1 WHERE c77='b';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c78 SET('a','b','c','d','e','f'));
|
||||
INSERT INTO t1 VALUES ('a,b');
|
||||
INSERT INTO t1 VALUES ('a,c');
|
||||
INSERT INTO t1 VALUES ('b,c');
|
||||
INSERT INTO t1 VALUES ('a,b,c');
|
||||
INSERT INTO t1 VALUES ('a,b,c,d');
|
||||
INSERT INTO t1 VALUES ('a,b,c,d,e');
|
||||
INSERT INTO t1 VALUES ('a,b,c,d,e,f');
|
||||
DELETE FROM t1 WHERE c78='a,b';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Check multi-table update
|
||||
#
|
||||
CREATE TABLE t1 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
|
||||
CREATE TABLE t2 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
|
||||
INSERT INTO t1 SET a=1;
|
||||
INSERT INTO t1 SET b=1;
|
||||
INSERT INTO t2 SET a=1;
|
||||
INSERT INTO t2 SET b=1;
|
||||
UPDATE t1, t2 SET t1.a=10, t2.a=20;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
flush logs;
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/
|
||||
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
|
||||
@@ -0,0 +1,24 @@
|
||||
# mysqlbinlog_row_innodb.test
|
||||
#
|
||||
# Show that mysqlbinlog displays human readable comments to
|
||||
# row-based log events.
|
||||
#
|
||||
# Main module for the InnoDB storage engine.
|
||||
#
|
||||
# Calls include/mysqlbinlog_row.inc
|
||||
# See there for more informaton.
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type=InnoDB;
|
||||
|
||||
#
|
||||
# The test case would also work with statement based or mixed mode logging.
|
||||
# But this would require different result files. To handle this with the
|
||||
# current test suite, new main test cases are required.
|
||||
#
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/have_ucs2.inc
|
||||
|
||||
--source extra/binlog_tests/mysqlbinlog_row_engine.inc
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# mysqlbinlog_row.test
|
||||
#
|
||||
# Show that mysqlbinlog displays human readable comments to
|
||||
# row-based log events.
|
||||
#
|
||||
# Main module for the MyISAM storage engine.
|
||||
#
|
||||
# Calls include/mysqlbinlog_row.inc
|
||||
# See there for more informaton.
|
||||
#
|
||||
|
||||
#--source include/have_myisam.inc
|
||||
let $engine_type=MyISAM;
|
||||
|
||||
#
|
||||
# The test case would also work with statement based or mixed mode logging.
|
||||
# But this would require different result files. To handle this with the
|
||||
# current test suite, new main test cases are required.
|
||||
#
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/have_ucs2.inc
|
||||
|
||||
--source extra/binlog_tests/mysqlbinlog_row_engine.inc
|
||||
@@ -0,0 +1,161 @@
|
||||
# mysqlbinlog_trans.test
|
||||
#
|
||||
# Show that mysqlbinlog work correctly with transactions.
|
||||
#
|
||||
|
||||
#--source include/have_myisam.inc
|
||||
--let $engine_type_nontrans= MyISAM
|
||||
--source include/have_innodb.inc
|
||||
--let $engine_type= InnoDB
|
||||
|
||||
#
|
||||
# The test case would also work with statement based or mixed mode logging.
|
||||
# But this would require different result files. To handle this with the
|
||||
# current test suite, new main test cases are required.
|
||||
#
|
||||
--source include/have_binlog_format_row.inc
|
||||
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
--echo #
|
||||
--echo # Preparatory cleanup.
|
||||
--echo #
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # We need a fixed timestamp to avoid varying results.
|
||||
--echo #
|
||||
SET timestamp=1000000000;
|
||||
|
||||
--echo #
|
||||
--echo # Delete all existing binary logs.
|
||||
--echo #
|
||||
RESET MASTER;
|
||||
|
||||
--echo #
|
||||
--echo # Create test tables.
|
||||
--echo #
|
||||
eval CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 VARCHAR(20)
|
||||
) ENGINE=$engine_type DEFAULT CHARSET latin1;
|
||||
eval CREATE TABLE t2 (
|
||||
c1 INT,
|
||||
c2 VARCHAR(20)
|
||||
) ENGINE=$engine_type_nontrans DEFAULT CHARSET latin1;
|
||||
|
||||
--echo #
|
||||
--echo # Start transaction #1, transactional table only, commit.
|
||||
--echo #
|
||||
START TRANSACTION;
|
||||
|
||||
--echo #
|
||||
--echo # Do some statements.
|
||||
--echo #
|
||||
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t1 SET c1 = c1 + 10;
|
||||
DELETE FROM t1 WHERE c1 = 12;
|
||||
|
||||
--echo #
|
||||
--echo # Commit transaction.
|
||||
--echo #
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Start transaction #2, transactional table only, rollback.
|
||||
--echo #
|
||||
START TRANSACTION;
|
||||
|
||||
--echo #
|
||||
--echo # Do some statements.
|
||||
--echo #
|
||||
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t1 SET c1 = c1 + 10;
|
||||
DELETE FROM t1 WHERE c1 = 12;
|
||||
|
||||
--echo #
|
||||
--echo # Rollback transaction.
|
||||
--echo #
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Start transaction #3, both tables, commit.
|
||||
--echo #
|
||||
START TRANSACTION;
|
||||
|
||||
--echo #
|
||||
--echo # Do some statements on the transactional table.
|
||||
--echo #
|
||||
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t1 SET c1 = c1 + 10;
|
||||
DELETE FROM t1 WHERE c1 = 12;
|
||||
|
||||
--echo #
|
||||
--echo # Do some statements on the non-transactional table.
|
||||
--echo #
|
||||
INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t2 SET c1 = c1 + 10;
|
||||
DELETE FROM t2 WHERE c1 = 12;
|
||||
|
||||
--echo #
|
||||
--echo # Commit transaction.
|
||||
--echo #
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
|
||||
--echo #
|
||||
--echo # Start transaction #4, both tables, rollback.
|
||||
--echo #
|
||||
START TRANSACTION;
|
||||
|
||||
--echo #
|
||||
--echo # Do some statements on the transactional table.
|
||||
--echo #
|
||||
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t1 SET c1 = c1 + 10;
|
||||
DELETE FROM t1 WHERE c1 = 12;
|
||||
|
||||
--echo #
|
||||
--echo # Do some statements on the non-transactional table.
|
||||
--echo #
|
||||
INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t2 SET c1 = c1 + 10;
|
||||
DELETE FROM t2 WHERE c1 = 12;
|
||||
|
||||
--echo #
|
||||
--echo # Rollback transaction.
|
||||
--echo #
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
|
||||
--echo #
|
||||
--echo # Flush all log buffers to the log file.
|
||||
--echo #
|
||||
FLUSH LOGS;
|
||||
|
||||
--echo #
|
||||
--echo # Call mysqlbinlog to display the log file contents.
|
||||
--echo #
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/
|
||||
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup.
|
||||
--echo #
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
# Test that old binlog formats can be read.
|
||||
|
||||
# Some previous versions of MySQL use their own binlog format,
|
||||
# especially in row-based replication. This test uses saved binlogs
|
||||
# from those old versions to test that we can replicate from old
|
||||
# versions to the present version.
|
||||
|
||||
# Replicating from old versions to new versions is necessary in an
|
||||
# online upgrade scenario, where the .
|
||||
|
||||
# The previous versions we currently test are:
|
||||
# - version 5.1.17 and earlier trees
|
||||
# - mysql-5.1-wl2325-xxx trees (AKA alcatel trees)
|
||||
# - mysql-5.1-telco-6.1 trees (AKA ndb trees)
|
||||
# For completeness, we also test mysql-5.1-new_rpl, which is supposed
|
||||
# to be the "correct" version.
|
||||
|
||||
# All binlogs were generated with the same commands (listed at the end
|
||||
# of this test for reference). The binlogs contain the following
|
||||
# events: Table_map, Write_rows, Update_rows, Delete_rows Query, Xid,
|
||||
# User_var, Int_var, Rand, Begin_load, Append_file, Execute_load.
|
||||
|
||||
# Related bugs: BUG#27779, BUG#31581, BUG#31582, BUG#31583, BUG#32407
|
||||
|
||||
source include/not_embedded.inc;
|
||||
|
||||
|
||||
--echo ==== Read modern binlog (version 5.1.23) ====
|
||||
|
||||
# Read binlog.
|
||||
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1_23.001 | $MYSQL --local-infile=1
|
||||
# Show result.
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t3;
|
||||
# Reset.
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
|
||||
--echo ==== Read binlog from version 5.1.17 ====
|
||||
|
||||
# Read binlog.
|
||||
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1_17.001 | $MYSQL --local-infile=1
|
||||
# Show result.
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t3;
|
||||
# Reset.
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
|
||||
--echo ==== Read binlog from version 4.1 ====
|
||||
|
||||
# In this version, neither row-based binlogging nor Xid events
|
||||
# existed, so the binlog was generated without the "row-based tests"
|
||||
# part and the "get xid event" part, and it does not create table t2.
|
||||
|
||||
# Read binlog.
|
||||
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/binlog_old_version_4_1.000001 | $MYSQL --local-infile=1
|
||||
# Show result.
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t3;
|
||||
# Reset.
|
||||
DROP TABLE t1, t3;
|
||||
|
||||
|
||||
--echo ==== Read binlog from alcatel tree (mysql-5.1-wl2325-5.0-drop6) ====
|
||||
|
||||
# In this version, it was not possible to switch between row-based and
|
||||
# statement-based binlogging without restarting the server. So, we
|
||||
# have two binlogs; one for row based and one for statement based
|
||||
# replication.
|
||||
|
||||
# Read rbr binlog.
|
||||
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-wl2325_r.001 | $MYSQL --local-infile=1
|
||||
# Read stm binlog.
|
||||
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-wl2325_s.001 | $MYSQL --local-infile=1
|
||||
# Show result.
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t3;
|
||||
# Reset.
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
|
||||
--echo ==== Read binlog from ndb tree (mysql-5.1-telco-6.1) ====
|
||||
|
||||
# Read binlog.
|
||||
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-telco.001 | $MYSQL --local-infile=1
|
||||
# Show resulting tablea.
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
SELECT COUNT(*) FROM t3;
|
||||
# Reset.
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
|
||||
#### The following commands were used to generate the binlogs ####
|
||||
#
|
||||
#source include/master-slave.inc;
|
||||
#
|
||||
## ==== initialize ====
|
||||
#USE test;
|
||||
#CREATE TABLE t1 (a int, b char(50)) ENGINE = MyISAM;
|
||||
#CREATE TABLE t2 (a int, b char(50)) ENGINE = InnoDB;
|
||||
#CREATE TABLE t3 (a char(20));
|
||||
#
|
||||
#
|
||||
## ==== row based tests ====
|
||||
#SET BINLOG_FORMAT='row';
|
||||
#
|
||||
## ---- get write, update, and delete rows events ----
|
||||
#INSERT INTO t1 VALUES (0, 'one'), (1, 'two');
|
||||
#UPDATE t1 SET a=a+1;
|
||||
#DELETE FROM t1 WHERE a=2;
|
||||
#
|
||||
#
|
||||
## ==== statement based tests ====
|
||||
#SET BINLOG_FORMAT = 'statement';
|
||||
#
|
||||
## ---- get xid events ----
|
||||
#BEGIN;
|
||||
#INSERT INTO t2 VALUES (3, 'first stm in trx');
|
||||
#INSERT INTO t1 VALUES (3, 'last stm in trx: next event should be xid');
|
||||
#COMMIT;
|
||||
#
|
||||
## ---- get user var events ----
|
||||
#SET @x = 4;
|
||||
#INSERT INTO t1 VALUES (@x, 'four');
|
||||
#
|
||||
## ---- get rand event ----
|
||||
#INSERT INTO t1 VALUES (RAND() * 1000000, 'random');
|
||||
#
|
||||
## ---- get intvar event ----
|
||||
#INSERT INTO t1 VALUES (LAST_INSERT_ID(), 'last_insert_id');
|
||||
#
|
||||
## ---- get begin, append and execute load events ----
|
||||
## double the file until we have more than 2^17 bytes, so that the
|
||||
## event has to be split and we can use Append_file_log_event.
|
||||
#
|
||||
#SET SQL_LOG_BIN=0;
|
||||
#CREATE TABLE temp (a char(20));
|
||||
#LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE temp;
|
||||
#INSERT INTO temp SELECT * FROM temp;
|
||||
#INSERT INTO temp SELECT * FROM temp;
|
||||
#INSERT INTO temp SELECT * FROM temp;
|
||||
#INSERT INTO temp SELECT * FROM temp;
|
||||
#INSERT INTO temp SELECT * FROM temp;
|
||||
#INSERT INTO temp SELECT * FROM temp;
|
||||
#INSERT INTO temp SELECT * FROM temp;
|
||||
#INSERT INTO temp SELECT * FROM temp;
|
||||
#SELECT a FROM temp INTO OUTFILE 'big_file.dat';
|
||||
#DROP TABLE temp;
|
||||
#SET SQL_LOG_BIN=1;
|
||||
#
|
||||
#LOAD DATA INFILE 'big_file.dat' INTO TABLE t3;
|
||||
#
|
||||
#SELECT * FROM t1 ORDER BY a;
|
||||
#SELECT * FROM t2 ORDER BY a;
|
||||
#SELECT COUNT(*) FROM t3;
|
||||
#--source include/rpl_end.inc
|
||||
@@ -0,0 +1,32 @@
|
||||
# regression test for
|
||||
# Bug#36099 replicate-do-db affects replaying RBR events with mysqlbinlog
|
||||
# The test verifies that the slave side filtering rule does not affect
|
||||
# applying of row-events on master via mysqlbinlog
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
reset master;
|
||||
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
flush logs;
|
||||
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug36099.sql
|
||||
|
||||
drop table t1;
|
||||
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/bug36099.sql"
|
||||
|
||||
--echo *** must be 1 ***
|
||||
select * from t1;
|
||||
|
||||
# cleanup
|
||||
|
||||
drop table t1;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/bug36099.sql;
|
||||
@@ -0,0 +1,26 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test bugs in RESET MASTER.
|
||||
|
||||
--source include/have_debug.inc
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
#######################################################################
|
||||
# BUG#12574820: binlog.binlog_tmp_table timing out in daily and weekly trunk run
|
||||
# Problem: MYSQL_BIN_LOG::reset_logs acquired LOCK_thread_count and
|
||||
# LOCK_log in the wrong order. This could cause a deadlock when
|
||||
# RESET MASTER was run concurrently with a disconnecting thread.
|
||||
#######################################################################
|
||||
|
||||
# We use sleep, not debug_sync, because the sync point needs to be in
|
||||
# the thread shut down code after the debug sync facility has been
|
||||
# shut down.
|
||||
--let $write_var= SET DEBUG="+d,sleep_after_lock_thread_count_before_delete_thd"; CREATE TEMPORARY TABLE test.t1 (a INT);
|
||||
--let $write_to_file= GENERATE
|
||||
--disable_query_log
|
||||
--source include/write_var_to_file.inc
|
||||
--enable_query_log
|
||||
|
||||
--exec $MYSQL < $write_to_file
|
||||
RESET MASTER;
|
||||
--remove_file $write_to_file
|
||||
@@ -0,0 +1,5 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source extra/binlog_tests/binlog.test
|
||||
@@ -0,0 +1,5 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source extra/binlog_tests/ctype_cp932.test
|
||||
@@ -0,0 +1,6 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source extra/binlog_tests/ctype_ucs_binlog.test
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source extra/binlog_tests/drop_temp_table.test
|
||||
@@ -0,0 +1,4 @@
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--source extra/binlog_tests/binlog_failure_mixing_engines.test
|
||||
@@ -0,0 +1,5 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source extra/binlog_tests/innodb_stat.test
|
||||
@@ -0,0 +1,10 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
# Bug#18326: Do not lock table for writing during prepare of statement
|
||||
# The use of the ps protocol causes extra table maps in the binlog, so
|
||||
# we disable the ps-protocol for this statement.
|
||||
--disable_ps_protocol
|
||||
-- source extra/binlog_tests/insert_select-binlog.test
|
||||
--enable_ps_protocol
|
||||
@@ -0,0 +1,15 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
# Bug#18326: Do not lock table for writing during prepare of statement
|
||||
# The use of the ps protocol causes extra table maps in the binlog, so
|
||||
# we disable the ps-protocol for this statement.
|
||||
--disable_ps_protocol
|
||||
|
||||
-- source extra/binlog_tests/mix_innodb_myisam_binlog.test
|
||||
|
||||
--enable_ps_protocol
|
||||
|
||||
-- source extra/binlog_tests/mix_innodb_myisam_side_effects.test
|
||||
@@ -0,0 +1,148 @@
|
||||
# BUG#42941: --database parameter to mysqlbinlog fails with RBR
|
||||
#
|
||||
# WHAT
|
||||
# ====
|
||||
#
|
||||
# This test aims at checking whether a rows log event is printed or
|
||||
# not when --database parameter is used to filter events from one
|
||||
# given database.
|
||||
#
|
||||
# HOW
|
||||
# ===
|
||||
#
|
||||
# The test is implemented as follows:
|
||||
#
|
||||
# i) Some operations are done in two different databases:
|
||||
# 'test' and 'b42941';
|
||||
# ii) mysqlbinlog is used to dump the contents of the binlog file
|
||||
# filtering only events from 'b42941'. The result of the dump is
|
||||
# stored in a temporary file. (This is done with and without
|
||||
# --verbose/hexdump flag);
|
||||
# iii) The contents of the dump are loaded into a session variable;
|
||||
# iv) The variable contents are searched for 'test' and 'b42941';
|
||||
# v) Should 'test' be found, an ERROR is reported. Should 'b42941' be
|
||||
# absent, an ERROR is reported.
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
RESET MASTER;
|
||||
-- let $MYSQLD_DATADIR= `select @@datadir`
|
||||
|
||||
CREATE TABLE t1 (id int);
|
||||
CREATE TABLE t2 (id int);
|
||||
CREATE TABLE t3 (txt TEXT);
|
||||
CREATE TABLE t4 (a int) ENGINE= InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
INSERT INTO t2 VALUES (2);
|
||||
INSERT INTO t1 VALUES (3);
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/words.dat' INTO TABLE t3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
|
||||
CREATE DATABASE b42941;
|
||||
use b42941;
|
||||
CREATE TABLE t1 (id int);
|
||||
CREATE TABLE t2 (id int);
|
||||
CREATE TABLE t3 (txt TEXT);
|
||||
CREATE TABLE t4 (a int) ENGINE= InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
INSERT INTO t2 VALUES (2);
|
||||
INSERT INTO t1 VALUES (3);
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/words.dat' INTO TABLE t3
|
||||
INSERT INTO t1 VALUES (4);
|
||||
|
||||
INSERT INTO test.t1 VALUES (5);
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
UPDATE test.t1 t11, b42941.t1 t12 SET t11.id=10, t12.id=100;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO test.t4 VALUES (1);
|
||||
INSERT INTO b42941.t4 VALUES (1);
|
||||
UPDATE test.t4 tn4, b42941.t4 tt4 SET tn4.a= 10, tt4.a= 100;
|
||||
COMMIT;
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
-- let $log_file1= $MYSQLD_DATADIR/master-bin.000001
|
||||
-- let $log_file2= $MYSQLD_DATADIR/master-bin.000002
|
||||
-- let $outfile= $MYSQLTEST_VARDIR/tmp/b42941-mysqlbinlog
|
||||
-- let $cmd= $MYSQL_BINLOG
|
||||
|
||||
let $i= 3;
|
||||
while($i)
|
||||
{
|
||||
-- let $flags=--database=b42941
|
||||
|
||||
# construct CLI for mysqlbinlog
|
||||
if(`SELECT $i=3`)
|
||||
{
|
||||
-- let $flags= $flags --verbose --hexdump
|
||||
}
|
||||
|
||||
if(`SELECT $i=2`)
|
||||
{
|
||||
-- let $flags= $flags --verbose
|
||||
}
|
||||
|
||||
# if(`SELECT $i=1`)
|
||||
# {
|
||||
# do nothing $flags is already set as it should be
|
||||
# }
|
||||
|
||||
# execute mysqlbinlog on the two available master binlog files
|
||||
-- exec $cmd $flags $log_file1 > $outfile.1
|
||||
-- exec $cmd $flags $log_file2 > $outfile.2
|
||||
|
||||
# load outputs into a variable
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @b42941_output.1= LOAD_FILE('$outfile.1')
|
||||
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- eval SET @b42941_output.2= LOAD_FILE('$outfile.2')
|
||||
|
||||
# remove unecessary files
|
||||
-- remove_file $outfile.1
|
||||
-- remove_file $outfile.2
|
||||
|
||||
#
|
||||
# The two tests are canceled since we introduced the patch of bug#46998,
|
||||
# which will make mydsqlbinlog output the 'BEGIN', 'COMMIT' and 'ROLLBACK'
|
||||
# in regardless of database filtering
|
||||
#
|
||||
# assertion: events for database test are filtered
|
||||
#if (`SELECT INSTR(@b42941_output.1, 'test')`)
|
||||
#{
|
||||
#-- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.1).
|
||||
#}
|
||||
|
||||
#if (`SELECT INSTR(@b42941_output.2, 'test')`)
|
||||
#{
|
||||
#-- echo **** ERROR **** Database name 'test' FOUND in mysqlbinlog output ($flags $outfile.2).
|
||||
#}
|
||||
|
||||
# assertion: events for database b42941 are not filtered
|
||||
if (!`SELECT INSTR(@b42941_output.1, 'b42941')`)
|
||||
{
|
||||
-- echo **** ERROR **** Database name 'b42941' NOT FOUND in mysqlbinlog output ($flags $outfile.1).
|
||||
}
|
||||
|
||||
if (!`SELECT INSTR(@b42941_output.2, 'b42941')`)
|
||||
{
|
||||
-- echo **** ERROR **** Database name 'b42941' NOT FOUND in mysqlbinlog output ($flags $outfile.2).
|
||||
}
|
||||
|
||||
dec $i;
|
||||
}
|
||||
|
||||
DROP DATABASE b42941;
|
||||
use test;
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
@@ -0,0 +1,86 @@
|
||||
########################################################
|
||||
# Test mysqlbinlog command with Ndb produced Binlog
|
||||
# variants
|
||||
#
|
||||
# WHAT
|
||||
# ====
|
||||
# This test aims to check that the mysqlbinlog --verbose
|
||||
# command can output binlogs in 4 format variants, currently
|
||||
# used by Ndb
|
||||
#
|
||||
# 1) Updates logged as write_row events
|
||||
# Only primary key and updated columns included in the
|
||||
# event
|
||||
# 2) Updates logged as write_row_events
|
||||
# All columns included in the event
|
||||
# 3) Updates logged as update_row events
|
||||
# Only primary key and updated columns included in the
|
||||
# event
|
||||
# 4) Updates logged as update_row events
|
||||
# All columns included in the event
|
||||
#
|
||||
# Format variant (1) is the Ndb default.
|
||||
# Bug#47323 resulted in binlogs generated in format (1)
|
||||
# being incorrectly parsed by the mysqlbinlog --verbose
|
||||
# option
|
||||
#
|
||||
# HOW
|
||||
# ===
|
||||
# Row-based binlog files in each format have been
|
||||
# captured from an Ndb cluster
|
||||
# These are output using the mysqlbinlog --verbose
|
||||
# tool and the output is checked.
|
||||
#
|
||||
########################################################
|
||||
|
||||
# We require binlog_format_row as we're independent of binlog format
|
||||
# and there's no point running the same test 3 times
|
||||
-- source include/have_binlog_format_row.inc
|
||||
|
||||
--disable_query_log
|
||||
--let $binlog_file=write-partial-row.binlog
|
||||
--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||
create table raw_binlog_rows (txt varchar(1000));
|
||||
--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||
--enable_query_log
|
||||
--echo Verbose statements from : $binlog_file
|
||||
# Output --verbose lines, with extra Windows CR's trimmed
|
||||
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||
drop table raw_binlog_rows;
|
||||
|
||||
--disable_query_log
|
||||
--let $binlog_file=write-full-row.binlog
|
||||
--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||
create table raw_binlog_rows (txt varchar(1000));
|
||||
--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||
--enable_query_log
|
||||
--echo Verbose statements from : $binlog_file
|
||||
# Output --verbose lines, with extra Windows CR's trimmed
|
||||
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||
drop table raw_binlog_rows;
|
||||
|
||||
--disable_query_log
|
||||
--let $binlog_file=update-partial-row.binlog
|
||||
--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||
create table raw_binlog_rows (txt varchar(1000));
|
||||
--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||
--enable_query_log
|
||||
--echo Verbose statements from : $binlog_file
|
||||
# Output --verbose lines, with extra Windows CR's trimmed
|
||||
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||
drop table raw_binlog_rows;
|
||||
|
||||
--disable_query_log
|
||||
--let $binlog_file=update-full-row.binlog
|
||||
--exec $MYSQL_BINLOG --verbose suite/binlog/std_data/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||
create table raw_binlog_rows (txt varchar(1000));
|
||||
--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n';
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql
|
||||
--enable_query_log
|
||||
--echo Verbose statements from : $binlog_file
|
||||
# Output --verbose lines, with extra Windows CR's trimmed
|
||||
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
|
||||
drop table raw_binlog_rows;
|
||||
@@ -0,0 +1,29 @@
|
||||
# Test for BUG#28908 Replication: set global server_id is not setting the session server_id
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
let $saved_server_id=`select @@server_id`;
|
||||
set global server_id=1;
|
||||
reset master;
|
||||
|
||||
-- disable_warnings
|
||||
drop table if exists t1,t2,t3;
|
||||
-- enable_warnings
|
||||
|
||||
create table t1 (a int);
|
||||
select @@server_id;
|
||||
source include/show_binlog_events2.inc;
|
||||
|
||||
set global server_id=2;
|
||||
create table t2 (b int);
|
||||
select @@server_id;
|
||||
source include/show_binlog_events2.inc;
|
||||
|
||||
set global server_id=3;
|
||||
create table t3 (c int);
|
||||
select @@server_id;
|
||||
source include/show_binlog_events2.inc;
|
||||
|
||||
# cleanup
|
||||
eval set global server_id=$saved_server_id;
|
||||
drop table t1,t2,t3;
|
||||
191
build/lib/mysql/mysql-test/suite/binlog/t/binlog_sf.test
Normal file
191
build/lib/mysql/mysql-test/suite/binlog/t/binlog_sf.test
Normal file
@@ -0,0 +1,191 @@
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
# We change binlog format inside the test, so no need to re-run with
|
||||
# more than one binlog_format.
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
|
||||
# BUG#41166 stored function requires "deterministic" if binlog_format is "statement"
|
||||
|
||||
# save status
|
||||
|
||||
let $oblf=`select @@SESSION.BINLOG_FORMAT`;
|
||||
let $otfc=`select @@log_bin_trust_function_creators`;
|
||||
|
||||
set global log_bin_trust_function_creators=0;
|
||||
|
||||
|
||||
|
||||
# fail *on definition*
|
||||
|
||||
set binlog_format=STATEMENT;
|
||||
|
||||
delimiter |;
|
||||
--error ER_BINLOG_UNSAFE_ROUTINE
|
||||
create function fn16456()
|
||||
returns int
|
||||
begin
|
||||
return unix_timestamp();
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
|
||||
|
||||
# force in definition, so we can see whether we fail on call
|
||||
|
||||
set global log_bin_trust_function_creators=1;
|
||||
|
||||
delimiter |;
|
||||
create function fn16456()
|
||||
returns int
|
||||
begin
|
||||
return unix_timestamp();
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
set global log_bin_trust_function_creators=0;
|
||||
|
||||
|
||||
|
||||
# allow funcall in RBR
|
||||
|
||||
set binlog_format=ROW;
|
||||
|
||||
--replace_column 1 timestamp
|
||||
select fn16456();
|
||||
|
||||
|
||||
|
||||
# fail funcall in SBR
|
||||
|
||||
set binlog_format=STATEMENT;
|
||||
|
||||
--error ER_BINLOG_UNSAFE_ROUTINE
|
||||
select fn16456();
|
||||
|
||||
|
||||
|
||||
# clean
|
||||
|
||||
drop function fn16456;
|
||||
|
||||
|
||||
|
||||
# success in definition with deterministic
|
||||
|
||||
set global log_bin_trust_function_creators=0;
|
||||
|
||||
delimiter |;
|
||||
create function fn16456()
|
||||
returns int deterministic
|
||||
begin
|
||||
return unix_timestamp();
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
|
||||
|
||||
# allow funcall in RBR
|
||||
|
||||
set binlog_format=ROW;
|
||||
|
||||
--replace_column 1 timestamp
|
||||
select fn16456();
|
||||
|
||||
|
||||
|
||||
# allow funcall in SBR
|
||||
|
||||
set binlog_format=STATEMENT;
|
||||
|
||||
--replace_column 1 timestamp
|
||||
select fn16456();
|
||||
|
||||
|
||||
|
||||
# clean
|
||||
|
||||
drop function fn16456;
|
||||
|
||||
|
||||
# success in definition with NO SQL
|
||||
|
||||
set global log_bin_trust_function_creators=0;
|
||||
|
||||
delimiter |;
|
||||
create function fn16456()
|
||||
returns int no sql
|
||||
begin
|
||||
return unix_timestamp();
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
|
||||
|
||||
# allow funcall in RBR
|
||||
|
||||
set binlog_format=ROW;
|
||||
|
||||
--replace_column 1 timestamp
|
||||
select fn16456();
|
||||
|
||||
|
||||
|
||||
# allow funcall in SBR
|
||||
|
||||
set binlog_format=STATEMENT;
|
||||
|
||||
--replace_column 1 timestamp
|
||||
select fn16456();
|
||||
|
||||
|
||||
# clean
|
||||
|
||||
drop function fn16456;
|
||||
|
||||
|
||||
|
||||
# success in definition with reads sql data
|
||||
|
||||
set global log_bin_trust_function_creators=0;
|
||||
|
||||
delimiter |;
|
||||
create function fn16456()
|
||||
returns int reads sql data
|
||||
begin
|
||||
return unix_timestamp();
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
|
||||
|
||||
# allow funcall in RBR
|
||||
|
||||
set binlog_format=ROW;
|
||||
|
||||
--replace_column 1 timestamp
|
||||
select fn16456();
|
||||
|
||||
|
||||
|
||||
# allow funcall in SBR
|
||||
|
||||
set binlog_format=STATEMENT;
|
||||
|
||||
--replace_column 1 timestamp
|
||||
select fn16456();
|
||||
|
||||
|
||||
|
||||
# clean
|
||||
|
||||
drop function fn16456;
|
||||
|
||||
|
||||
|
||||
# restore status
|
||||
|
||||
--disable_query_log
|
||||
eval set binlog_format=$oblf;
|
||||
eval set global log_bin_trust_function_creators=$otfc;
|
||||
--enable_query_log
|
||||
171
build/lib/mysql/mysql-test/suite/binlog/t/binlog_sql_mode.test
Normal file
171
build/lib/mysql/mysql-test/suite/binlog/t/binlog_sql_mode.test
Normal file
@@ -0,0 +1,171 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test that sql_mode can correct restore before generating the binlog event
|
||||
# when creating CREATEable objects.
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Scan binlog file to check if the sql_mode is still set to 0 before generating binlog event
|
||||
#
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
|
||||
# BUG#39526 sql_mode not retained in binary log for CREATE PROCEDURE
|
||||
|
||||
SET @old_sql_mode= @@global.sql_mode;
|
||||
SET @old_binlog_format=@@session.binlog_format;
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
SET SESSION sql_mode=8;
|
||||
|
||||
--echo Initialization
|
||||
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1 (id INT);
|
||||
|
||||
CREATE PROCEDURE testProc() SELECT * FROM t1;
|
||||
CREATE VIEW testView as SELECT * from t1;
|
||||
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION testFunc()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
return 1;
|
||||
END;|
|
||||
DELIMITER ;|
|
||||
|
||||
DELIMITER |;
|
||||
CREATE TRIGGER testTrig BEFORE INSERT ON t1
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE t1 SET id = id +1;
|
||||
END;|
|
||||
DELIMITER ;|
|
||||
|
||||
DELIMITER |;
|
||||
CREATE EVENT testEvent ON SCHEDULE
|
||||
EVERY 1 DAY
|
||||
DO
|
||||
BEGIN
|
||||
UPDATE t1 SET id = id +1;
|
||||
END;|
|
||||
DELIMITER ;|
|
||||
|
||||
--echo Check Result
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select
|
||||
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog"))
|
||||
is not null;
|
||||
let $s_mode_unsigned= `select @a like "%@@session.sql_mode=0%" /* must return 0 */`;
|
||||
echo *** String sql_mode=0 is found: $s_mode_unsigned ***;
|
||||
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog
|
||||
|
||||
--echo Clean Up
|
||||
|
||||
DROP PROCEDURE testProc;
|
||||
DROP FUNCTION testFunc;
|
||||
DROP TRIGGER testTrig;
|
||||
DROP EVENT testEvent;
|
||||
DROP VIEW testView;
|
||||
DROP TABLE t1;
|
||||
|
||||
SET @@global.sql_mode= @old_sql_mode;
|
||||
SET @@session.binlog_format=@old_binlog_format;
|
||||
|
||||
--echo
|
||||
--echo #
|
||||
--echo # Test for Bug#12601974 - STORED PROCEDURE SQL_MODE=NO_BACKSLASH_ESCAPES
|
||||
--echo # IGNORED AND BREAKS REPLICATION
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest_db;
|
||||
DROP TABLE IF EXISTS test_table;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE mysqltest_db;
|
||||
USE mysqltest_db;
|
||||
CREATE TABLE test_table (c1 CHAR(50));
|
||||
|
||||
SET @org_mode=@@sql_mode;
|
||||
|
||||
SET @@sql_mode='';
|
||||
DELIMITER $;
|
||||
CREATE PROCEDURE proc_without_sql_mode (IN param1 CHAR(50), IN param2 CHAR(50))
|
||||
BEGIN
|
||||
DECLARE var1 CHAR(50) DEFAULT param1;
|
||||
DECLARE var2 CHAR(50) DEFAULT param2;
|
||||
DECLARE var3 CHAR(50) DEFAULT 'abcd\bef';
|
||||
DECLARE var4 CHAR(50) DEFAULT 'abcd\nef';
|
||||
DECLARE var5 CHAR(50) DEFAULT 'abcd\ref';
|
||||
DECLARE var6 CHAR(50) DEFAULT 'abcd\tef';
|
||||
DECLARE var7 CHAR(50) DEFAULT 'abcd\\ef';
|
||||
DECLARE var8 CHAR(50) DEFAULT 'abcd\%ef';
|
||||
DECLARE var9 CHAR(50) DEFAULT 'abcd\_ef';
|
||||
|
||||
INSERT INTO test_table VALUES (var1);
|
||||
INSERT INTO test_table VALUES (var2);
|
||||
INSERT INTO test_table VALUES (var3);
|
||||
INSERT INTO test_table VALUES (var4);
|
||||
INSERT INTO test_table VALUES (var5);
|
||||
INSERT INTO test_table VALUES (var6);
|
||||
INSERT INTO test_table VALUES (var7);
|
||||
INSERT INTO test_table VALUES (var8);
|
||||
INSERT INTO test_table VALUES (var9);
|
||||
END
|
||||
$
|
||||
|
||||
SET @@sql_mode='NO_BACKSLASH_ESCAPES'$
|
||||
CREATE PROCEDURE proc_with_sql_mode (IN param1 CHAR(50), IN param2 CHAR(50))
|
||||
BEGIN
|
||||
DECLARE var1 CHAR(50) DEFAULT param1;
|
||||
DECLARE var2 CHAR(50) DEFAULT param2;
|
||||
DECLARE var3 CHAR(50) DEFAULT 'wxyz\bef';
|
||||
DECLARE var4 CHAR(50) DEFAULT 'wxyz\nef';
|
||||
DECLARE var5 CHAR(50) DEFAULT 'wxyz\ref';
|
||||
DECLARE var6 CHAR(50) DEFAULT 'wxyz\tef';
|
||||
DECLARE var7 CHAR(50) DEFAULT 'wxyz\\ef';
|
||||
DECLARE var8 CHAR(50) DEFAULT 'wxyz\%ef';
|
||||
DECLARE var9 CHAR(50) DEFAULT 'wxyz\_ef';
|
||||
|
||||
INSERT INTO test_table VALUES (var1);
|
||||
INSERT INTO test_table VALUES (var2);
|
||||
INSERT INTO test_table VALUES (var3);
|
||||
INSERT INTO test_table VALUES (var4);
|
||||
INSERT INTO test_table VALUES (var5);
|
||||
INSERT INTO test_table VALUES (var6);
|
||||
INSERT INTO test_table VALUES (var7);
|
||||
INSERT INTO test_table VALUES (var8);
|
||||
INSERT INTO test_table VALUES (var9);
|
||||
END
|
||||
$
|
||||
|
||||
DELIMITER ;$
|
||||
SET @@sql_mode='';
|
||||
CALL proc_without_sql_mode('abcd\'ef', 'abcd\"ef');
|
||||
CALL proc_with_sql_mode('wxyz\'ef', 'wxyz\"ef');
|
||||
SELECT * FROM test_table;
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--exec $MYSQL_BINLOG --force-if-open -d mysqltest_db $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug12601974.binlog
|
||||
|
||||
--echo "Dropping table test_table"
|
||||
DROP TABLE test_table;
|
||||
|
||||
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug12601974.binlog"
|
||||
|
||||
--echo #"test_table" content after replaying the binlog
|
||||
SELECT * FROM test_table;
|
||||
|
||||
--echo #Clean up
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug12601974.binlog
|
||||
DROP DATABASE mysqltest_db;
|
||||
SET @@sql_mode= @org_mode;
|
||||
use test;
|
||||
|
||||
--echo
|
||||
--echo #End of Test for Bug#12601974
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# Test case for bug#32205 Replaying statements from mysqlbinlog fails
|
||||
# with a syntax error, replicates fine
|
||||
|
||||
source include/have_log_bin.inc;
|
||||
source include/have_local_infile.inc;
|
||||
|
||||
reset master;
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1 (word varchar(20)) -- create table t1;
|
||||
create table t2 (word varchar(20)) -- create table t2;
|
||||
load data infile '../../std_data/words.dat' into table t1 -- load data to t1;
|
||||
insert into t2 values ("Ada");
|
||||
flush logs;
|
||||
select * from t2;
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
|
||||
--exec $MYSQL --local-infile=1 < $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
|
||||
flush logs;
|
||||
select * from t2;
|
||||
|
||||
# clean up
|
||||
drop table t1,t2;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog;
|
||||
@@ -0,0 +1,9 @@
|
||||
# This test is to verify replication with INSERT DELAY through
|
||||
# unrecommended STATEMENT binlog format
|
||||
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
-- disable_query_log
|
||||
reset master; # get rid of previous tests binlog
|
||||
-- enable_query_log
|
||||
-- source extra/binlog_tests/binlog_insert_delayed.test
|
||||
@@ -0,0 +1,17 @@
|
||||
# REQUIREMENT
|
||||
# replace_regex should replace output of SHOW BINLOG EVENTS
|
||||
|
||||
create table t1 (a int, b int) engine=innodb;
|
||||
begin;
|
||||
insert into t1 values (1,2);
|
||||
commit;
|
||||
source include/show_binlog_events.inc;
|
||||
drop table t1;
|
||||
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_binlog_format_mixed.inc
|
||||
-- source extra/binlog_tests/binlog.test
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
-- source extra/binlog_tests/blackhole.test
|
||||
@@ -0,0 +1,6 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
-- source extra/binlog_tests/ctype_cp932.test
|
||||
@@ -0,0 +1,6 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
-- source extra/binlog_tests/ctype_ucs_binlog.test
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
# BUG#42829: binlogging enabled for all schemas regardless of
|
||||
# binlog-db-db / binlog-ignore-db
|
||||
#
|
||||
# WHAT
|
||||
# ====
|
||||
#
|
||||
# We want to test whether filtered events from binlog will cause
|
||||
# raising an error mentioning that statement is unable to be logged or
|
||||
# not, when:
|
||||
#
|
||||
# 1. isolation level READ-COMMITTED; AND
|
||||
#
|
||||
# 2. using InnoDB engine; AND
|
||||
#
|
||||
# 3. using SBL (in which case InnoDB will only allow RBL).
|
||||
#
|
||||
# HOW
|
||||
# ===
|
||||
#
|
||||
# The test is implemented as follows:
|
||||
#
|
||||
# i) set tx_isolation to read-committed.
|
||||
#
|
||||
# ii) create two databases (one filtered other not - using
|
||||
# binlog-do-db)
|
||||
#
|
||||
# iii) Create statements that are to be filtered on filtered db
|
||||
#
|
||||
# - At this point, before fix, an error would be raised
|
||||
#
|
||||
# iv) do the same thing for not the filtered database and check
|
||||
# that events throw an error:
|
||||
#
|
||||
# - Error: ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
|
||||
#
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
SET @old_isolation_level= @@session.tx_isolation;
|
||||
SET @@session.tx_isolation= 'READ-COMMITTED';
|
||||
|
||||
-- let $engine= InnoDB
|
||||
-- let $filtered= b42829_filtered
|
||||
-- let $not_filtered= b42829
|
||||
|
||||
-- eval CREATE DATABASE $not_filtered
|
||||
-- eval use $not_filtered
|
||||
-- eval CREATE TABLE t1 (x int, y int) engine=$engine
|
||||
-- eval CREATE TABLE t2 (x int, y int) engine=$engine
|
||||
|
||||
-- eval CREATE DATABASE $filtered
|
||||
-- eval use $filtered
|
||||
-- eval CREATE TABLE t1 (x int, y int) engine=$engine
|
||||
-- eval CREATE TABLE t2 (x int, y int) engine=$engine
|
||||
|
||||
SET @@session.sql_log_bin= 0;
|
||||
-- eval INSERT INTO $filtered.t1 VALUES (100,100)
|
||||
-- eval INSERT INTO $not_filtered.t1 VALUES (100,100)
|
||||
SET @@session.sql_log_bin= 1;
|
||||
|
||||
-- echo ### assertion: the inserts will not raise log error because
|
||||
-- echo ### binlog-do-db is filtering used database
|
||||
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
|
||||
INSERT INTO t1 SELECT * FROM t2;
|
||||
|
||||
-- echo ### assertion: assert that despite updating a not filtered
|
||||
-- echo ### database this wont trigger an error as the
|
||||
-- echo ### used database is the filtered one.
|
||||
-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
|
||||
|
||||
-- eval use $not_filtered
|
||||
-- echo ### assertion: the statements *will* raise log error because
|
||||
-- echo ### binlog-do-db is not filtering used database
|
||||
BEGIN;
|
||||
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
|
||||
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
|
||||
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
INSERT INTO t1 SELECT * FROM t2;
|
||||
COMMIT;
|
||||
|
||||
-- echo ### assertion: filtered events did not make into the binlog
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
-- eval DROP DATABASE $not_filtered
|
||||
-- eval DROP DATABASE $filtered
|
||||
SET @@session.tx_isolation= @old_isolation_level;
|
||||
@@ -0,0 +1,5 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
-- source extra/binlog_tests/drop_temp_table.test
|
||||
@@ -0,0 +1,5 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
-- source extra/binlog_tests/innodb_stat.test
|
||||
@@ -0,0 +1,5 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
-- source extra/binlog_tests/insert_select-binlog.test
|
||||
@@ -0,0 +1,15 @@
|
||||
# This is a wrapper for binlog.test so that the same test case can be used
|
||||
# For both statement and row based bin logs 9/19/2005 [jbm]
|
||||
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
CALL mtr.add_suppression("Statement may not be safe to log in statement format.");
|
||||
|
||||
-- source extra/binlog_tests/mix_innodb_myisam_binlog.test
|
||||
|
||||
set @@session.binlog_format=statement;
|
||||
-- source extra/binlog_tests/mix_innodb_myisam_side_effects.test
|
||||
set @@session.binlog_format=@@global.binlog_format;
|
||||
|
||||
|
||||
--echo end of tests
|
||||
26
build/lib/mysql/mysql-test/suite/binlog/t/binlog_stm_ps.test
Normal file
26
build/lib/mysql/mysql-test/suite/binlog/t/binlog_stm_ps.test
Normal file
@@ -0,0 +1,26 @@
|
||||
# This test is to verify replication with PS
|
||||
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
-- disable_query_log
|
||||
reset master; # get rid of previous tests binlog
|
||||
-- enable_query_log
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
reset master;
|
||||
|
||||
#
|
||||
# Bug #26842: master binary log contains invalid queries - replication fails
|
||||
#
|
||||
create table t1 (a int);
|
||||
prepare s from "insert into t1 values (@a),(?)";
|
||||
set @a=98; execute s using @a;
|
||||
prepare s from "insert into t1 values (?)";
|
||||
set @a=99; execute s using @a;
|
||||
prepare s from "insert into t1 select 100 limit ?";
|
||||
set @a=100; execute s using @a;
|
||||
source include/show_binlog_events.inc;
|
||||
drop table t1;
|
||||
114
build/lib/mysql/mysql-test/suite/binlog/t/binlog_stm_row.test
Normal file
114
build/lib/mysql/mysql-test/suite/binlog/t/binlog_stm_row.test
Normal file
@@ -0,0 +1,114 @@
|
||||
--source include/have_log_bin.inc
|
||||
# Test sets its own binlog_format, so we restrict it to run only once
|
||||
--source include/have_binlog_format_row.inc
|
||||
|
||||
CALL mtr.add_suppression("Statement may not be safe to log in statement format.");
|
||||
|
||||
# Get rid of previous tests binlog
|
||||
--disable_query_log
|
||||
reset master;
|
||||
--enable_query_log
|
||||
|
||||
#
|
||||
# Bug#34306: Can't make copy of log tables when server binary log is enabled
|
||||
#
|
||||
# This is an additional test for Bug#34306 in order to ensure that INSERT INTO
|
||||
# .. SELECT FROM is properly replicated under SBR and RBR and that the proper
|
||||
# read lock type are acquired.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
set @saved_global_binlog_format = @@global.binlog_format;
|
||||
set @saved_local_binlog_format = @@session.binlog_format;
|
||||
SET GLOBAL BINLOG_FORMAT = STATEMENT;
|
||||
SET SESSION BINLOG_FORMAT = STATEMENT;
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
select @@SESSION.BINLOG_FORMAT;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
INSERT INTO t2 VALUES(2);
|
||||
|
||||
--connect(con1,localhost,root,,)
|
||||
--connect(con2,localhost,root,,)
|
||||
|
||||
--echo #
|
||||
--echo # Ensure that INSERT INTO .. SELECT FROM under SBR takes a read
|
||||
--echo # lock that will prevent the source table from being modified.
|
||||
--echo #
|
||||
|
||||
--connection con1
|
||||
--echo # con1
|
||||
SELECT GET_LOCK('Bug#34306', 120);
|
||||
--connection con2
|
||||
--echo # con2
|
||||
PREPARE stmt FROM "INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)";
|
||||
--send EXECUTE stmt;
|
||||
--connection default
|
||||
--echo # default
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE
|
||||
state = "User lock" AND
|
||||
info = "INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)";
|
||||
--source include/wait_condition.inc
|
||||
--send INSERT INTO t2 VALUES (3);
|
||||
--connection con1
|
||||
--echo # con1
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE
|
||||
state = "Locked" and info = "INSERT INTO t2 VALUES (3)";
|
||||
--source include/wait_condition.inc
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
--connection con2
|
||||
--echo # con2
|
||||
--reap
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
--connection default
|
||||
--echo # default
|
||||
--reap
|
||||
|
||||
--echo #
|
||||
--echo # Ensure that INSERT INTO .. SELECT FROM prepared under SBR does
|
||||
--echo # not prevent the source table from being modified if under RBR.
|
||||
--echo #
|
||||
|
||||
--connection con2
|
||||
--echo # con2
|
||||
SET SESSION BINLOG_FORMAT = ROW;
|
||||
--connection con1
|
||||
--echo # con1
|
||||
SELECT GET_LOCK('Bug#34306', 120);
|
||||
--connection con2
|
||||
--echo # con2
|
||||
--send EXECUTE stmt;
|
||||
--connection default
|
||||
--echo # default
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE
|
||||
state = "User lock" AND
|
||||
info = "INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)";
|
||||
--source include/wait_condition.inc
|
||||
--connection con1
|
||||
--echo # con1
|
||||
INSERT INTO t2 VALUES (4);
|
||||
SELECT RELEASE_LOCK('Bug#34306');
|
||||
--connection con2
|
||||
--echo # con2
|
||||
--reap
|
||||
|
||||
--disconnect con1
|
||||
--disconnect con2
|
||||
--connection default
|
||||
--echo # default
|
||||
|
||||
--echo # Show binlog events
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
SET GLOBAL BINLOG_FORMAT = @saved_global_binlog_format;
|
||||
SET SESSION BINLOG_FORMAT = @saved_local_binlog_format;
|
||||
@@ -0,0 +1,130 @@
|
||||
# BUG#42851: Spurious "Statement is not safe to log in statement
|
||||
# format." warnings
|
||||
#
|
||||
# WHY
|
||||
# ===
|
||||
#
|
||||
# This test aims at checking that the fix that removes spurious
|
||||
# entries in the error log when the statement is filtered out from
|
||||
# binlog, is working.
|
||||
#
|
||||
# HOW
|
||||
# ===
|
||||
#
|
||||
# The test case is split into three assertions when issuing statements
|
||||
# containing LIMIT and ORDER BY:
|
||||
#
|
||||
# i) issue statements in database that is not filtered => check
|
||||
# that warnings ARE shown;
|
||||
#
|
||||
# ii) issue statements in database that is not filtered, but with
|
||||
# binlog disabled => check that warnings ARE NOT shown;
|
||||
#
|
||||
# iii) issue statements in database that is filtered => check that
|
||||
# warnings ARE NOT shown.
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
-- echo ### NOT filtered database => assertion: warnings ARE shown
|
||||
|
||||
-- disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
-- enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a int, b int, primary key (a));
|
||||
INSERT INTO t1 VALUES (1,2), (2,3);
|
||||
UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
|
||||
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
|
||||
DROP TABLE t1;
|
||||
|
||||
-- echo ### NOT filtered database => assertion: binlog disabled and warnings ARE NOT shown
|
||||
|
||||
SET SQL_LOG_BIN= 0;
|
||||
|
||||
-- disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
-- enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a int, b int, primary key (a));
|
||||
INSERT INTO t1 VALUES (1,2), (2,3);
|
||||
UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
|
||||
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
|
||||
DROP TABLE t1;
|
||||
|
||||
SET SQL_LOG_BIN= 1;
|
||||
|
||||
-- echo ### FILTERED database => assertion: warnings ARE NOT shown
|
||||
|
||||
let $old_db= `SELECT DATABASE()`;
|
||||
|
||||
CREATE DATABASE b42851;
|
||||
USE b42851;
|
||||
|
||||
-- disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
-- enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a int, b int, primary key (a));
|
||||
INSERT INTO t1 VALUES (1,2), (2,3);
|
||||
UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
|
||||
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# clean up
|
||||
DROP DATABASE b42851;
|
||||
|
||||
eval USE $old_db;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#46265: Can not disable warning about unsafe statements for binary logging
|
||||
--echo #
|
||||
|
||||
# Here introducing a sleep of one Second, just to make sure
|
||||
# that when this test executes with "--repeat" option,
|
||||
# the timestamp value is different and hence the Occcurrence count is one.
|
||||
--sleep 1
|
||||
|
||||
SET @old_log_warnings = @@log_warnings;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
let BINLOG_COUNTER1= `select CONVERT(NOW(),UNSIGNED) as timestmap from dual`;
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(15));
|
||||
SET GLOBAL LOG_WARNINGS = 0;
|
||||
# Replacing the result file content here.
|
||||
# Instead of writing $BINLOG_COUNTER1 value to result file, writing a fixed string timestamp to it.
|
||||
--replace_result $BINLOG_COUNTER1 timestamp
|
||||
eval INSERT INTO t1 VALUES(UUID(), '$BINLOG_COUNTER1');
|
||||
SET GLOBAL LOG_WARNINGS = 1;
|
||||
--replace_result $BINLOG_COUNTER1 timestamp
|
||||
eval INSERT INTO t1 VALUES(UUID(), '$BINLOG_COUNTER1');
|
||||
DROP TABLE t1;
|
||||
|
||||
SET GLOBAL log_warnings = @old_log_warnings;
|
||||
|
||||
let $log_error_= `SELECT @@GLOBAL.log_error`;
|
||||
if(!$log_error_)
|
||||
{
|
||||
# MySQL Server on windows is started with --console and thus
|
||||
# does not know the location of its .err log, use default location
|
||||
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
}
|
||||
# Assign env variable LOG_ERROR
|
||||
let LOG_ERROR=$log_error_;
|
||||
|
||||
--echo # Count the number of times the "Unsafe" message was printed
|
||||
--echo # to the error log.
|
||||
|
||||
perl;
|
||||
use strict;
|
||||
my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
|
||||
open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
|
||||
my $binlog_counter= $ENV{'BINLOG_COUNTER1'} or die "BINLOG_COUNTER1 not set";
|
||||
my $count = () = grep(/$binlog_counter/g,<FILE>);
|
||||
# Grep the timestamp value from the error file.
|
||||
print "Occurrences: $count\n";
|
||||
close(FILE);
|
||||
EOF
|
||||
150
build/lib/mysql/mysql-test/suite/binlog/t/binlog_tmp_table.test
Normal file
150
build/lib/mysql/mysql-test/suite/binlog/t/binlog_tmp_table.test
Normal file
@@ -0,0 +1,150 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test if statements used temporary tables are binlogged correctly
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Use two connections, use temporary tables on both of them, and by
|
||||
# switching connections between statements, the test can check if the
|
||||
# statements are logged with the correct thread id.
|
||||
#
|
||||
# The statements current tested include:
|
||||
# CREATE TEMPORARY TABLE
|
||||
# CREATE TEMPORARY TABLE LIKE
|
||||
# INSERT
|
||||
# REPLACE
|
||||
# UPDATE
|
||||
# INSERT SELECT
|
||||
# TRUNCATE
|
||||
#
|
||||
# Note: When adding new query statements, please add them between the
|
||||
# two 'flush logs'. And aslo please make sure the connection is
|
||||
# switched between each statement.
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#35583 mysqlbinlog replay fails with ERROR 1146 when temp tables are used
|
||||
#
|
||||
source include/have_log_bin.inc;
|
||||
source include/have_binlog_format_mixed_or_statement.inc;
|
||||
|
||||
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
RESET MASTER;
|
||||
|
||||
create table foo (a int);
|
||||
|
||||
flush logs;
|
||||
|
||||
connection master;
|
||||
create temporary table tmp1_foo like foo;
|
||||
connection master1;
|
||||
create temporary table tmp2_foo (a int);
|
||||
|
||||
connection master;
|
||||
insert into tmp1_foo values (1), (2), (3), (4);
|
||||
connection master1;
|
||||
replace into tmp2_foo values (1), (2), (3), (4);
|
||||
|
||||
connection master;
|
||||
update tmp1_foo set a=2*a-1;
|
||||
connection master1;
|
||||
update tmp2_foo set a=2*a;
|
||||
|
||||
connection master;
|
||||
delete from tmp1_foo where a < 5;
|
||||
connection master1;
|
||||
delete from tmp2_foo where a < 5;
|
||||
|
||||
connection master;
|
||||
insert into foo select * from tmp1_foo;
|
||||
connection master1;
|
||||
insert into foo select * from tmp2_foo;
|
||||
|
||||
connection master;
|
||||
truncate table tmp1_foo;
|
||||
connection master1;
|
||||
truncate table tmp2_foo;
|
||||
|
||||
flush logs;
|
||||
|
||||
connection default;
|
||||
select * from foo;
|
||||
|
||||
# prepare for the replay
|
||||
drop table foo;
|
||||
create table foo (a int);
|
||||
|
||||
# replay from binary log
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000002 | $MYSQL;
|
||||
select * from foo;
|
||||
|
||||
# clean up
|
||||
drop table foo;
|
||||
|
||||
#################################################################
|
||||
# BUG#51226
|
||||
#################################################################
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
-- let $dbname=b51226
|
||||
|
||||
connect (con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connect (con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
|
||||
#
|
||||
# action: on con1 create the database and the tmp table
|
||||
#
|
||||
-- connection con1
|
||||
-- eval create database $dbname
|
||||
-- eval use $dbname
|
||||
create temporary table t1(i int);
|
||||
|
||||
#
|
||||
# action: on con1 create the tmp table
|
||||
#
|
||||
-- connection con2
|
||||
-- eval use $dbname
|
||||
create temporary table t1(i int);
|
||||
|
||||
# action: at this point, the last event binlogged contains the
|
||||
# pseudo_thread_id from con2. So now we switch to con1, issue
|
||||
# a statement that fails and close the connection (which logs
|
||||
# implicitely a DROP TEMPORARY TABLE).
|
||||
#
|
||||
# Before the patch this would not log con1's pseudo_thread_id
|
||||
# because the failing statement would reset THD context
|
||||
# (unsetting the thread_specific_used flag, and consequently,
|
||||
# causing the DROP event to be logged without pseudo_thread_id
|
||||
# in its header).
|
||||
|
||||
-- connection con1
|
||||
-- error 1050
|
||||
create temporary table t1(i int);
|
||||
-- disconnect con1
|
||||
|
||||
-- connection default
|
||||
-- let $wait_binlog_event= DROP
|
||||
-- source include/wait_for_binlog_event.inc
|
||||
|
||||
# action: insert in the t1. This would cause the the test to fail,
|
||||
# because when replaying the binlog the previous implicit drop
|
||||
# temp table would have been executed under the wrong
|
||||
# pseudo_thread_id, dropping the tmp table on con2.
|
||||
-- connection con2
|
||||
insert into t1 values(1);
|
||||
-- disconnect con2
|
||||
|
||||
-- connection default
|
||||
-- let $wait_binlog_event= DROP
|
||||
-- source include/wait_for_binlog_event.inc
|
||||
|
||||
-- eval DROP DATABASE $dbname
|
||||
FLUSH LOGS;
|
||||
|
||||
# assertion: assert that when replaying the binary log will succeed,
|
||||
# instead of failing with "Table 'XXX.YYY' doesn't exist"
|
||||
-- let $MYSQLD_DATADIR= `select @@datadir`
|
||||
-- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL
|
||||
@@ -0,0 +1,29 @@
|
||||
source include/have_log_bin.inc;
|
||||
source include/have_innodb.inc;
|
||||
|
||||
# It is necessary to reset the master since otherwise the binlog test
|
||||
# might show the wrong binary log. The default for SHOW BINLOG EVENTS
|
||||
# is to show the first binary log, not the current one (which is
|
||||
# actually a better idea).
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
let $engine = InnoDB;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
||||
|
||||
# Under transaction isolation level READ UNCOMMITTED and READ
|
||||
# COMMITTED, InnoDB does not permit statement-based replication of
|
||||
# row-deleting statement. In these cases, TRUNCATE TABLE should still
|
||||
# be replicated as a statement.
|
||||
|
||||
let $before_truncate = SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
||||
|
||||
let $before_truncate = SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
||||
|
||||
let $before_truncate = SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
||||
|
||||
let $before_truncate = SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
||||
@@ -0,0 +1,11 @@
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
# It is necessary to reset the master since otherwise the binlog test
|
||||
# might show the wrong binary log. The default for SHOW BINLOG EVENTS
|
||||
# is to show the first binary log, not the current one (which is
|
||||
# actually a better idea).
|
||||
|
||||
RESET MASTER;
|
||||
|
||||
let $engine = MyISAM;
|
||||
source extra/binlog_tests/binlog_truncate.test;
|
||||
447
build/lib/mysql/mysql-test/suite/binlog/t/binlog_unsafe.test
Normal file
447
build/lib/mysql/mysql-test/suite/binlog/t/binlog_unsafe.test
Normal file
@@ -0,0 +1,447 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Some statements can not be written to the binlog in a safe manner
|
||||
# with statement-based replication, either because they rely on
|
||||
# features that are local to the server they are replicated from
|
||||
# (e.g., @@variables), or because they include nondeterministic
|
||||
# queries (e.g., LIMIT), or because the time at which the query is
|
||||
# executed cannot be determined (e.g., INSERT DELAYED). Such
|
||||
# statements should be marked unsafe. All unsafe statements should
|
||||
# give a warning.
|
||||
# Yet the warning/error message isn't issued when SQL_LOG_BIN is turned off.
|
||||
#
|
||||
# This test verifies that a warning is generated for statements that
|
||||
# should be unsafe, when they are executed under statement mode
|
||||
# logging.
|
||||
#
|
||||
# All variables should be unsafe, with some exceptions. Therefore,
|
||||
# this test also verifies that the exceptions do *not* generare a
|
||||
# warning.
|
||||
#
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# We try an INSERT DELAYED statement and verify that a warning is
|
||||
# issued.
|
||||
#
|
||||
# We try to insert unsafe variables into a table in several ways:
|
||||
# directly with an INSERT statement, from a stored procedure, from a
|
||||
# stored function, from a trigger, from a prepared statement, and from
|
||||
# a complicated nesting of triggers, functions, procedures, and
|
||||
# prepared statements. In all cases, a warning should be issued.
|
||||
#
|
||||
# We try to insert the variables that should not be unsafe into a
|
||||
# table, and verify that *no* warning is issued.
|
||||
#
|
||||
# Execute a unsafe statement calling a trigger or stored function
|
||||
# or neither when SQL_LOG_BIN is turned ON, a warning/error should be issued
|
||||
# Execute a unsafe statement calling a trigger or stored function
|
||||
# or neither when @@SQL_LOG_BIN is turned OFF,
|
||||
# no warning/error is issued
|
||||
|
||||
# ==== Related bugs and worklogs ====
|
||||
#
|
||||
# WL#3339: Issue warnings when statement-based replication may fail
|
||||
# BUG#31168: @@hostname does not replicate
|
||||
# BUG#34732: mysqlbinlog does not print default values for auto_increment variables
|
||||
# BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed
|
||||
# BUG#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0
|
||||
# BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
|
||||
# BUG#47995: Mark user functions as unsafe
|
||||
# BUG#49222: Mare RAND() unsafe
|
||||
#
|
||||
# ==== Related test cases ====
|
||||
#
|
||||
# rpl.rpl_variables verifies that variables which cannot be replicated
|
||||
# safely in statement mode are replicated correctly in mixed or row
|
||||
# mode.
|
||||
#
|
||||
# rpl.rpl_variables_stm tests the small subset of variables that
|
||||
# actually can be replicated safely in statement mode.
|
||||
#
|
||||
#
|
||||
# ==== Todo ====
|
||||
#
|
||||
# There are several other ways to create unsafe statements: see, e.g.,
|
||||
# WL#3339, BUG#34768.
|
||||
|
||||
source include/have_log_bin.inc;
|
||||
source include/have_binlog_format_statement.inc;
|
||||
|
||||
--echo ==== Setup tables ====
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a TEXT);
|
||||
CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY);
|
||||
CREATE TABLE trigger_table (a TEXT);
|
||||
CREATE TABLE trigger_table2 (a INT);
|
||||
|
||||
|
||||
--echo ==== Non-deterministic statements ====
|
||||
|
||||
INSERT DELAYED INTO t1 VALUES (5);
|
||||
|
||||
|
||||
--echo ==== Some variables that *should* be unsafe ====
|
||||
|
||||
--echo ---- Insert directly ----
|
||||
|
||||
INSERT INTO t1 VALUES (@@global.sync_binlog);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
|
||||
INSERT INTO t2 SELECT UUID();
|
||||
INSERT INTO t2 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t2 VALUES (@@global.init_slave);
|
||||
INSERT INTO t2 VALUES (@@hostname);
|
||||
|
||||
--echo ---- Insert from stored procedure ----
|
||||
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE proc()
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (@@global.sync_binlog);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
|
||||
INSERT INTO t2 SELECT UUID();
|
||||
INSERT INTO t2 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t2 VALUES (@@global.init_slave);
|
||||
INSERT INTO t2 VALUES (@@hostname);
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
CALL proc();
|
||||
|
||||
--echo ---- Insert from stored function ----
|
||||
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION func()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (@@global.sync_binlog);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
|
||||
INSERT INTO t2 SELECT UUID();
|
||||
INSERT INTO t2 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t2 VALUES (@@global.init_slave);
|
||||
INSERT INTO t2 VALUES (@@hostname);
|
||||
RETURN 0;
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
SELECT func();
|
||||
|
||||
--echo ---- Insert from trigger ----
|
||||
|
||||
DELIMITER |;
|
||||
CREATE TRIGGER trig
|
||||
BEFORE INSERT ON trigger_table
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (@@global.sync_binlog);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
|
||||
INSERT INTO t2 SELECT UUID();
|
||||
INSERT INTO t2 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t2 VALUES (@@global.init_slave);
|
||||
INSERT INTO t2 VALUES (@@hostname);
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
INSERT INTO trigger_table VALUES ('bye.');
|
||||
|
||||
--echo ---- Insert from prepared statement ----
|
||||
|
||||
PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)';
|
||||
PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)';
|
||||
PREPARE p3 FROM 'INSERT INTO t1 VALUES (@@global.auto_increment_increment)';
|
||||
PREPARE p4 FROM 'INSERT INTO t2 SELECT UUID()';
|
||||
PREPARE p5 FROM 'INSERT INTO t2 VALUES (@@session.sql_mode)';
|
||||
PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)';
|
||||
PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)';
|
||||
|
||||
EXECUTE p1; EXECUTE p2; EXECUTE p3; EXECUTE p4; EXECUTE p5;
|
||||
EXECUTE p6; EXECUTE p7;
|
||||
|
||||
--echo ---- Insert from nested call of triggers / functions / procedures ----
|
||||
|
||||
DELIMITER |;
|
||||
|
||||
# proc1: cause trigger 'trig' above to be triggered.
|
||||
CREATE PROCEDURE proc1()
|
||||
INSERT INTO trigger_table VALUES ('ha!')|
|
||||
|
||||
# func2: call proc1 above.
|
||||
CREATE FUNCTION func2()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
CALL proc1();
|
||||
RETURN 0;
|
||||
END|
|
||||
|
||||
# trig3: call func2 above
|
||||
CREATE TRIGGER trig3
|
||||
BEFORE INSERT ON trigger_table2
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE tmp INT;
|
||||
SELECT func2() INTO tmp;
|
||||
END|
|
||||
|
||||
# proc4: cause trig3 above to be triggered.
|
||||
CREATE PROCEDURE proc4()
|
||||
INSERT INTO trigger_table2 VALUES (1)|
|
||||
|
||||
# func5: call proc4 above.
|
||||
CREATE FUNCTION func5()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
CALL proc4;
|
||||
RETURN 0;
|
||||
END|
|
||||
|
||||
# prep6: call func5() above.
|
||||
PREPARE prep6 FROM 'SELECT func5()'|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
# try a complicated call path to trigger 'trig'.
|
||||
EXECUTE prep6;
|
||||
|
||||
|
||||
--echo ==== Variables that should *not* be unsafe ====
|
||||
|
||||
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
|
||||
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
|
||||
INSERT INTO t1 VALUES (@@session.foreign_key_checks);
|
||||
INSERT INTO t1 VALUES (@@session.sql_auto_is_null);
|
||||
INSERT INTO t1 VALUES (@@session.unique_checks);
|
||||
INSERT INTO t1 VALUES (@@session.auto_increment_increment);
|
||||
INSERT INTO t1 VALUES (@@session.auto_increment_offset);
|
||||
INSERT INTO t2 VALUES (@@session.character_set_client);
|
||||
INSERT INTO t2 VALUES (@@session.collation_connection);
|
||||
INSERT INTO t2 VALUES (@@session.collation_server);
|
||||
INSERT INTO t2 VALUES (@@session.time_zone);
|
||||
INSERT INTO t2 VALUES (@@session.lc_time_names);
|
||||
INSERT INTO t2 VALUES (@@session.collation_database);
|
||||
INSERT INTO t2 VALUES (@@session.timestamp);
|
||||
INSERT INTO t2 VALUES (@@session.last_insert_id);
|
||||
SET @my_var= 4711;
|
||||
INSERT INTO t1 VALUES (@my_var);
|
||||
|
||||
# using insert_id implicitly should be ok.
|
||||
SET insert_id=12;
|
||||
INSERT INTO t3 VALUES (NULL);
|
||||
|
||||
|
||||
--echo ==== Clean up ====
|
||||
|
||||
DROP PROCEDURE proc;
|
||||
DROP FUNCTION func;
|
||||
DROP TRIGGER trig;
|
||||
DROP PROCEDURE proc1;
|
||||
DROP FUNCTION func2;
|
||||
DROP TRIGGER trig3;
|
||||
DROP PROCEDURE proc4;
|
||||
DROP FUNCTION func5;
|
||||
DROP PREPARE prep6;
|
||||
DROP TABLE t1, t2, t3, trigger_table, trigger_table2;
|
||||
#
|
||||
# BUG#34768 - nondeterministic INSERT using LIMIT logged in stmt mode if
|
||||
# binlog_format=mixed
|
||||
#
|
||||
CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b));
|
||||
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
|
||||
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
|
||||
UPDATE t1 SET a=1 LIMIT 1;
|
||||
DELETE FROM t1 LIMIT 1;
|
||||
delimiter |;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
|
||||
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
|
||||
UPDATE t1 SET a=1 LIMIT 1;
|
||||
DELETE FROM t1 LIMIT 1;
|
||||
END|
|
||||
delimiter ;|
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#42634: % character in query can cause mysqld signal 11 segfault
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100));
|
||||
INSERT INTO t1 VALUES ('a','b');
|
||||
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
#For bug#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1(i INT PRIMARY KEY);
|
||||
CREATE TABLE t2(i INT PRIMARY KEY);
|
||||
CREATE TABLE t3(i INT, ch CHAR(50));
|
||||
|
||||
--echo "Should issue message Statement may not be safe to log in statement format."
|
||||
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
|
||||
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION func6()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (10);
|
||||
INSERT INTO t1 VALUES (11);
|
||||
INSERT INTO t1 VALUES (12);
|
||||
RETURN 0;
|
||||
END|
|
||||
DELIMITER ;|
|
||||
--echo "Should issue message Statement may not be safe to log in statement format only once"
|
||||
INSERT INTO t3 VALUES(func6(), UUID());
|
||||
|
||||
--echo "Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements"
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION fun_check_log_bin() RETURNS INT
|
||||
BEGIN
|
||||
SET @@SQL_LOG_BIN = 0;
|
||||
INSERT INTO t1 VALUES(@@global.sync_binlog);
|
||||
RETURN 100;
|
||||
END|
|
||||
DELIMITER ;|
|
||||
--echo "One unsafe warning should be issued in the following statement"
|
||||
SELECT fun_check_log_bin();
|
||||
--echo "SQL_LOG_BIN should be ON still"
|
||||
SHOW VARIABLES LIKE "SQL_LOG_BIN";
|
||||
|
||||
set @save_log_bin = @@SESSION.SQL_LOG_BIN;
|
||||
set @@SESSION.SQL_LOG_BIN = 0;
|
||||
--echo "Should NOT have any warning message issued in the following statements"
|
||||
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo "Should NOT have any warning message issued in the following func7() and trig"
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a TEXT);
|
||||
CREATE TABLE trigger_table (a CHAR(7));
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION func7()
|
||||
RETURNS INT
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (@@global.sync_binlog);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
INSERT INTO t2 SELECT UUID();
|
||||
INSERT INTO t2 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t2 VALUES (@@global.init_slave);
|
||||
RETURN 0;
|
||||
END|
|
||||
DELIMITER ;|
|
||||
SHOW VARIABLES LIKE "SQL_LOG_BIN";
|
||||
SELECT func7();
|
||||
|
||||
--echo ---- Insert from trigger ----
|
||||
|
||||
DELIMITER |;
|
||||
CREATE TRIGGER trig
|
||||
BEFORE INSERT ON trigger_table
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t1 VALUES (@@global.sync_binlog);
|
||||
INSERT INTO t1 VALUES (@@session.insert_id);
|
||||
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
|
||||
INSERT INTO t2 SELECT UUID();
|
||||
INSERT INTO t2 VALUES (@@session.sql_mode);
|
||||
INSERT INTO t2 VALUES (@@global.init_slave);
|
||||
INSERT INTO t2 VALUES (@@hostname);
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
INSERT INTO trigger_table VALUES ('bye.');
|
||||
|
||||
#clean up
|
||||
DROP FUNCTION fun_check_log_bin;
|
||||
DROP FUNCTION func6;
|
||||
DROP FUNCTION func7;
|
||||
DROP TRIGGER trig;
|
||||
DROP TABLE t1, t2, t3, trigger_table;
|
||||
set @@SESSION.SQL_LOG_BIN = @save_log_bin;
|
||||
|
||||
#
|
||||
# For BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
|
||||
#
|
||||
SET @save_sql_mode = @@SESSION.SQL_MODE;
|
||||
SET @@SESSION.SQL_MODE = STRICT_ALL_TABLES;
|
||||
|
||||
CREATE TABLE t1(i INT PRIMARY KEY);
|
||||
CREATE TABLE t2(i INT PRIMARY KEY);
|
||||
|
||||
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
|
||||
INSERT INTO t1 VALUES(@@global.sync_binlog);
|
||||
|
||||
UPDATE t1 SET i = 999 LIMIT 1;
|
||||
DELETE FROM t1 LIMIT 1;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
SET @@SESSION.SQL_MODE = @save_sql_mode;
|
||||
|
||||
#
|
||||
# BUG#47995: Mark user functions as unsafe
|
||||
# BUG#49222: Mare RAND() unsafe
|
||||
#
|
||||
# Test that the system functions that are supposed to be marked unsafe
|
||||
# generate a warning. Each INSERT statement below should generate a
|
||||
# warning.
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(1000));
|
||||
INSERT INTO t1 VALUES (CURRENT_USER()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (FOUND_ROWS()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1)); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp')); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp')); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat')); #marked unsafe in BUG#39701
|
||||
INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
|
||||
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp')); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (ROW_COUNT()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (SESSION_USER()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (SLEEP(1)); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (SYSDATE()); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (SYSTEM_USER()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (USER()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (UUID()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (UUID_SHORT()); #marked unsafe before BUG#47995
|
||||
INSERT INTO t1 VALUES (VERSION()); #marked unsafe in BUG#47995
|
||||
INSERT INTO t1 VALUES (RAND()); #marked unsafe in BUG#49222
|
||||
DELETE FROM t1;
|
||||
|
||||
# Since we replicate the TIMESTAMP variable, functions affected by the
|
||||
# TIMESTAMP variable are safe to replicate. So we check that the
|
||||
# following following functions that depend on the TIMESTAMP variable
|
||||
# are not unsafe and don't generate a warning.
|
||||
|
||||
SET TIMESTAMP=1000000;
|
||||
INSERT INTO t1 VALUES
|
||||
(CURDATE()),
|
||||
(CURRENT_DATE()),
|
||||
(CURRENT_TIME()),
|
||||
(CURRENT_TIMESTAMP()),
|
||||
(CURTIME()),
|
||||
(LOCALTIME()),
|
||||
(LOCALTIMESTAMP()),
|
||||
(NOW()),
|
||||
(UNIX_TIMESTAMP()),
|
||||
(UTC_DATE()),
|
||||
(UTC_TIME()),
|
||||
(UTC_TIMESTAMP());
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo "End of tests"
|
||||
@@ -0,0 +1,101 @@
|
||||
#
|
||||
# === Name ===
|
||||
#
|
||||
# binlog_write_error.test
|
||||
#
|
||||
# === Description ===
|
||||
#
|
||||
# This test case check if the error of writing binlog file is properly
|
||||
# reported and handled when executing statements.
|
||||
#
|
||||
# === Related Bugs ===
|
||||
#
|
||||
# BUG#37148
|
||||
#
|
||||
|
||||
source include/have_log_bin.inc;
|
||||
source include/have_debug.inc;
|
||||
|
||||
--echo #
|
||||
--echo # Initialization
|
||||
--echo #
|
||||
|
||||
disable_warnings;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP TRIGGER IF EXISTS tr1;
|
||||
DROP TRIGGER IF EXISTS tr2;
|
||||
DROP VIEW IF EXISTS v1, v2;
|
||||
enable_warnings;
|
||||
|
||||
--echo #
|
||||
--echo # Test injecting binlog write error when executing queries
|
||||
--echo #
|
||||
|
||||
let $query= CREATE TABLE t1 (a INT);
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
|
||||
let $query= INSERT INTO t1 VALUES (4),(5),(6);
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= UPDATE t1 set a=a+1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= DELETE FROM t1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t1 VALUES (new.a + 100);
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= DROP TRIGGER tr1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= ALTER TABLE t1 ADD (b INT);
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= CREATE VIEW v1 AS SELECT a FROM t1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= DROP VIEW v1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= CREATE PROCEDURE p1(OUT rows INT) SELECT count(*) INTO rows FROM t1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= DROP PROCEDURE p1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= DROP TABLE t1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= CREATE FUNCTION f1() RETURNS INT return 1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= DROP FUNCTION f1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= CREATE USER user1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
let $query= DROP USER user1;
|
||||
source include/binlog_inject_error.inc;
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
|
||||
disable_warnings;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP TRIGGER IF EXISTS tr1;
|
||||
DROP VIEW IF EXISTS v1, v2;
|
||||
enable_warnings;
|
||||
13
build/lib/mysql/mysql-test/suite/binlog/t/disabled.def
Normal file
13
build/lib/mysql/mysql-test/suite/binlog/t/disabled.def
Normal file
@@ -0,0 +1,13 @@
|
||||
##############################################################################
|
||||
#
|
||||
# List the test cases that are to be disabled temporarily.
|
||||
#
|
||||
# Separate the test case name and the comment with ':'.
|
||||
#
|
||||
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
|
||||
#
|
||||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
binlog_truncate_innodb : BUG#11764459 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
|
||||
binlog_row_failure_mixing_engines : BUG#11765446 2010-11-23 ramil Fails on win x86 debug_max
|
||||
Reference in New Issue
Block a user