mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
Merge into local tree
This commit is contained in:
commit
6c85783c20
56 changed files with 18738 additions and 86 deletions
|
@ -389,6 +389,9 @@ client/readline.cpp
|
|||
client/rpl_constants.h
|
||||
client/rpl_record_old.cc
|
||||
client/rpl_record_old.h
|
||||
client/rpl_tblmap.h
|
||||
client/rpl_tblmap.cc
|
||||
client/rpl_utility.h
|
||||
client/select_test
|
||||
client/sql_string.cpp
|
||||
client/ssl_test
|
||||
|
|
|
@ -104,6 +104,7 @@ DEFS = -DUNDEF_THREADS_HACK \
|
|||
-DDATADIR="\"$(localstatedir)\""
|
||||
|
||||
sql_src=log_event.h mysql_priv.h rpl_constants.h \
|
||||
rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \
|
||||
log_event.cc my_decimal.h my_decimal.cc \
|
||||
log_event_old.h log_event_old.cc \
|
||||
rpl_record_old.h rpl_record_old.cc
|
||||
|
|
|
@ -64,7 +64,8 @@ static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
|||
|
||||
static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
|
||||
static bool opt_hexdump= 0;
|
||||
const char *base64_output_mode_names[]= {"NEVER", "AUTO", "ALWAYS", NullS};
|
||||
const char *base64_output_mode_names[]=
|
||||
{"NEVER", "AUTO", "ALWAYS", "UNSPEC", "DECODE-ROWS", NullS};
|
||||
TYPELIB base64_output_mode_typelib=
|
||||
{ array_elements(base64_output_mode_names) - 1, "",
|
||||
base64_output_mode_names, NULL };
|
||||
|
@ -83,6 +84,8 @@ static const char* user = 0;
|
|||
static char* pass = 0;
|
||||
static char *charset= 0;
|
||||
|
||||
static uint verbose= 0;
|
||||
|
||||
static ulonglong start_position, stop_position;
|
||||
#define start_position_mot ((my_off_t)start_position)
|
||||
#define stop_position_mot ((my_off_t)stop_position)
|
||||
|
@ -1063,6 +1066,9 @@ that may lead to an endless loop.",
|
|||
{"user", 'u', "Connect to the remote server as username.",
|
||||
(uchar**) &user, (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
{"verbose", 'v', "Reconstruct SQL statements out of row events. "
|
||||
"-v -v adds comments on column data types",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
|
||||
0, 0, 0, 0, 0},
|
||||
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
|
||||
|
@ -1258,6 +1264,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
(find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1);
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
if (argument == disabled_my_option)
|
||||
verbose= 0;
|
||||
else
|
||||
verbose++;
|
||||
break;
|
||||
case 'V':
|
||||
print_version();
|
||||
exit(0);
|
||||
|
@ -1343,6 +1355,8 @@ static Exit_status dump_log_entries(const char* logname)
|
|||
*/
|
||||
fprintf(result_file, "DELIMITER /*!*/;\n");
|
||||
strmov(print_event_info.delimiter, "/*!*/;");
|
||||
|
||||
print_event_info.verbose= short_form ? 0 : verbose;
|
||||
|
||||
rc= (remote_opt ? dump_remote_log_entries(&print_event_info, logname) :
|
||||
dump_local_log_entries(&print_event_info, logname));
|
||||
|
|
|
@ -13,3 +13,18 @@ create trigger tr1 before insert on t1 for each row insert into t2 values (2*new
|
|||
create procedure sp1 (a int) insert into t1 values(a);
|
||||
drop database testing_1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# BUG#38773: DROP DATABASE cause switch to stmt-mode when there are
|
||||
# temporary tables open
|
||||
|
||||
use test;
|
||||
reset master;
|
||||
create temporary table tt1 (a int);
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
disable_warnings;
|
||||
drop database if exists mysqltest1;
|
||||
enable_warnings;
|
||||
insert into t1 values (1);
|
||||
drop table tt1, t1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
|
1922
mysql-test/include/mysqlbinlog_row_engine.inc
Normal file
1922
mysql-test/include/mysqlbinlog_row_engine.inc
Normal file
File diff suppressed because it is too large
Load diff
24
mysql-test/include/wait_for_slave_sql_error_and_skip.inc
Normal file
24
mysql-test/include/wait_for_slave_sql_error_and_skip.inc
Normal file
|
@ -0,0 +1,24 @@
|
|||
# ==== Purpose ====
|
||||
#
|
||||
# Wait for slave SQL error, skip the erroneous statement and restart
|
||||
# slave
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# let show_sql_error=0|1;
|
||||
# source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
echo --source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
connection slave;
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
if ($show_sql_error)
|
||||
{
|
||||
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
echo Last_SQL_Error = $error;
|
||||
}
|
||||
|
||||
# skip the erroneous statement
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
connection master;
|
|
@ -2372,3 +2372,79 @@ a MIN(b) MAX(b) AVG(b)
|
|||
2 1 3 2.0000
|
||||
1 1 3 2.0000
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int, b int, primary key (a,b), key `index` (a,b)) engine=MyISAM;
|
||||
insert into t1 (a,b) values
|
||||
(0,0),(0,1),(0,2),(0,3),(0,4),(0,5),(0,6),
|
||||
(0,7),(0,8),(0,9),(0,10),(0,11),(0,12),(0,13),
|
||||
(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),
|
||||
(1,7),(1,8),(1,9),(1,10),(1,11),(1,12),(1,13),
|
||||
(2,0),(2,1),(2,2),(2,3),(2,4),(2,5),(2,6),
|
||||
(2,7),(2,8),(2,9),(2,10),(2,11),(2,12),(2,13),
|
||||
(3,0),(3,1),(3,2),(3,3),(3,4),(3,5),(3,6),
|
||||
(3,7),(3,8),(3,9),(3,10),(3,11),(3,12),(3,13);
|
||||
insert into t1 (a,b) select a, max(b)+1 from t1 where a = 0 group by a;
|
||||
select * from t1;
|
||||
a b
|
||||
0 0
|
||||
0 1
|
||||
0 2
|
||||
0 3
|
||||
0 4
|
||||
0 5
|
||||
0 6
|
||||
0 7
|
||||
0 8
|
||||
0 9
|
||||
0 10
|
||||
0 11
|
||||
0 12
|
||||
0 13
|
||||
0 14
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
1 4
|
||||
1 5
|
||||
1 6
|
||||
1 7
|
||||
1 8
|
||||
1 9
|
||||
1 10
|
||||
1 11
|
||||
1 12
|
||||
1 13
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 3
|
||||
2 4
|
||||
2 5
|
||||
2 6
|
||||
2 7
|
||||
2 8
|
||||
2 9
|
||||
2 10
|
||||
2 11
|
||||
2 12
|
||||
2 13
|
||||
3 0
|
||||
3 1
|
||||
3 2
|
||||
3 3
|
||||
3 4
|
||||
3 5
|
||||
3 6
|
||||
3 7
|
||||
3 8
|
||||
3 9
|
||||
3 10
|
||||
3 11
|
||||
3 12
|
||||
3 13
|
||||
explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 range PRIMARY,index PRIMARY 4 NULL 3 100.00 Using where; Using index for group-by; Using temporary
|
||||
Warnings:
|
||||
Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,(max(`test`.`t1`.`b`) + 1) AS `max(b)+1` from `test`.`t1` where (`test`.`t1`.`a` = 0) group by `test`.`t1`.`a`
|
||||
drop table t1;
|
||||
|
|
|
@ -627,7 +627,7 @@ a b
|
|||
4 4
|
||||
show master status /* there must be the UPDATE query event */;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 197
|
||||
master-bin.000001 206
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
insert into t1 values (1,2),(3,4),(4,4);
|
||||
|
@ -637,7 +637,7 @@ UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
|
|||
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
|
||||
show master status /* there must be the UPDATE query event */;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 212
|
||||
master-bin.000001 221
|
||||
drop table t1, t2;
|
||||
set @@session.binlog_format= @sav_binlog_format;
|
||||
drop table if exists t1, t2, t3;
|
||||
|
|
|
@ -1831,6 +1831,28 @@ id ref
|
|||
3 2
|
||||
4 5
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (a INT) ENGINE=MyISAM CHECKSUM=1 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES (0);
|
||||
UPDATE t1 SET a=1;
|
||||
SELECT a FROM t1;
|
||||
a
|
||||
1
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
INSERT INTO t1 VALUES (0), (5), (4), (2);
|
||||
UPDATE t1 SET a=2;
|
||||
SELECT a FROM t1;
|
||||
a
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
create table t1 (a int not null, key `a` (a) key_block_size=1024);
|
||||
show create table t1;
|
||||
|
|
4137
mysql-test/r/mysqlbinlog_row.result
Normal file
4137
mysql-test/r/mysqlbinlog_row.result
Normal file
File diff suppressed because it is too large
Load diff
74
mysql-test/r/mysqlbinlog_row_big.result
Normal file
74
mysql-test/r/mysqlbinlog_row_big.result
Normal file
|
@ -0,0 +1,74 @@
|
|||
#
|
||||
# Preparatory cleanup.
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
#
|
||||
# We need a fixed timestamp to avoid varying results.
|
||||
#
|
||||
SET timestamp=1000000000;
|
||||
#
|
||||
# We need big packets.
|
||||
#
|
||||
SET @@session.max_allowed_packet= 1024*1024*1024;
|
||||
#
|
||||
# Delete all existing binary logs.
|
||||
#
|
||||
RESET MASTER;
|
||||
#
|
||||
# Create a test table.
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
c1 LONGTEXT
|
||||
) ENGINE=MyISAM DEFAULT CHARSET latin1;
|
||||
#
|
||||
# Show how much rows are affected by each statement.
|
||||
#
|
||||
#
|
||||
# Insert a big row.
|
||||
#
|
||||
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
|
||||
affected rows: 1
|
||||
#
|
||||
# Show what we have in the table.
|
||||
# Do not display the column value itself, just its length.
|
||||
#
|
||||
SELECT LENGTH(c1) FROM t1;
|
||||
LENGTH(c1) 33554432
|
||||
affected rows: 1
|
||||
#
|
||||
# Grow the row by updating.
|
||||
#
|
||||
UPDATE t1 SET c1 = CONCAT(c1, c1);
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
#
|
||||
# Show what we have in the table.
|
||||
# Do not display the column value itself, just its length.
|
||||
#
|
||||
SELECT LENGTH(c1) FROM t1;
|
||||
LENGTH(c1) 67108864
|
||||
affected rows: 1
|
||||
#
|
||||
# Delete the row.
|
||||
#
|
||||
DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
|
||||
affected rows: 1
|
||||
#
|
||||
# Hide how much rows are affected by each statement.
|
||||
#
|
||||
#
|
||||
# Flush all log buffers to the log file.
|
||||
#
|
||||
FLUSH LOGS;
|
||||
#
|
||||
# Call mysqlbinlog to display the log file contents.
|
||||
# NOTE: The output of mysqlbinlog is redirected to
|
||||
# $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out
|
||||
# If you want to examine it, disable remove_file
|
||||
# at the bottom of the test script.
|
||||
#
|
||||
#
|
||||
# Cleanup.
|
||||
#
|
||||
DROP TABLE t1;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out
|
4859
mysql-test/r/mysqlbinlog_row_innodb.result
Normal file
4859
mysql-test/r/mysqlbinlog_row_innodb.result
Normal file
File diff suppressed because it is too large
Load diff
4899
mysql-test/r/mysqlbinlog_row_myisam.result
Normal file
4899
mysql-test/r/mysqlbinlog_row_myisam.result
Normal file
File diff suppressed because it is too large
Load diff
500
mysql-test/r/mysqlbinlog_row_trans.result
Normal file
500
mysql-test/r/mysqlbinlog_row_trans.result
Normal file
|
@ -0,0 +1,500 @@
|
|||
#
|
||||
# Preparatory cleanup.
|
||||
#
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
#
|
||||
# We need a fixed timestamp to avoid varying results.
|
||||
#
|
||||
SET timestamp=1000000000;
|
||||
#
|
||||
# Delete all existing binary logs.
|
||||
#
|
||||
RESET MASTER;
|
||||
#
|
||||
# Create test tables.
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 VARCHAR(20)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET latin1;
|
||||
CREATE TABLE t2 (
|
||||
c1 INT,
|
||||
c2 VARCHAR(20)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET latin1;
|
||||
#
|
||||
# Start transaction #1, transactional table only, commit.
|
||||
#
|
||||
START TRANSACTION;
|
||||
#
|
||||
# Do some statements.
|
||||
#
|
||||
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;
|
||||
#
|
||||
# Commit transaction.
|
||||
#
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
11 varchar-1
|
||||
13 varchar-3
|
||||
TRUNCATE TABLE t1;
|
||||
#
|
||||
# Start transaction #2, transactional table only, rollback.
|
||||
#
|
||||
START TRANSACTION;
|
||||
#
|
||||
# Do some statements.
|
||||
#
|
||||
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;
|
||||
#
|
||||
# Rollback transaction.
|
||||
#
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
TRUNCATE TABLE t1;
|
||||
#
|
||||
# Start transaction #3, both tables, commit.
|
||||
#
|
||||
START TRANSACTION;
|
||||
#
|
||||
# Do some statements on the transactional table.
|
||||
#
|
||||
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;
|
||||
#
|
||||
# Do some statements on the non-transactional table.
|
||||
#
|
||||
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;
|
||||
#
|
||||
# Commit transaction.
|
||||
#
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
11 varchar-1
|
||||
13 varchar-3
|
||||
SELECT * FROM t2;
|
||||
c1 c2
|
||||
11 varchar-1
|
||||
13 varchar-3
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
#
|
||||
# Start transaction #4, both tables, rollback.
|
||||
#
|
||||
START TRANSACTION;
|
||||
#
|
||||
# Do some statements on the transactional table.
|
||||
#
|
||||
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;
|
||||
#
|
||||
# Do some statements on the non-transactional table.
|
||||
#
|
||||
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;
|
||||
#
|
||||
# Rollback transaction.
|
||||
#
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
SELECT * FROM t2;
|
||||
c1 c2
|
||||
11 varchar-1
|
||||
13 varchar-3
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
#
|
||||
# Flush all log buffers to the log file.
|
||||
#
|
||||
FLUSH LOGS;
|
||||
#
|
||||
# Call mysqlbinlog to display the log file contents.
|
||||
#
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
|
||||
ROLLBACK/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.pseudo_thread_id=#/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 VARCHAR(20)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET latin1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
CREATE TABLE t2 (
|
||||
c1 INT,
|
||||
c2 VARCHAR(20)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET latin1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t2
|
||||
### WHERE
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t2
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t2
|
||||
### WHERE
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
ROLLBACK
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t2
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
#
|
||||
# Cleanup.
|
||||
#
|
||||
DROP TABLE t1, t2;
|
|
@ -113,9 +113,9 @@ set @@sql_mode=@org_mode;
|
|||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||
ERROR HY000: Incorrect arguments to DATA DIRECTORY
|
||||
Got one of the listed errors
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p0,
|
||||
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||
ERROR HY000: Incorrect arguments to DATA DIRECTORY
|
||||
Got one of the listed errors
|
||||
|
|
|
@ -4409,4 +4409,43 @@ pk a
|
|||
3 30
|
||||
2 20
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY b (b));
|
||||
INSERT INTO t1 VALUES (1,NULL), (9,NULL);
|
||||
CREATE TABLE t2 (
|
||||
a int,
|
||||
b int,
|
||||
c int,
|
||||
d int,
|
||||
PRIMARY KEY (a),
|
||||
UNIQUE KEY b (b,c,d),
|
||||
KEY b_2 (b),
|
||||
KEY c (c),
|
||||
KEY d (d)
|
||||
);
|
||||
INSERT INTO t2 VALUES
|
||||
(43, 2, 11 ,30),
|
||||
(44, 2, 12 ,30),
|
||||
(45, 1, 1 ,10000),
|
||||
(46, 1, 2 ,10000),
|
||||
(556,1, 32 ,10000);
|
||||
CREATE TABLE t3 (
|
||||
a int,
|
||||
b int,
|
||||
c int,
|
||||
PRIMARY KEY (a),
|
||||
UNIQUE KEY b (b,c),
|
||||
KEY c (c),
|
||||
KEY b_2 (b)
|
||||
);
|
||||
INSERT INTO t3 VALUES (1,1,1), (2,32,1);
|
||||
explain
|
||||
SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t3 index b,b_2 b 10 NULL 2 Using index
|
||||
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.b 1 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index b,b_2,c d 5 NULL 1 Using where
|
||||
SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
|
||||
a incorrect
|
||||
1 1
|
||||
DROP TABLE t1,t2,t3;
|
||||
End of 5.1 tests.
|
||||
|
|
|
@ -55,13 +55,9 @@ t9 CREATE TABLE `t9` (
|
|||
`d` int(11) NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
|
||||
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";
|
||||
Got one of the listed errors
|
||||
create database mysqltest;
|
||||
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist";
|
||||
Got one of the listed errors
|
||||
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";
|
||||
Got one of the listed errors
|
||||
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="MYSQLTEST_VARDIR/run";
|
||||
Got one of the listed errors
|
||||
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="MYSQLTEST_VARDIR/tmp";
|
||||
|
|
|
@ -684,6 +684,30 @@ SELECT 1 FROM t1 GROUP BY a;
|
|||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (b BIT NOT NULL, i2 INTEGER NOT NULL, s VARCHAR(255) NOT NULL);
|
||||
INSERT INTO t1 VALUES(0x01,100,''), (0x00,300,''), (0x01,200,''), (0x00,100,'');
|
||||
SELECT HEX(b), i2 FROM t1 WHERE (i2>=100 AND i2<201) AND b=TRUE;
|
||||
HEX(b) i2
|
||||
1 100
|
||||
1 200
|
||||
CREATE TABLE t2 (b1 BIT NOT NULL, b2 BIT NOT NULL, i2 INTEGER NOT NULL,
|
||||
s VARCHAR(255) NOT NULL);
|
||||
INSERT INTO t2 VALUES (0x01,0x00,100,''), (0x00,0x01,300,''),
|
||||
(0x01,0x00,200,''), (0x00,0x01,100,'');
|
||||
SELECT HEX(b1), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b1=TRUE;
|
||||
HEX(b1) i2
|
||||
1 100
|
||||
1 200
|
||||
SELECT HEX(b2), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b2=FALSE;
|
||||
HEX(b2) i2
|
||||
0 100
|
||||
0 200
|
||||
SELECT HEX(b1), HEX(b2), i2 FROM t2
|
||||
WHERE (i2>=100 AND i2<201) AND b1=TRUE AND b2=FALSE;
|
||||
HEX(b1) HEX(b2) i2
|
||||
1 0 100
|
||||
1 0 200
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests
|
||||
create table t1(a bit(7));
|
||||
insert into t1 values(0x40);
|
||||
|
|
|
@ -17,6 +17,22 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
|
|||
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
|
||||
insert into t1 values(a)
|
||||
master-bin.000001 # Query # # drop database testing_1
|
||||
use test;
|
||||
reset master;
|
||||
create temporary table tt1 (a int);
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
drop database if exists mysqltest1;
|
||||
insert into t1 values (1);
|
||||
drop table tt1, t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 # Query # # drop database if exists mysqltest1
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 # Query # # use `test`; drop table tt1, t1
|
||||
set binlog_format=mixed;
|
||||
reset master;
|
||||
create database testing_1;
|
||||
|
@ -36,6 +52,22 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
|
|||
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
|
||||
insert into t1 values(a)
|
||||
master-bin.000001 # Query # # drop database testing_1
|
||||
use test;
|
||||
reset master;
|
||||
create temporary table tt1 (a int);
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
drop database if exists mysqltest1;
|
||||
insert into t1 values (1);
|
||||
drop table tt1, t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 # Query # # drop database if exists mysqltest1
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 # Query # # use `test`; drop table tt1, t1
|
||||
set binlog_format=row;
|
||||
reset master;
|
||||
create database testing_1;
|
||||
|
@ -55,6 +87,27 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
|
|||
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
|
||||
insert into t1 values(a)
|
||||
master-bin.000001 # Query # # drop database testing_1
|
||||
use test;
|
||||
reset master;
|
||||
create temporary table tt1 (a int);
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
drop database if exists mysqltest1;
|
||||
insert into t1 values (1);
|
||||
drop table tt1, t1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # drop database if exists mysqltest1
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
show databases;
|
||||
Database
|
||||
information_schema
|
||||
|
|
|
@ -115,14 +115,14 @@ master-bin.000001 # Xid # # COMMIT /* XID */
|
|||
DROP TABLE t1;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 13
|
||||
Binlog_cache_use 15
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 0
|
||||
create table t1 (a int) engine=innodb;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 14
|
||||
Binlog_cache_use 16
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
|
@ -131,7 +131,7 @@ delete from t1;
|
|||
commit;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 15
|
||||
Binlog_cache_use 17
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
ソ十表予構噂蚕申貼能暴禄曾箪兔喀媾彌拿杤
|
||||
|
||||
|
|
|
@ -9,5 +9,3 @@
|
|||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
jp_convert_sjis : Bug#36597 Testsuite "jp": Suspicious results for some tests
|
||||
jp_select_sjis : Bug#36597 Testsuite "jp": Suspicious results for some tests
|
||||
|
|
151
mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
Normal file
151
mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
Normal file
|
@ -0,0 +1,151 @@
|
|||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CREATE TABLE t1 (id int, a int);
|
||||
CREATE TABLE t2 (id int, b int);
|
||||
CREATE TABLE t3 (id int, c int);
|
||||
CREATE TABLE t4 (id int, d int);
|
||||
CREATE TABLE t5 (id int, e int);
|
||||
CREATE TABLE t6 (id int, f int);
|
||||
CREATE TABLE t7 (id int, g int);
|
||||
CREATE TABLE t8 (id int, h int);
|
||||
CREATE TABLE t9 (id int, i int);
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t3 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t5 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t6 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t7 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t8 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t9 VALUES (1, 1), (2, 2), (3, 3);
|
||||
[on slave]
|
||||
SHOW TABLES LIKE 't%';
|
||||
Tables_in_test (t%)
|
||||
t1
|
||||
t2
|
||||
t3
|
||||
[on master]
|
||||
UPDATE t7 LEFT JOIN t4 ON (t4.id=t7.id) SET d=0, g=0 where t7.id=1;
|
||||
UPDATE t7 LEFT JOIN (t4, t5, t6) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t6.id) SET d=0, e=0, f=0, g=0 where t7.id=1;
|
||||
UPDATE t4 LEFT JOIN (t7, t8, t9) ON (t4.id=t7.id and t4.id=t8.id and t4.id=t9.id) SET d=0, g=0, h=0, i=0 where t4.id=1;
|
||||
UPDATE t7 LEFT JOIN (t8, t9) ON (t7.id=t8.id and t7.id=t9.id) SET g=0, h=0, i=0 where t7.id=1;
|
||||
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET d=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET g=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET d=0, e=0, f=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t8) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t8.id) SET d=0, e=0, h=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t7, t8, t5) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t5.id) SET g=0, h=0, e=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t2, t3, t5) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t5.id) SET e=0 where t1.id=1;
|
||||
UPDATE t4 LEFT JOIN t1 ON (t1.id=t4.id) SET a=0, d=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t7) ON (t4.id=t1.id and t7.id=t4.id) SET a = 0, d=0, g=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t2, t3) ON (t1.id=t4.id and t2.id=t4.id and t3.id=t4.id) SET a=0, b=0, c=0, d=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t2, t5) ON (t1.id=t4.id and t2.id=t4.id and t5.id=t4.id) SET a=0, b=0, e=0, d=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t6, t7) ON (t4.id=t1.id and t4.id=t6.id and t4.id=t7.id) SET a=0, d=0, f=0, g=0 where t4.id=1;
|
||||
UPDATE t7 LEFT JOIN (t4, t1, t2) ON (t7.id=t4.id and t7.id=t1.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
|
||||
UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id) SET a=0, d=0, g=0, h=0 where t7.id=1;
|
||||
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
|
||||
--source include/wait_for_slave_sql_error_and_skip.inc
|
||||
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1'
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
[on slave]
|
||||
show tables like 't%';
|
||||
Tables_in_test (t%)
|
||||
t1
|
||||
t2
|
||||
t3
|
||||
SELECT * FROM t1;
|
||||
id a
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
SELECT * FROM t2;
|
||||
id b
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
SELECT * FROM t3;
|
||||
id c
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
[on master]
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
@ -0,0 +1 @@
|
|||
--replicate-do-table=test.t1 --replicate-do-table=test.t2 --replicate-do-table=test.t3 --replicate-ignore-table=test.t4 --replicate-ignore-table=test.t5 --replicate-ignore-table=test.t6
|
205
mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
Normal file
205
mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
Normal file
|
@ -0,0 +1,205 @@
|
|||
# Test evaluation of replication table filter rules
|
||||
#
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test if replication table filter rules are properly evaluated when
|
||||
# some of the tables referenced by the multiple-table update do not
|
||||
# exist on slave.
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Master creates tables t1, t2, t3, t4, t5, t6, t7, t8, t9 and the
|
||||
# slave is started with the following replication table filter rules:
|
||||
#
|
||||
# --replicate-do-table=t1
|
||||
# --replicate-do-table=t2
|
||||
# --replicate-do-table=t3
|
||||
#
|
||||
# and
|
||||
#
|
||||
# --replicate-ignore-table=t4
|
||||
# --replicate-ignore-table=t5
|
||||
# --replicate-ignore-table=t6
|
||||
#
|
||||
# So the slave only replicate changes to tables t1, t2 and t3 and only
|
||||
# these tables exist on slave.
|
||||
#
|
||||
# From now on, tables t1, t2, and t3 are referenced as do tables,
|
||||
# tables t4, t5, t6 are referenced as ignore tables, and tables t7,
|
||||
# t8, t9 are referenced as other tables.
|
||||
#
|
||||
# All multi-table update tests reference tables that are not do
|
||||
# tables, which do not exist on slave. And the following situations
|
||||
# of multi-table update will be tested:
|
||||
#
|
||||
# 1. Do tables are not referenced at all
|
||||
# 2. Do tables are not referenced for update
|
||||
# 3. Ignore tables are referenced for update before do tables
|
||||
# 4. Only do tables are referenced for update
|
||||
# 5. Do tables and other tables are referenced for update
|
||||
# 6. Do tables are referenced for update before ignore tables
|
||||
#
|
||||
# For 1, 2 and 3, the statement should be ignored by slave, for 4, 5
|
||||
# and 6 the statement should be accepted by slave and cause an error
|
||||
# because of non-exist tables.
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#37051 Replication rules not evaluated correctly
|
||||
|
||||
|
||||
source include/have_binlog_format_statement.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
# These tables are mentioned in do-table rules
|
||||
CREATE TABLE t1 (id int, a int);
|
||||
CREATE TABLE t2 (id int, b int);
|
||||
CREATE TABLE t3 (id int, c int);
|
||||
|
||||
# These tables are mentioned in ignore-table rules
|
||||
CREATE TABLE t4 (id int, d int);
|
||||
CREATE TABLE t5 (id int, e int);
|
||||
CREATE TABLE t6 (id int, f int);
|
||||
|
||||
# These tables are not mentioned in do-table or ignore-table rules
|
||||
CREATE TABLE t7 (id int, g int);
|
||||
CREATE TABLE t8 (id int, h int);
|
||||
CREATE TABLE t9 (id int, i int);
|
||||
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t3 VALUES (1, 1), (2, 2), (3, 3);
|
||||
|
||||
INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t5 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t6 VALUES (1, 1), (2, 2), (3, 3);
|
||||
|
||||
INSERT INTO t7 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t8 VALUES (1, 1), (2, 2), (3, 3);
|
||||
INSERT INTO t9 VALUES (1, 1), (2, 2), (3, 3);
|
||||
|
||||
# Only t1, t2, t3 should be replicated to slave
|
||||
sync_slave_with_master;
|
||||
echo [on slave];
|
||||
SHOW TABLES LIKE 't%';
|
||||
|
||||
connection master;
|
||||
echo [on master];
|
||||
|
||||
#
|
||||
# Do tables are not referenced, these statements should be ignored by
|
||||
# slave.
|
||||
#
|
||||
UPDATE t7 LEFT JOIN t4 ON (t4.id=t7.id) SET d=0, g=0 where t7.id=1;
|
||||
UPDATE t7 LEFT JOIN (t4, t5, t6) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t6.id) SET d=0, e=0, f=0, g=0 where t7.id=1;
|
||||
UPDATE t4 LEFT JOIN (t7, t8, t9) ON (t4.id=t7.id and t4.id=t8.id and t4.id=t9.id) SET d=0, g=0, h=0, i=0 where t4.id=1;
|
||||
UPDATE t7 LEFT JOIN (t8, t9) ON (t7.id=t8.id and t7.id=t9.id) SET g=0, h=0, i=0 where t7.id=1;
|
||||
|
||||
#
|
||||
# Do tables are not referenced for update, these statements should be
|
||||
# ignored by slave.
|
||||
#
|
||||
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET d=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET g=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET d=0, e=0, f=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t8) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t8.id) SET d=0, e=0, h=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t7, t8, t5) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t5.id) SET g=0, h=0, e=0 where t1.id=1;
|
||||
UPDATE t1 LEFT JOIN (t2, t3, t5) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t5.id) SET e=0 where t1.id=1;
|
||||
|
||||
#
|
||||
# Ignore tables are referenced for update before do tables, these
|
||||
# statements should be ignore by slave.
|
||||
#
|
||||
UPDATE t4 LEFT JOIN t1 ON (t1.id=t4.id) SET a=0, d=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t7) ON (t4.id=t1.id and t7.id=t4.id) SET a = 0, d=0, g=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t2, t3) ON (t1.id=t4.id and t2.id=t4.id and t3.id=t4.id) SET a=0, b=0, c=0, d=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t2, t5) ON (t1.id=t4.id and t2.id=t4.id and t5.id=t4.id) SET a=0, b=0, e=0, d=0 where t4.id=1;
|
||||
UPDATE t4 LEFT JOIN (t1, t6, t7) ON (t4.id=t1.id and t4.id=t6.id and t4.id=t7.id) SET a=0, d=0, f=0, g=0 where t4.id=1;
|
||||
UPDATE t7 LEFT JOIN (t4, t1, t2) ON (t7.id=t4.id and t7.id=t1.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
|
||||
UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id) SET a=0, d=0, g=0, h=0 where t7.id=1;
|
||||
|
||||
# Sync slave to make sure all above statements are correctly ignored,
|
||||
# if any of the above statement are not ignored, it would cause error
|
||||
# and stop slave sql thread.
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
# Parameter for include/wait_for_slave_sql_error_and_skip.inc, ask it
|
||||
# to show SQL error message
|
||||
let show_sql_error=1;
|
||||
|
||||
#
|
||||
# Only do tables are referenced for update, these statements should
|
||||
# cause error on slave
|
||||
#
|
||||
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
#
|
||||
# Do tables and other tables are referenced for update, these
|
||||
# statements should cause error on slave
|
||||
#
|
||||
UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
#
|
||||
# Do tables are referenced for update before ignore tables
|
||||
#
|
||||
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
|
||||
source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
sync_slave_with_master;
|
||||
echo [on slave];
|
||||
|
||||
# We should only have tables t1, t2, t3 on slave
|
||||
show tables like 't%';
|
||||
|
||||
# The rows in these tables should remain untouched
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
SELECT * FROM t3;
|
||||
|
||||
# Clean up
|
||||
connection master;
|
||||
echo [on master];
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
source include/master-slave-end.inc;
|
|
@ -942,3 +942,22 @@ SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
|
|||
SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#38195: Incorrect handling of aggregate functions when loose index scan is
|
||||
# used causes server crash.
|
||||
#
|
||||
create table t1 (a int, b int, primary key (a,b), key `index` (a,b)) engine=MyISAM;
|
||||
insert into t1 (a,b) values
|
||||
(0,0),(0,1),(0,2),(0,3),(0,4),(0,5),(0,6),
|
||||
(0,7),(0,8),(0,9),(0,10),(0,11),(0,12),(0,13),
|
||||
(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),
|
||||
(1,7),(1,8),(1,9),(1,10),(1,11),(1,12),(1,13),
|
||||
(2,0),(2,1),(2,2),(2,3),(2,4),(2,5),(2,6),
|
||||
(2,7),(2,8),(2,9),(2,10),(2,11),(2,12),(2,13),
|
||||
(3,0),(3,1),(3,2),(3,3),(3,4),(3,5),(3,6),
|
||||
(3,7),(3,8),(3,9),(3,10),(3,11),(3,12),(3,13);
|
||||
insert into t1 (a,b) select a, max(b)+1 from t1 where a = 0 group by a;
|
||||
select * from t1;
|
||||
explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a;
|
||||
drop table t1;
|
||||
|
|
|
@ -1169,6 +1169,21 @@ SELECT * FROM t1;
|
|||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug#37310: 'on update CURRENT_TIMESTAMP' option crashes the table
|
||||
#
|
||||
CREATE TABLE t1 (a INT) ENGINE=MyISAM CHECKSUM=1 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES (0);
|
||||
UPDATE t1 SET a=1;
|
||||
SELECT a FROM t1;
|
||||
CHECK TABLE t1;
|
||||
INSERT INTO t1 VALUES (0), (5), (4), (2);
|
||||
UPDATE t1 SET a=2;
|
||||
SELECT a FROM t1;
|
||||
CHECK TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
||||
|
|
446
mysql-test/t/mysqlbinlog_row.test
Normal file
446
mysql-test/t/mysqlbinlog_row.test
Normal file
|
@ -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 $MYSQLTEST_VARDIR/log/master-bin.000001
|
130
mysql-test/t/mysqlbinlog_row_big.test
Normal file
130
mysql-test/t/mysqlbinlog_row_big.test
Normal file
|
@ -0,0 +1,130 @@
|
|||
# mysqlbinlog_big.test
|
||||
#
|
||||
# Show that mysqlbinlog can handle big rows.
|
||||
#
|
||||
|
||||
#
|
||||
# The *huge* output of mysqlbinlog will be redirected to
|
||||
# $MYSQLTEST_VARDIR/$mysqlbinlog_output
|
||||
#
|
||||
--let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out
|
||||
|
||||
#--source include/have_myisam.inc
|
||||
--let $engine_type= MyISAM
|
||||
|
||||
#
|
||||
# This test case is insensitive to the binlog format
|
||||
# because we don't display the output of mysqlbinlog.
|
||||
#
|
||||
#--source include/have_binlog_format_row.inc
|
||||
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
# This is a big test.
|
||||
--source include/big_test.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 # We need big packets.
|
||||
--echo #
|
||||
SET @@session.max_allowed_packet= 1024*1024*1024;
|
||||
|
||||
--echo #
|
||||
--echo # Delete all existing binary logs.
|
||||
--echo #
|
||||
RESET MASTER;
|
||||
|
||||
--echo #
|
||||
--echo # Create a test table.
|
||||
--echo #
|
||||
eval CREATE TABLE t1 (
|
||||
c1 LONGTEXT
|
||||
) ENGINE=$engine_type DEFAULT CHARSET latin1;
|
||||
|
||||
--echo #
|
||||
--echo # Show how much rows are affected by each statement.
|
||||
--echo #
|
||||
--enable_info
|
||||
|
||||
--echo #
|
||||
--echo # Insert a big row.
|
||||
--echo #
|
||||
#
|
||||
# 256MB
|
||||
#INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216));
|
||||
#
|
||||
# 32MB
|
||||
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
|
||||
#
|
||||
# 4MB
|
||||
#INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 262144));
|
||||
#
|
||||
# 512KB
|
||||
#INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 32768));
|
||||
|
||||
--echo #
|
||||
--echo # Show what we have in the table.
|
||||
--echo # Do not display the column value itself, just its length.
|
||||
--echo #
|
||||
query_vertical SELECT LENGTH(c1) FROM t1;
|
||||
|
||||
--echo #
|
||||
--echo # Grow the row by updating.
|
||||
--echo #
|
||||
UPDATE t1 SET c1 = CONCAT(c1, c1);
|
||||
|
||||
--echo #
|
||||
--echo # Show what we have in the table.
|
||||
--echo # Do not display the column value itself, just its length.
|
||||
--echo #
|
||||
query_vertical SELECT LENGTH(c1) FROM t1;
|
||||
|
||||
--echo #
|
||||
--echo # Delete the row.
|
||||
--echo #
|
||||
DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
|
||||
|
||||
--echo #
|
||||
--echo # Hide how much rows are affected by each statement.
|
||||
--echo #
|
||||
--disable_info
|
||||
|
||||
--echo #
|
||||
--echo # Flush all log buffers to the log file.
|
||||
--echo #
|
||||
FLUSH LOGS;
|
||||
|
||||
--echo #
|
||||
--echo # Call mysqlbinlog to display the log file contents.
|
||||
--echo # NOTE: The output of mysqlbinlog is redirected to
|
||||
--echo # \$MYSQLTEST_VARDIR/$mysqlbinlog_output
|
||||
--echo # If you want to examine it, disable remove_file
|
||||
--echo # at the bottom of the test script.
|
||||
--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 = #/
|
||||
--exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup.
|
||||
--echo #
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output
|
||||
#
|
||||
# NOTE: If you want to see the *huge* mysqlbinlog output, disable next line:
|
||||
#
|
||||
--remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output
|
||||
|
24
mysql-test/t/mysqlbinlog_row_innodb.test
Normal file
24
mysql-test/t/mysqlbinlog_row_innodb.test
Normal file
|
@ -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 include/mysqlbinlog_row_engine.inc
|
||||
|
23
mysql-test/t/mysqlbinlog_row_myisam.test
Normal file
23
mysql-test/t/mysqlbinlog_row_myisam.test
Normal file
|
@ -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 include/mysqlbinlog_row_engine.inc
|
161
mysql-test/t/mysqlbinlog_row_trans.test
Normal file
161
mysql-test/t/mysqlbinlog_row_trans.test
Normal file
|
@ -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 $MYSQLTEST_VARDIR/log/master-bin.000001
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup.
|
||||
--echo #
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
|
@ -154,7 +154,8 @@ set @@sql_mode=@org_mode;
|
|||
#
|
||||
# Bug 21350: Data Directory problems
|
||||
#
|
||||
-- error ER_WRONG_ARGUMENTS
|
||||
# Added ER_WRONG_TABLE_NAME and reported bug#39045
|
||||
-- error ER_WRONG_ARGUMENTS, ER_WRONG_TABLE_NAME
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||
|
@ -163,7 +164,8 @@ partition by key (a)
|
|||
# Insert a test that manages to create the first partition and fails with
|
||||
# the second, ensure that we clean up afterwards in a proper manner.
|
||||
#
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
# Added ER_WRONG_TABLE_NAME and reported bug#39045
|
||||
--error ER_WRONG_ARGUMENTS, ER_WRONG_TABLE_NAME
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p0,
|
||||
|
|
|
@ -3311,4 +3311,48 @@ SELECT * FROM t1
|
|||
WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Bug #37548: result value erronously reported being NULL in certain subqueries
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY b (b));
|
||||
|
||||
INSERT INTO t1 VALUES (1,NULL), (9,NULL);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a int,
|
||||
b int,
|
||||
c int,
|
||||
d int,
|
||||
PRIMARY KEY (a),
|
||||
UNIQUE KEY b (b,c,d),
|
||||
KEY b_2 (b),
|
||||
KEY c (c),
|
||||
KEY d (d)
|
||||
);
|
||||
|
||||
INSERT INTO t2 VALUES
|
||||
(43, 2, 11 ,30),
|
||||
(44, 2, 12 ,30),
|
||||
(45, 1, 1 ,10000),
|
||||
(46, 1, 2 ,10000),
|
||||
(556,1, 32 ,10000);
|
||||
|
||||
CREATE TABLE t3 (
|
||||
a int,
|
||||
b int,
|
||||
c int,
|
||||
PRIMARY KEY (a),
|
||||
UNIQUE KEY b (b,c),
|
||||
KEY c (c),
|
||||
KEY b_2 (b)
|
||||
);
|
||||
|
||||
INSERT INTO t3 VALUES (1,1,1), (2,32,1);
|
||||
|
||||
explain
|
||||
SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
|
||||
SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
--echo End of 5.1 tests.
|
||||
|
|
|
@ -65,8 +65,6 @@ drop table t1;
|
|||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
SHOW CREATE TABLE t9;
|
||||
|
||||
--error 1103, 1103
|
||||
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";
|
||||
|
||||
# Check that we cannot link over a table from another database.
|
||||
|
||||
|
@ -75,8 +73,9 @@ create database mysqltest;
|
|||
--error 1,1
|
||||
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist";
|
||||
|
||||
--error 1103, 1103
|
||||
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";
|
||||
# temporarily disabled as it returns different result in the embedded server
|
||||
# --error 1210, 1210
|
||||
# create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";
|
||||
|
||||
# Should fail becasue the file t9.MYI already exist in 'run'
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
|
|
|
@ -333,6 +333,25 @@ SELECT 1 FROM t1 GROUP BY a;
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#37799 SELECT with a BIT column in WHERE clause returns unexpected result
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (b BIT NOT NULL, i2 INTEGER NOT NULL, s VARCHAR(255) NOT NULL);
|
||||
INSERT INTO t1 VALUES(0x01,100,''), (0x00,300,''), (0x01,200,''), (0x00,100,'');
|
||||
SELECT HEX(b), i2 FROM t1 WHERE (i2>=100 AND i2<201) AND b=TRUE;
|
||||
|
||||
CREATE TABLE t2 (b1 BIT NOT NULL, b2 BIT NOT NULL, i2 INTEGER NOT NULL,
|
||||
s VARCHAR(255) NOT NULL);
|
||||
INSERT INTO t2 VALUES (0x01,0x00,100,''), (0x00,0x01,300,''),
|
||||
(0x01,0x00,200,''), (0x00,0x01,100,'');
|
||||
SELECT HEX(b1), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b1=TRUE;
|
||||
SELECT HEX(b2), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b2=FALSE;
|
||||
SELECT HEX(b1), HEX(b2), i2 FROM t2
|
||||
WHERE (i2>=100 AND i2<201) AND b1=TRUE AND b2=FALSE;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
|
|
@ -111,8 +111,16 @@ int my_symlink(const char *content, const char *linkname, myf MyFlags)
|
|||
|
||||
int my_is_symlink(const char *filename __attribute__((unused)))
|
||||
{
|
||||
#if defined (HAVE_LSTAT) && defined (S_ISLNK)
|
||||
struct stat stat_buff;
|
||||
return !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode);
|
||||
#elif defined (_WIN32)
|
||||
DWORD dwAttr = GetFileAttributes(filename);
|
||||
return (dwAttr != INVALID_FILE_ATTRIBUTES) &&
|
||||
(dwAttr & FILE_ATTRIBUTE_REPARSE_POINT);
|
||||
#else /* No symlinks */
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -333,10 +333,10 @@ void thr_lock_init(THR_LOCK *lock)
|
|||
void thr_lock_delete(THR_LOCK *lock)
|
||||
{
|
||||
DBUG_ENTER("thr_lock_delete");
|
||||
VOID(pthread_mutex_destroy(&lock->mutex));
|
||||
pthread_mutex_lock(&THR_LOCK_lock);
|
||||
thr_lock_thread_list=list_delete(thr_lock_thread_list,&lock->list);
|
||||
pthread_mutex_unlock(&THR_LOCK_lock);
|
||||
pthread_mutex_destroy(&lock->mutex);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
virtual bool eq(Field *field)
|
||||
{
|
||||
return (ptr == field->ptr && null_ptr == field->null_ptr &&
|
||||
null_bit == field->null_bit);
|
||||
null_bit == field->null_bit && field->type() == type());
|
||||
}
|
||||
virtual bool eq_def(Field *field);
|
||||
|
||||
|
@ -1960,7 +1960,6 @@ public:
|
|||
bool eq(Field *field)
|
||||
{
|
||||
return (Field::eq(field) &&
|
||||
field->type() == type() &&
|
||||
bit_ptr == ((Field_bit *)field)->bit_ptr &&
|
||||
bit_ofs == ((Field_bit *)field)->bit_ofs);
|
||||
}
|
||||
|
|
640
sql/log_event.cc
640
sql/log_event.cc
|
@ -1353,6 +1353,542 @@ void Log_event::print_header(IO_CACHE* file,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a quoted string to io cache.
|
||||
Control characters are displayed as hex sequence, e.g. \x00
|
||||
|
||||
@param[in] file IO cache
|
||||
@param[in] prt Pointer to string
|
||||
@param[in] length String length
|
||||
*/
|
||||
|
||||
static void
|
||||
my_b_write_quoted(IO_CACHE *file, const uchar *ptr, uint length)
|
||||
{
|
||||
const uchar *s;
|
||||
my_b_printf(file, "'");
|
||||
for (s= ptr; length > 0 ; s++, length--)
|
||||
{
|
||||
if (*s > 0x1F)
|
||||
my_b_write(file, s, 1);
|
||||
else
|
||||
{
|
||||
uchar hex[10];
|
||||
size_t len= my_snprintf((char*) hex, sizeof(hex), "%s%02x", "\\x", *s);
|
||||
my_b_write(file, hex, len);
|
||||
}
|
||||
}
|
||||
my_b_printf(file, "'");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a bit string to io cache in format b'1010'.
|
||||
|
||||
@param[in] file IO cache
|
||||
@param[in] ptr Pointer to string
|
||||
@param[in] nbits Number of bits
|
||||
*/
|
||||
static void
|
||||
my_b_write_bit(IO_CACHE *file, const uchar *ptr, uint nbits)
|
||||
{
|
||||
uint bitnum, nbits8= ((nbits + 7) / 8) * 8, skip_bits= nbits8 - nbits;
|
||||
my_b_printf(file, "b'");
|
||||
for (bitnum= skip_bits ; bitnum < nbits8; bitnum++)
|
||||
{
|
||||
int is_set= (ptr[(bitnum) / 8] >> (7 - bitnum % 8)) & 0x01;
|
||||
my_b_write(file, (const uchar*) (is_set ? "1" : "0"), 1);
|
||||
}
|
||||
my_b_printf(file, "'");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a packed string to io cache.
|
||||
The string consists of length packed to 1 or 2 bytes,
|
||||
followed by string data itself.
|
||||
|
||||
@param[in] file IO cache
|
||||
@param[in] ptr Pointer to string
|
||||
@param[in] length String size
|
||||
|
||||
@retval - number of bytes scanned.
|
||||
*/
|
||||
static size_t
|
||||
my_b_write_quoted_with_length(IO_CACHE *file, const uchar *ptr, uint length)
|
||||
{
|
||||
if (length < 256)
|
||||
{
|
||||
length= *ptr;
|
||||
my_b_write_quoted(file, ptr + 1, length);
|
||||
return length + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
length= uint2korr(ptr);
|
||||
my_b_write_quoted(file, ptr + 2, length);
|
||||
return length + 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prints a 32-bit number in both signed and unsigned representation
|
||||
|
||||
@param[in] file IO cache
|
||||
@param[in] sl Signed number
|
||||
@param[in] ul Unsigned number
|
||||
*/
|
||||
static void
|
||||
my_b_write_sint32_and_uint32(IO_CACHE *file, int32 si, uint32 ui)
|
||||
{
|
||||
my_b_printf(file, "%d", si);
|
||||
if (si < 0)
|
||||
my_b_printf(file, " (%u)", ui);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Print a packed value of the given SQL type into IO cache
|
||||
|
||||
@param[in] file IO cache
|
||||
@param[in] ptr Pointer to string
|
||||
@param[in] type Column type
|
||||
@param[in] meta Column meta information
|
||||
@param[out] typestr SQL type string buffer (for verbose output)
|
||||
@param[out] typestr_length Size of typestr
|
||||
|
||||
@retval - number of bytes scanned from ptr.
|
||||
*/
|
||||
|
||||
static size_t
|
||||
log_event_print_value(IO_CACHE *file, const uchar *ptr,
|
||||
uint type, uint meta,
|
||||
char *typestr, size_t typestr_length)
|
||||
{
|
||||
uint32 length= 0;
|
||||
|
||||
if (type == MYSQL_TYPE_STRING)
|
||||
{
|
||||
if (meta >= 256)
|
||||
{
|
||||
uint byte0= meta >> 8;
|
||||
uint byte1= meta & 0xFF;
|
||||
|
||||
if ((byte0 & 0x30) != 0x30)
|
||||
{
|
||||
/* a long CHAR() field: see #37426 */
|
||||
length= byte1 | (((byte0 & 0x30) ^ 0x30) << 4);
|
||||
type= byte0 | 0x30;
|
||||
goto beg;
|
||||
}
|
||||
|
||||
switch (byte0)
|
||||
{
|
||||
case MYSQL_TYPE_SET:
|
||||
case MYSQL_TYPE_ENUM:
|
||||
case MYSQL_TYPE_STRING:
|
||||
type= byte0;
|
||||
length= byte1;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
{
|
||||
char tmp[5];
|
||||
my_snprintf(tmp, sizeof(tmp), "%04X", meta);
|
||||
my_b_printf(file,
|
||||
"!! Don't know how to handle column type=%d meta=%d (%s)",
|
||||
type, meta, tmp);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
length= meta;
|
||||
}
|
||||
|
||||
|
||||
beg:
|
||||
|
||||
switch (type) {
|
||||
case MYSQL_TYPE_LONG:
|
||||
{
|
||||
int32 si= sint4korr(ptr);
|
||||
uint32 ui= uint4korr(ptr);
|
||||
my_b_write_sint32_and_uint32(file, si, ui);
|
||||
my_snprintf(typestr, typestr_length, "INT");
|
||||
return 4;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_TINY:
|
||||
{
|
||||
my_b_write_sint32_and_uint32(file, (int) (signed char) *ptr,
|
||||
(uint) (unsigned char) *ptr);
|
||||
my_snprintf(typestr, typestr_length, "TINYINT");
|
||||
return 1;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_SHORT:
|
||||
{
|
||||
int32 si= (int32) sint2korr(ptr);
|
||||
uint32 ui= (uint32) uint2korr(ptr);
|
||||
my_b_write_sint32_and_uint32(file, si, ui);
|
||||
my_snprintf(typestr, typestr_length, "SHORTINT");
|
||||
return 2;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_INT24:
|
||||
{
|
||||
int32 si= sint3korr(ptr);
|
||||
uint32 ui= uint3korr(ptr);
|
||||
my_b_write_sint32_and_uint32(file, si, ui);
|
||||
my_snprintf(typestr, typestr_length, "MEDIUMINT");
|
||||
return 3;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
{
|
||||
char tmp[64];
|
||||
longlong si= sint8korr(ptr);
|
||||
longlong10_to_str(si, tmp, -10);
|
||||
my_b_printf(file, "%s", tmp);
|
||||
if (si < 0)
|
||||
{
|
||||
ulonglong ui= uint8korr(ptr);
|
||||
longlong10_to_str((longlong) ui, tmp, 10);
|
||||
my_b_printf(file, " (%s)", tmp);
|
||||
}
|
||||
my_snprintf(typestr, typestr_length, "LONGINT");
|
||||
return 8;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_NEWDECIMAL:
|
||||
{
|
||||
uint precision= meta >> 8;
|
||||
uint decimals= meta & 0xFF;
|
||||
uint bin_size= my_decimal_get_binary_size(precision, decimals);
|
||||
my_decimal dec;
|
||||
binary2my_decimal(E_DEC_FATAL_ERROR, (uchar*) ptr, &dec,
|
||||
precision, decimals);
|
||||
int i, end;
|
||||
char buff[512], *pos;
|
||||
pos= buff;
|
||||
pos+= my_sprintf(buff, (buff, "%s", dec.sign() ? "-" : ""));
|
||||
end= ROUND_UP(dec.frac) + ROUND_UP(dec.intg)-1;
|
||||
for (i=0; i < end; i++)
|
||||
pos+= my_sprintf(pos, (pos, "%09d.", dec.buf[i]));
|
||||
pos+= my_sprintf(pos, (pos, "%09d", dec.buf[i]));
|
||||
my_b_printf(file, "%s", buff);
|
||||
my_snprintf(typestr, typestr_length, "DECIMAL(%d,%d)",
|
||||
precision, decimals);
|
||||
return bin_size;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_FLOAT:
|
||||
{
|
||||
float fl;
|
||||
float4get(fl, ptr);
|
||||
char tmp[320];
|
||||
sprintf(tmp, "%-20g", (double) fl);
|
||||
my_b_printf(file, "%s", tmp); /* my_snprintf doesn't support %-20g */
|
||||
my_snprintf(typestr, typestr_length, "FLOAT");
|
||||
return 4;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
{
|
||||
double dbl;
|
||||
float8get(dbl, ptr);
|
||||
char tmp[320];
|
||||
sprintf(tmp, "%-.20g", dbl); /* my_snprintf doesn't support %-20g */
|
||||
my_b_printf(file, "%s", tmp);
|
||||
strcpy(typestr, "DOUBLE");
|
||||
return 8;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_BIT:
|
||||
{
|
||||
/* Meta-data: bit_len, bytes_in_rec, 2 bytes */
|
||||
uint nbits= ((meta >> 8) * 8) + (meta & 0xFF);
|
||||
length= (nbits + 7) / 8;
|
||||
my_b_write_bit(file, ptr, nbits);
|
||||
my_snprintf(typestr, typestr_length, "BIT(%d)", nbits);
|
||||
return length;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
{
|
||||
uint32 i32= uint4korr(ptr);
|
||||
my_b_printf(file, "%d", i32);
|
||||
my_snprintf(typestr, typestr_length, "TIMESTAMP");
|
||||
return 4;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
{
|
||||
uint d, t;
|
||||
uint64 i64= uint8korr(ptr); /* YYYYMMDDhhmmss */
|
||||
d= i64 / 1000000;
|
||||
t= i64 % 1000000;
|
||||
my_b_printf(file, "%04d-%02d-%02d %02d:%02d:%02d",
|
||||
d / 10000, (d % 10000) / 100, d % 100,
|
||||
t / 10000, (t % 10000) / 100, t % 100);
|
||||
my_snprintf(typestr, typestr_length, "DATETIME");
|
||||
return 8;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_TIME:
|
||||
{
|
||||
uint32 i32= uint3korr(ptr);
|
||||
my_b_printf(file, "'%02d:%02d:%02d'",
|
||||
i32 / 10000, (i32 % 10000) / 100, i32 % 100);
|
||||
my_snprintf(typestr, typestr_length, "TIME");
|
||||
return 3;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_DATE:
|
||||
{
|
||||
uint i32= uint3korr(ptr);
|
||||
my_b_printf(file , "'%04d:%02d:%02d'",
|
||||
(i32 / (16L * 32L)), (i32 / 32L % 16L), (i32 % 32L));
|
||||
my_snprintf(typestr, typestr_length, "DATE");
|
||||
return 3;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_YEAR:
|
||||
{
|
||||
uint32 i32= *ptr;
|
||||
my_b_printf(file, "%04d", i32+ 1900);
|
||||
my_snprintf(typestr, typestr_length, "YEAR");
|
||||
return 1;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_ENUM:
|
||||
switch (length) {
|
||||
case 1:
|
||||
my_b_printf(file, "%d", (int) *ptr);
|
||||
my_snprintf(typestr, typestr_length, "ENUM(1 byte)");
|
||||
return 1;
|
||||
case 2:
|
||||
{
|
||||
int32 i32= uint2korr(ptr);
|
||||
my_b_printf(file, "%d", i32);
|
||||
my_snprintf(typestr, typestr_length, "ENUM(2 bytes)");
|
||||
return 2;
|
||||
}
|
||||
default:
|
||||
my_b_printf(file, "!! Unknown ENUM packlen=%d", length);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case MYSQL_TYPE_SET:
|
||||
my_b_write_bit(file, ptr , length * 8);
|
||||
my_snprintf(typestr, typestr_length, "SET(%d bytes)", length);
|
||||
return length;
|
||||
|
||||
case MYSQL_TYPE_BLOB:
|
||||
switch (meta) {
|
||||
case 1:
|
||||
length= *ptr;
|
||||
my_b_write_quoted(file, ptr + 1, length);
|
||||
my_snprintf(typestr, typestr_length, "TINYBLOB/TINYTEXT");
|
||||
return length + 1;
|
||||
case 2:
|
||||
length= uint2korr(ptr);
|
||||
my_b_write_quoted(file, ptr + 2, length);
|
||||
my_snprintf(typestr, typestr_length, "BLOB/TEXT");
|
||||
return length + 2;
|
||||
case 3:
|
||||
length= uint3korr(ptr);
|
||||
my_b_write_quoted(file, ptr + 3, length);
|
||||
my_snprintf(typestr, typestr_length, "MEDIUMBLOB/MEDIUMTEXT");
|
||||
return length + 3;
|
||||
case 4:
|
||||
length= uint4korr(ptr);
|
||||
my_b_write_quoted(file, ptr + 4, length);
|
||||
my_snprintf(typestr, typestr_length, "LONGBLOB/LONGTEXT");
|
||||
return length + 4;
|
||||
default:
|
||||
my_b_printf(file, "!! Unknown BLOB packlen=%d", length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
case MYSQL_TYPE_VARCHAR:
|
||||
case MYSQL_TYPE_VAR_STRING:
|
||||
length= meta;
|
||||
my_snprintf(typestr, typestr_length, "VARSTRING(%d)", length);
|
||||
return my_b_write_quoted_with_length(file, ptr, length);
|
||||
|
||||
case MYSQL_TYPE_STRING:
|
||||
my_snprintf(typestr, typestr_length, "STRING(%d)", length);
|
||||
return my_b_write_quoted_with_length(file, ptr, length);
|
||||
|
||||
default:
|
||||
{
|
||||
char tmp[5];
|
||||
my_snprintf(tmp, sizeof(tmp), "%04x", meta);
|
||||
my_b_printf(file,
|
||||
"!! Don't know how to handle column type=%d meta=%d (%s)",
|
||||
type, meta, tmp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
*typestr= 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Print a packed row into IO cache
|
||||
|
||||
@param[in] file IO cache
|
||||
@param[in] td Table definition
|
||||
@param[in] print_event_into Print parameters
|
||||
@param[in] cols_bitmap Column bitmaps.
|
||||
@param[in] value Pointer to packed row
|
||||
@param[in] prefix Row's SQL clause ("SET", "WHERE", etc)
|
||||
|
||||
@retval - number of bytes scanned.
|
||||
*/
|
||||
|
||||
|
||||
size_t
|
||||
Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td,
|
||||
PRINT_EVENT_INFO *print_event_info,
|
||||
MY_BITMAP *cols_bitmap,
|
||||
const uchar *value, const uchar *prefix)
|
||||
{
|
||||
const uchar *value0= value;
|
||||
const uchar *null_bits= value;
|
||||
char typestr[64]= "";
|
||||
|
||||
value+= (m_width + 7) / 8;
|
||||
|
||||
my_b_printf(file, "%s", prefix);
|
||||
|
||||
for (size_t i= 0; i < td->size(); i ++)
|
||||
{
|
||||
int is_null= (null_bits[i / 8] >> (i % 8)) & 0x01;
|
||||
|
||||
if (bitmap_is_set(cols_bitmap, i) == 0)
|
||||
continue;
|
||||
|
||||
if (is_null)
|
||||
{
|
||||
my_b_printf(file, "### @%d=NULL", i + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
my_b_printf(file, "### @%d=", i + 1);
|
||||
size_t size= log_event_print_value(file, value,
|
||||
td->type(i), td->field_metadata(i),
|
||||
typestr, sizeof(typestr));
|
||||
if (!size)
|
||||
return 0;
|
||||
|
||||
value+= size;
|
||||
}
|
||||
|
||||
if (print_event_info->verbose > 1)
|
||||
{
|
||||
my_b_printf(file, " /* ");
|
||||
|
||||
if (typestr[0])
|
||||
my_b_printf(file, "%s ", typestr);
|
||||
else
|
||||
my_b_printf(file, "type=%d ", td->type(i));
|
||||
|
||||
my_b_printf(file, "meta=%d nullable=%d is_null=%d ",
|
||||
td->field_metadata(i),
|
||||
td->maybe_null(i), is_null);
|
||||
my_b_printf(file, "*/");
|
||||
}
|
||||
|
||||
my_b_printf(file, "\n");
|
||||
}
|
||||
return value - value0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Print a row event into IO cache in human readable form (in SQL format)
|
||||
|
||||
@param[in] file IO cache
|
||||
@param[in] print_event_into Print parameters
|
||||
*/
|
||||
void Rows_log_event::print_verbose(IO_CACHE *file,
|
||||
PRINT_EVENT_INFO *print_event_info)
|
||||
{
|
||||
Table_map_log_event *map;
|
||||
table_def *td;
|
||||
const char *sql_command, *sql_clause1, *sql_clause2;
|
||||
Log_event_type type_code= get_type_code();
|
||||
|
||||
switch (type_code) {
|
||||
case WRITE_ROWS_EVENT:
|
||||
sql_command= "INSERT INTO";
|
||||
sql_clause1= "### SET\n";
|
||||
sql_clause2= NULL;
|
||||
break;
|
||||
case DELETE_ROWS_EVENT:
|
||||
sql_command= "DELETE FROM";
|
||||
sql_clause1= "### WHERE\n";
|
||||
sql_clause2= NULL;
|
||||
break;
|
||||
case UPDATE_ROWS_EVENT:
|
||||
sql_command= "UPDATE";
|
||||
sql_clause1= "### WHERE\n";
|
||||
sql_clause2= "### SET\n";
|
||||
break;
|
||||
default:
|
||||
sql_command= sql_clause1= sql_clause2= NULL;
|
||||
DBUG_ASSERT(0); /* Not possible */
|
||||
}
|
||||
|
||||
if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
|
||||
!(td= map->create_table_def()))
|
||||
{
|
||||
my_b_printf(file, "### Row event for unknown table #%d", m_table_id);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const uchar *value= m_rows_buf; value < m_rows_end; )
|
||||
{
|
||||
size_t length;
|
||||
my_b_printf(file, "### %s %s.%s\n",
|
||||
sql_command,
|
||||
map->get_db_name(), map->get_table_name());
|
||||
/* Print the first image */
|
||||
if (!(length= print_verbose_one_row(file, td, print_event_info,
|
||||
&m_cols, value,
|
||||
(const uchar*) sql_clause1)))
|
||||
goto end;
|
||||
value+= length;
|
||||
|
||||
/* Print the second image (for UPDATE only) */
|
||||
if (sql_clause2)
|
||||
{
|
||||
if (!(length= print_verbose_one_row(file, td, print_event_info,
|
||||
&m_cols_ai, value,
|
||||
(const uchar*) sql_clause2)))
|
||||
goto end;
|
||||
value+= length;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
delete td;
|
||||
}
|
||||
|
||||
#ifdef MYSQL_CLIENT
|
||||
void free_table_map_log_event(Table_map_log_event *event)
|
||||
{
|
||||
delete event;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Log_event::print_base64(IO_CACHE* file,
|
||||
PRINT_EVENT_INFO* print_event_info,
|
||||
bool more)
|
||||
|
@ -1374,14 +1910,51 @@ void Log_event::print_base64(IO_CACHE* file,
|
|||
DBUG_ASSERT(0);
|
||||
}
|
||||
|
||||
if (my_b_tell(file) == 0)
|
||||
my_b_printf(file, "\nBINLOG '\n");
|
||||
if (print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
|
||||
{
|
||||
if (my_b_tell(file) == 0)
|
||||
my_b_printf(file, "\nBINLOG '\n");
|
||||
|
||||
my_b_printf(file, "%s\n", tmp_str);
|
||||
|
||||
if (!more)
|
||||
my_b_printf(file, "'%s\n", print_event_info->delimiter);
|
||||
my_b_printf(file, "%s\n", tmp_str);
|
||||
|
||||
if (!more)
|
||||
my_b_printf(file, "'%s\n", print_event_info->delimiter);
|
||||
}
|
||||
|
||||
if (print_event_info->verbose)
|
||||
{
|
||||
Rows_log_event *ev= NULL;
|
||||
|
||||
if (ptr[4] == TABLE_MAP_EVENT)
|
||||
{
|
||||
Table_map_log_event *map;
|
||||
map= new Table_map_log_event((const char*) ptr, size,
|
||||
glob_description_event);
|
||||
print_event_info->m_table_map.set_table(map->get_table_id(), map);
|
||||
}
|
||||
else if (ptr[4] == WRITE_ROWS_EVENT)
|
||||
{
|
||||
ev= new Write_rows_log_event((const char*) ptr, size,
|
||||
glob_description_event);
|
||||
}
|
||||
else if (ptr[4] == DELETE_ROWS_EVENT)
|
||||
{
|
||||
ev= new Delete_rows_log_event((const char*) ptr, size,
|
||||
glob_description_event);
|
||||
}
|
||||
else if (ptr[4] == UPDATE_ROWS_EVENT)
|
||||
{
|
||||
ev= new Update_rows_log_event((const char*) ptr, size,
|
||||
glob_description_event);
|
||||
}
|
||||
|
||||
if (ev)
|
||||
{
|
||||
ev->print_verbose(file, print_event_info);
|
||||
delete ev;
|
||||
}
|
||||
}
|
||||
|
||||
my_free(tmp_str, MYF(0));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -1474,6 +2047,11 @@ void Query_log_event::pack_info(Protocol *protocol)
|
|||
static void write_str_with_code_and_len(char **dst, const char *src,
|
||||
int len, uint code)
|
||||
{
|
||||
/*
|
||||
only 1 byte to store the length of catalog, so it should not
|
||||
surpass 255
|
||||
*/
|
||||
DBUG_ASSERT(len <= 255);
|
||||
DBUG_ASSERT(src);
|
||||
*((*dst)++)= code;
|
||||
*((*dst)++)= (uchar) len;
|
||||
|
@ -1493,21 +2071,8 @@ static void write_str_with_code_and_len(char **dst, const char *src,
|
|||
|
||||
bool Query_log_event::write(IO_CACHE* file)
|
||||
{
|
||||
/**
|
||||
@todo if catalog can be of length FN_REFLEN==512, then we are not
|
||||
replicating it correctly, since the length is stored in a byte
|
||||
/sven
|
||||
*/
|
||||
uchar buf[QUERY_HEADER_LEN+
|
||||
1+4+ // code of flags2 and flags2
|
||||
1+8+ // code of sql_mode and sql_mode
|
||||
1+1+FN_REFLEN+ // code of catalog and catalog length and catalog
|
||||
1+4+ // code of autoinc and the 2 autoinc variables
|
||||
1+6+ // code of charset and charset
|
||||
1+1+MAX_TIME_ZONE_NAME_LENGTH+ // code of tz and tz length and tz name
|
||||
1+2+ // code of lc_time_names and lc_time_names_number
|
||||
1+2 // code of charset_database and charset_database_number
|
||||
], *start, *start_of_status;
|
||||
uchar buf[QUERY_HEADER_LEN + MAX_SIZE_LOG_EVENT_STATUS];
|
||||
uchar *start, *start_of_status;
|
||||
ulong event_length;
|
||||
|
||||
if (!query)
|
||||
|
@ -1613,10 +2178,8 @@ bool Query_log_event::write(IO_CACHE* file)
|
|||
{
|
||||
/* In the TZ sys table, column Name is of length 64 so this should be ok */
|
||||
DBUG_ASSERT(time_zone_len <= MAX_TIME_ZONE_NAME_LENGTH);
|
||||
*start++= Q_TIME_ZONE_CODE;
|
||||
*start++= time_zone_len;
|
||||
memcpy(start, time_zone_str, time_zone_len);
|
||||
start+= time_zone_len;
|
||||
write_str_with_code_and_len((char **)(&start),
|
||||
time_zone_str, time_zone_len, Q_TIME_ZONE_CODE);
|
||||
}
|
||||
if (lc_time_names_number)
|
||||
{
|
||||
|
@ -1632,7 +2195,17 @@ bool Query_log_event::write(IO_CACHE* file)
|
|||
int2store(start, charset_database_number);
|
||||
start+= 2;
|
||||
}
|
||||
if (table_map_for_update)
|
||||
{
|
||||
*start++= Q_TABLE_MAP_FOR_UPDATE_CODE;
|
||||
int8store(start, table_map_for_update);
|
||||
start+= 8;
|
||||
}
|
||||
/*
|
||||
NOTE: When adding new status vars, please don't forget to update
|
||||
the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update function
|
||||
code_name in this file.
|
||||
|
||||
Here there could be code like
|
||||
if (command-line-option-which-says-"log_this_variable" && inited)
|
||||
{
|
||||
|
@ -1709,7 +2282,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
|
|||
auto_increment_increment(thd_arg->variables.auto_increment_increment),
|
||||
auto_increment_offset(thd_arg->variables.auto_increment_offset),
|
||||
lc_time_names_number(thd_arg->variables.lc_time_names->number),
|
||||
charset_database_number(0)
|
||||
charset_database_number(0),
|
||||
table_map_for_update((ulonglong)thd_arg->table_map_for_update)
|
||||
{
|
||||
time_t end_time;
|
||||
|
||||
|
@ -1838,6 +2412,7 @@ code_name(int code)
|
|||
case Q_CATALOG_NZ_CODE: return "Q_CATALOG_NZ_CODE";
|
||||
case Q_LC_TIME_NAMES_CODE: return "Q_LC_TIME_NAMES_CODE";
|
||||
case Q_CHARSET_DATABASE_CODE: return "Q_CHARSET_DATABASE_CODE";
|
||||
case Q_TABLE_MAP_FOR_UPDATE_CODE: return "Q_TABLE_MAP_FOR_UPDATE_CODE";
|
||||
}
|
||||
sprintf(buf, "CODE#%d", code);
|
||||
return buf;
|
||||
|
@ -1874,7 +2449,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
|||
db(NullS), catalog_len(0), status_vars_len(0),
|
||||
flags2_inited(0), sql_mode_inited(0), charset_inited(0),
|
||||
auto_increment_increment(1), auto_increment_offset(1),
|
||||
time_zone_len(0), lc_time_names_number(0), charset_database_number(0)
|
||||
time_zone_len(0), lc_time_names_number(0), charset_database_number(0),
|
||||
table_map_for_update(0)
|
||||
{
|
||||
ulong data_len;
|
||||
uint32 tmp;
|
||||
|
@ -2016,6 +2592,11 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
|||
charset_database_number= uint2korr(pos);
|
||||
pos+= 2;
|
||||
break;
|
||||
case Q_TABLE_MAP_FOR_UPDATE_CODE:
|
||||
CHECK_SPACE(pos, end, 8);
|
||||
table_map_for_update= uint8korr(pos);
|
||||
pos+= 8;
|
||||
break;
|
||||
default:
|
||||
/* That's why you must write status vars in growing order of code */
|
||||
DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\
|
||||
|
@ -2423,6 +3004,8 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
|
|||
else
|
||||
thd->variables.collation_database= thd->db_charset;
|
||||
|
||||
thd->table_map_for_update= (table_map)table_map_for_update;
|
||||
|
||||
/* Execute the query (note that we bypass dispatch_command()) */
|
||||
const char* found_semicolon= NULL;
|
||||
mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);
|
||||
|
@ -2679,7 +3262,8 @@ void Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
|||
print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
|
||||
!print_event_info->short_form)
|
||||
{
|
||||
my_b_printf(&cache, "BINLOG '\n");
|
||||
if (print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
|
||||
my_b_printf(&cache, "BINLOG '\n");
|
||||
print_base64(&cache, print_event_info, FALSE);
|
||||
print_event_info->printed_fd_event= TRUE;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,14 @@
|
|||
|
||||
#include <my_bitmap.h>
|
||||
#include "rpl_constants.h"
|
||||
|
||||
#ifdef MYSQL_CLIENT
|
||||
#include "rpl_utility.h"
|
||||
#include "hash.h"
|
||||
#include "rpl_tblmap.h"
|
||||
#include "rpl_tblmap.cc"
|
||||
#endif
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
#include "rpl_record.h"
|
||||
#include "rpl_reporting.h"
|
||||
|
@ -237,12 +245,15 @@ struct sql_ex_info
|
|||
packet (i.e. a query) sent from client to master;
|
||||
First, an auxiliary log_event status vars estimation:
|
||||
*/
|
||||
#define MAX_SIZE_LOG_EVENT_STATUS (4 /* flags2 */ + \
|
||||
8 /* sql mode */ + \
|
||||
1 + 1 + 255 /* catalog */ + \
|
||||
4 /* autoinc */ + \
|
||||
6 /* charset */ + \
|
||||
MAX_TIME_ZONE_NAME_LENGTH)
|
||||
#define MAX_SIZE_LOG_EVENT_STATUS (1 + 4 /* type, flags2 */ + \
|
||||
1 + 8 /* type, sql_mode */ + \
|
||||
1 + 1 + 255 /* type, length, catalog */ + \
|
||||
1 + 4 /* type, auto_increment */ + \
|
||||
1 + 6 /* type, charset */ + \
|
||||
1 + 1 + 255 /* type, length, time_zone */ + \
|
||||
1 + 2 /* type, lc_time_names_number */ + \
|
||||
1 + 2 /* type, charset_database_number */ + \
|
||||
1 + 8 /* type, table_map_for_update */)
|
||||
#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
|
||||
LOG_EVENT_HEADER_LEN + /* write_header */ \
|
||||
QUERY_HEADER_LEN + /* write_data */ \
|
||||
|
@ -306,6 +317,8 @@ struct sql_ex_info
|
|||
#define Q_LC_TIME_NAMES_CODE 7
|
||||
|
||||
#define Q_CHARSET_DATABASE_CODE 8
|
||||
|
||||
#define Q_TABLE_MAP_FOR_UPDATE_CODE 9
|
||||
/* Intvar event post-header */
|
||||
|
||||
#define I_TYPE_OFFSET 0
|
||||
|
@ -572,6 +585,7 @@ enum enum_base64_output_mode {
|
|||
BASE64_OUTPUT_AUTO= 1,
|
||||
BASE64_OUTPUT_ALWAYS= 2,
|
||||
BASE64_OUTPUT_UNSPEC= 3,
|
||||
BASE64_OUTPUT_DECODE_ROWS= 4,
|
||||
/* insert new output modes here */
|
||||
BASE64_OUTPUT_MODE_COUNT
|
||||
};
|
||||
|
@ -634,6 +648,11 @@ typedef struct st_print_event_info
|
|||
uint8 common_header_len;
|
||||
char delimiter[16];
|
||||
|
||||
#ifdef MYSQL_CLIENT
|
||||
uint verbose;
|
||||
table_mapping m_table_map;
|
||||
#endif
|
||||
|
||||
/*
|
||||
These two caches are used by the row-based replication events to
|
||||
collect the header information and the main body of the events
|
||||
|
@ -1455,6 +1474,22 @@ protected:
|
|||
This field is written if it is not 0.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>table_map_for_update</td>
|
||||
<td>Q_TABLE_MAP_FOR_UPDATE_CODE == 9</td>
|
||||
<td>8 byte integer</td>
|
||||
|
||||
<td>The value of the table map that is to be updated by the
|
||||
multi-table update query statement. Every bit of this variable
|
||||
represents a table, and is set to 1 if the corresponding table is
|
||||
to be updated by this statement.
|
||||
|
||||
The value of this variable is set when executing a multi-table update
|
||||
statement and used by slave to apply filter rules without opening
|
||||
all the tables on slave. This is required because some tables may
|
||||
not exist on slave because of the filter rules.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@subsection Query_log_event_notes_on_previous_versions Notes on Previous Versions
|
||||
|
@ -1471,6 +1506,9 @@ protected:
|
|||
|
||||
* See Q_CHARSET_DATABASE_CODE in the table above.
|
||||
|
||||
* When adding new status vars, please don't forget to update the
|
||||
MAX_SIZE_LOG_EVENT_STATUS, and update function code_name
|
||||
|
||||
*/
|
||||
class Query_log_event: public Log_event
|
||||
{
|
||||
|
@ -1548,6 +1586,11 @@ public:
|
|||
const char *time_zone_str;
|
||||
uint lc_time_names_number; /* 0 means en_US */
|
||||
uint charset_database_number;
|
||||
/*
|
||||
map for tables that will be updated for a multi-table update query
|
||||
statement, for other query statements, this will be zero.
|
||||
*/
|
||||
ulonglong table_map_for_update;
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
|
||||
|
@ -3235,6 +3278,17 @@ public:
|
|||
|
||||
~Table_map_log_event();
|
||||
|
||||
#ifdef MYSQL_CLIENT
|
||||
table_def *create_table_def()
|
||||
{
|
||||
return new table_def(m_coltype, m_colcnt, m_field_metadata,
|
||||
m_field_metadata_size, m_null_bits);
|
||||
}
|
||||
ulong get_table_id() const { return m_table_id; }
|
||||
const char *get_table_name() const { return m_tblnam; }
|
||||
const char *get_db_name() const { return m_dbnam; }
|
||||
#endif
|
||||
|
||||
virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; }
|
||||
virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }
|
||||
|
||||
|
@ -3365,6 +3419,12 @@ public:
|
|||
#ifdef MYSQL_CLIENT
|
||||
/* not for direct call, each derived has its own ::print() */
|
||||
virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0;
|
||||
void print_verbose(IO_CACHE *file,
|
||||
PRINT_EVENT_INFO *print_event_info);
|
||||
size_t print_verbose_one_row(IO_CACHE *file, table_def *td,
|
||||
PRINT_EVENT_INFO *print_event_info,
|
||||
MY_BITMAP *cols_bitmap,
|
||||
const uchar *ptr, const uchar *prefix);
|
||||
#endif
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
|
|
|
@ -8564,6 +8564,13 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_RANGE_SELECT *q,
|
|||
used_key_parts (used_key_parts_arg)
|
||||
{
|
||||
QUICK_RANGE *r;
|
||||
/*
|
||||
Use default MRR implementation for reverse scans. No table engine
|
||||
currently can do an MRR scan with output in reverse index order.
|
||||
*/
|
||||
multi_range_length= 0;
|
||||
multi_range= NULL;
|
||||
multi_range_buff= NULL;
|
||||
|
||||
QUICK_RANGE **pr= (QUICK_RANGE**)ranges.buffer;
|
||||
QUICK_RANGE **end_range= pr + ranges.elements;
|
||||
|
|
|
@ -345,14 +345,7 @@ public:
|
|||
void dbug_dump(int indent, bool verbose);
|
||||
#endif
|
||||
private:
|
||||
/* Used only by QUICK_SELECT_DESC */
|
||||
QUICK_RANGE_SELECT(const QUICK_RANGE_SELECT& org) : QUICK_SELECT_I()
|
||||
{
|
||||
bcopy(&org, this, sizeof(*this));
|
||||
multi_range_length= 0;
|
||||
multi_range= NULL;
|
||||
multi_range_buff= NULL;
|
||||
}
|
||||
/* Default copy ctor used by QUICK_SELECT_DESC */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,11 @@
|
|||
|
||||
#include "rpl_tblmap.h"
|
||||
|
||||
#ifdef MYSQL_CLIENT
|
||||
#define MAYBE_TABLE_NAME(T) ("")
|
||||
#else
|
||||
#define MAYBE_TABLE_NAME(T) ((T) ? (T)->s->table_name.str : "<>")
|
||||
#endif
|
||||
#define TABLE_ID_HASH_SIZE 32
|
||||
#define TABLE_ID_CHUNK 256
|
||||
|
||||
|
@ -42,11 +46,14 @@ table_mapping::table_mapping()
|
|||
|
||||
table_mapping::~table_mapping()
|
||||
{
|
||||
#ifdef MYSQL_CLIENT
|
||||
clear_tables();
|
||||
#endif
|
||||
hash_free(&m_table_ids);
|
||||
free_root(&m_mem_root, MYF(0));
|
||||
}
|
||||
|
||||
st_table* table_mapping::get_table(ulong table_id)
|
||||
TABLE* table_mapping::get_table(ulong table_id)
|
||||
{
|
||||
DBUG_ENTER("table_mapping::get_table(ulong)");
|
||||
DBUG_PRINT("enter", ("table_id: %lu", table_id));
|
||||
|
@ -104,8 +111,12 @@ int table_mapping::set_table(ulong table_id, TABLE* table)
|
|||
m_free= m_free->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef MYSQL_CLIENT
|
||||
free_table_map_log_event(e->table);
|
||||
#endif
|
||||
hash_delete(&m_table_ids,(uchar *)e);
|
||||
|
||||
}
|
||||
e->table_id= table_id;
|
||||
e->table= table;
|
||||
my_hash_insert(&m_table_ids,(uchar *)e);
|
||||
|
@ -140,6 +151,9 @@ void table_mapping::clear_tables()
|
|||
for (uint i= 0; i < m_table_ids.records; i++)
|
||||
{
|
||||
entry *e= (entry *)hash_element(&m_table_ids, i);
|
||||
#ifdef MYSQL_CLIENT
|
||||
free_table_map_log_event(e->table);
|
||||
#endif
|
||||
e->next= m_free;
|
||||
m_free= e;
|
||||
}
|
||||
|
|
|
@ -17,8 +17,15 @@
|
|||
#define TABLE_MAPPING_H
|
||||
|
||||
/* Forward declarations */
|
||||
#ifndef MYSQL_CLIENT
|
||||
struct st_table;
|
||||
typedef st_table TABLE;
|
||||
#else
|
||||
class Table_map_log_event;
|
||||
typedef Table_map_log_event TABLE;
|
||||
void free_table_map_log_event(TABLE *table);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
CLASS table_mapping
|
||||
|
|
|
@ -236,7 +236,9 @@ public:
|
|||
@retval 1 if the table definition is not compatible with @c table
|
||||
@retval 0 if the table definition is compatible with @c table
|
||||
*/
|
||||
#ifndef MYSQL_CLIENT
|
||||
int compatible_with(Relay_log_info const *rli, TABLE *table) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
ulong m_size; // Number of elements in the types array
|
||||
|
@ -247,6 +249,8 @@ private:
|
|||
uchar *m_memory;
|
||||
};
|
||||
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
/**
|
||||
Extend the normal table list with a few new fields needed by the
|
||||
slave thread, but nowhere else.
|
||||
|
@ -288,6 +292,7 @@ namespace {
|
|||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DBUG_PRINT_BITSET(N,FRM,BS) \
|
||||
do { \
|
||||
|
|
|
@ -3693,9 +3693,10 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name)
|
|||
|
||||
share->table_map_id is not ~0UL.
|
||||
*/
|
||||
static ulong last_table_id= ~0UL;
|
||||
|
||||
void assign_new_table_id(TABLE_SHARE *share)
|
||||
{
|
||||
static ulong last_table_id= ~0UL;
|
||||
|
||||
DBUG_ENTER("assign_new_table_id");
|
||||
|
||||
|
@ -3719,7 +3720,6 @@ void assign_new_table_id(TABLE_SHARE *share)
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Compare metadata versions of an element obtained from the table
|
||||
definition cache and its corresponding node in the parse tree.
|
||||
|
|
|
@ -514,6 +514,7 @@ THD::THD()
|
|||
lock_id(&main_lock_id),
|
||||
user_time(0), in_sub_stmt(0),
|
||||
binlog_table_maps(0), binlog_flags(0UL),
|
||||
table_map_for_update(0),
|
||||
arg_of_last_insert_id_function(FALSE),
|
||||
first_successful_insert_id_in_prev_stmt(0),
|
||||
first_successful_insert_id_in_prev_stmt_for_binlog(0),
|
||||
|
@ -1113,6 +1114,8 @@ void THD::cleanup_after_query()
|
|||
free_items();
|
||||
/* Reset where. */
|
||||
where= THD::DEFAULT_WHERE;
|
||||
/* reset table map for multi-table update */
|
||||
table_map_for_update= 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -396,7 +396,6 @@ struct system_variables
|
|||
DATE_TIME_FORMAT *datetime_format;
|
||||
DATE_TIME_FORMAT *time_format;
|
||||
my_bool sysdate_is_now;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1446,6 +1445,13 @@ public:
|
|||
Note: in the parser, stmt_arena == thd, even for PS/SP.
|
||||
*/
|
||||
Query_arena *stmt_arena;
|
||||
|
||||
/*
|
||||
map for tables that will be updated for a multi-table update query
|
||||
statement, for other query statements, this will be zero.
|
||||
*/
|
||||
table_map table_map_for_update;
|
||||
|
||||
/* Tells if LAST_INSERT_ID(#) was called for the current statement */
|
||||
bool arg_of_last_insert_id_function;
|
||||
/*
|
||||
|
|
|
@ -883,13 +883,6 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
|||
|
||||
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
|
||||
|
||||
/*
|
||||
This statement will be replicated as a statement, even when using
|
||||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
thd->clear_current_stmt_binlog_row_based();
|
||||
|
||||
length= build_table_filename(path, sizeof(path), db, "", "", 0);
|
||||
strmov(path+length, MY_DB_OPT_FILE); // Append db option file name
|
||||
del_dbopt(path); // Remove dboption hash entry
|
||||
|
@ -916,16 +909,36 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
|
|||
|
||||
|
||||
error= -1;
|
||||
/*
|
||||
We temporarily disable the binary log while dropping the objects
|
||||
in the database. Since the DROP DATABASE statement is always
|
||||
replicated as a statement, execution of it will drop all objects
|
||||
in the database on the slave as well, so there is no need to
|
||||
replicate the removal of the individual objects in the database
|
||||
as well.
|
||||
|
||||
This is more of a safety precaution, since normally no objects
|
||||
should be dropped while the database is being cleaned, but in
|
||||
the event that a change in the code to remove other objects is
|
||||
made, these drops should still not be logged.
|
||||
|
||||
Notice that the binary log have to be enabled over the call to
|
||||
ha_drop_database(), since NDB otherwise detects the binary log
|
||||
as disabled and will not log the drop database statement on any
|
||||
other connected server.
|
||||
*/
|
||||
if ((deleted= mysql_rm_known_files(thd, dirp, db, path, 0,
|
||||
&dropped_tables)) >= 0)
|
||||
{
|
||||
ha_drop_database(path);
|
||||
tmp_disable_binlog(thd);
|
||||
query_cache_invalidate1(db);
|
||||
(void) sp_drop_db_routines(thd, db); /* @todo Do not ignore errors */
|
||||
#ifdef HAVE_EVENT_SCHEDULER
|
||||
Events::drop_schema_events(thd, db);
|
||||
#endif
|
||||
error = 0;
|
||||
reenable_binlog(thd);
|
||||
}
|
||||
}
|
||||
if (!silent && deleted>=0)
|
||||
|
|
|
@ -1902,6 +1902,10 @@ mysql_execute_command(THD *thd)
|
|||
TABLE_LIST *all_tables;
|
||||
/* most outer SELECT_LEX_UNIT of query */
|
||||
SELECT_LEX_UNIT *unit= &lex->unit;
|
||||
#ifdef HAVE_REPLICATION
|
||||
/* have table map for update for multi-update statement (BUG#37051) */
|
||||
bool have_table_map_for_update= FALSE;
|
||||
#endif
|
||||
/* Saved variable value */
|
||||
DBUG_ENTER("mysql_execute_command");
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
|
@ -1967,6 +1971,48 @@ mysql_execute_command(THD *thd)
|
|||
// force searching in slave.cc:tables_ok()
|
||||
all_tables->updating= 1;
|
||||
}
|
||||
|
||||
/*
|
||||
For fix of BUG#37051, the master stores the table map for update
|
||||
in the Query_log_event, and the value is assigned to
|
||||
thd->variables.table_map_for_update before executing the update
|
||||
query.
|
||||
|
||||
If thd->variables.table_map_for_update is set, then we are
|
||||
replicating from a new master, we can use this value to apply
|
||||
filter rules without opening all the tables. However If
|
||||
thd->variables.table_map_for_update is not set, then we are
|
||||
replicating from an old master, so we just skip this and
|
||||
continue with the old method. And of course, the bug would still
|
||||
exist for old masters.
|
||||
*/
|
||||
if (lex->sql_command == SQLCOM_UPDATE_MULTI &&
|
||||
thd->table_map_for_update)
|
||||
{
|
||||
have_table_map_for_update= TRUE;
|
||||
table_map table_map_for_update= thd->table_map_for_update;
|
||||
uint nr= 0;
|
||||
TABLE_LIST *table;
|
||||
for (table=all_tables; table; table=table->next_global, nr++)
|
||||
{
|
||||
if (table_map_for_update & ((table_map)1 << nr))
|
||||
table->updating= TRUE;
|
||||
else
|
||||
table->updating= FALSE;
|
||||
}
|
||||
|
||||
if (all_tables_not_ok(thd, all_tables))
|
||||
{
|
||||
/* we warn the slave SQL thread */
|
||||
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
|
||||
if (thd->one_shot_set)
|
||||
reset_one_shot_variables(thd);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
for (table=all_tables; table; table=table->next_global)
|
||||
table->updating= TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
Check if statment should be skipped because of slave filtering
|
||||
|
@ -2881,7 +2927,7 @@ end_with_restore_list:
|
|||
|
||||
#ifdef HAVE_REPLICATION
|
||||
/* Check slave filtering rules */
|
||||
if (unlikely(thd->slave_thread))
|
||||
if (unlikely(thd->slave_thread && !have_table_map_for_update))
|
||||
{
|
||||
if (all_tables_not_ok(thd, all_tables))
|
||||
{
|
||||
|
@ -7418,7 +7464,7 @@ C_MODE_START
|
|||
int test_if_data_home_dir(const char *dir)
|
||||
{
|
||||
char path[FN_REFLEN];
|
||||
uint dir_len;
|
||||
int dir_len;
|
||||
DBUG_ENTER("test_if_data_home_dir");
|
||||
|
||||
if (!dir)
|
||||
|
|
|
@ -1794,7 +1794,8 @@ JOIN::exec()
|
|||
if (!items1)
|
||||
{
|
||||
items1= items0 + all_fields.elements;
|
||||
if (sort_and_group || curr_tmp_table->group)
|
||||
if (sort_and_group || curr_tmp_table->group ||
|
||||
tmp_table_param.precomputed_group_by)
|
||||
{
|
||||
if (change_to_use_tmp_fields(thd, items1,
|
||||
tmp_fields_list1, tmp_all_fields1,
|
||||
|
@ -9628,6 +9629,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||
MI_COLUMNDEF *recinfo;
|
||||
uint total_uneven_bit_length= 0;
|
||||
bool force_copy_fields= param->force_copy_fields;
|
||||
/* Treat sum functions as normal ones when loose index scan is used. */
|
||||
save_sum_fields|= param->precomputed_group_by;
|
||||
DBUG_ENTER("create_tmp_table");
|
||||
DBUG_PRINT("enter",
|
||||
("distinct: %d save_sum_fields: %d rows_limit: %lu group: %d",
|
||||
|
@ -13182,6 +13185,16 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
|
|||
table->key_read=1;
|
||||
table->file->extra(HA_EXTRA_KEYREAD);
|
||||
}
|
||||
else if (table->key_read)
|
||||
{
|
||||
/*
|
||||
Clear the covering key read flags that might have been
|
||||
previously set for some key other than the current best_key.
|
||||
*/
|
||||
table->key_read= 0;
|
||||
table->file->extra(HA_EXTRA_NO_KEYREAD);
|
||||
}
|
||||
|
||||
table->file->ha_index_or_rnd_end();
|
||||
if (join->select_options & SELECT_DESCRIBE)
|
||||
{
|
||||
|
|
|
@ -1000,7 +1000,7 @@ reopen_tables:
|
|||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
tables_for_update= get_table_map(fields);
|
||||
thd->table_map_for_update= tables_for_update= get_table_map(fields);
|
||||
|
||||
/*
|
||||
Setup timestamp handling and locking mode
|
||||
|
|
|
@ -196,7 +196,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
|
|||
packed=(packed+7)/8;
|
||||
if (pack_reclength != INT_MAX32)
|
||||
pack_reclength+= reclength+packed +
|
||||
test(test_all_bits(options, HA_OPTION_CHECKSUM | HA_PACK_RECORD));
|
||||
test(test_all_bits(options, HA_OPTION_CHECKSUM | HA_OPTION_PACK_RECORD));
|
||||
min_pack_length+=packed;
|
||||
|
||||
if (!ci->data_file_length && ci->max_rows)
|
||||
|
|
|
@ -42,7 +42,7 @@ ulong myisam_bulk_insert_tree_size=8192*1024;
|
|||
ulong myisam_data_pointer_size=4;
|
||||
|
||||
|
||||
static int always_valid(const char *filename)
|
||||
static int always_valid(const char *filename __attribute__((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -389,7 +389,7 @@ int rtree_get_first(MI_INFO *info, uint keynr, uint key_length)
|
|||
info->rtree_recursion_depth = -1;
|
||||
info->buff_used = 1;
|
||||
|
||||
return rtree_get_req(info, &keyinfo[keynr], key_length, root, 0);
|
||||
return rtree_get_req(info, keyinfo, key_length, root, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -436,7 +436,7 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
|
|||
return -1;
|
||||
}
|
||||
|
||||
return rtree_get_req(info, &keyinfo[keynr], key_length, root, 0);
|
||||
return rtree_get_req(info, keyinfo, key_length, root, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue