diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-10 11:19:25 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-10 11:19:25 +0300 |
commit | c11e5cdd12a6ffbc3c95e0abff6cc86920d592fa (patch) | |
tree | 1f860a1e1cb620fa9a71c99967bb19d64a8c2a3c | |
parent | 62dce14d156ff99836a23f5ccadcfaa19cf11f8a (diff) | |
parent | cf71cc838e608b4a4b8ae2557d4957ecb9bef97a (diff) | |
download | mariadb-git-c11e5cdd12a6ffbc3c95e0abff6cc86920d592fa.tar.gz |
Merge 10.3 into 10.4
77 files changed, 727 insertions, 417 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 41b7d192fc0..3cbe8859842 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2668,7 +2668,7 @@ static int fake_magic_space(const char *, int) static void initialize_readline () { /* Allow conditional parsing of the ~/.inputrc file. */ - rl_readline_name= "mysql"; + rl_readline_name= (char *) "mysql"; rl_terminal_name= getenv("TERM"); /* Tell the completer that we want a crack first. */ diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index fdb588118e6..453aab802c9 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -341,11 +341,9 @@ static bool page_is_corrupted(const byte *page, ulint page_no, memcpy(tmp_page, page, page_size); - bool decrypted = false; if (!space->crypt_data || space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED - || !fil_space_decrypt(space, tmp_frame, tmp_page, - &decrypted)) { + || !fil_space_decrypt(space, tmp_frame, tmp_page)) { return true; } diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 8a70182dc2d..f695b5c7f6d 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1529,7 +1529,8 @@ static int prepare_export() " --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu" - " --console --skip-log-error --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""), + " --console --skip-log-error --skip-log-bin --bootstrap < " + BOOTSTRAP_FILENAME IF_WIN("\"",""), mariabackup_exe, orig_argv1, (my_defaults_group_suffix?my_defaults_group_suffix:""), xtrabackup_use_memory); @@ -1541,7 +1542,8 @@ static int prepare_export() " --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu" - " --console --log-error= --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""), + " --console --log-error= --skip-log-bin --bootstrap < " + BOOTSTRAP_FILENAME IF_WIN("\"",""), mariabackup_exe, (my_defaults_group_suffix?my_defaults_group_suffix:""), xtrabackup_use_memory); diff --git a/include/my_global.h b/include/my_global.h index cc513cc1be0..ae12f233734 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -440,6 +440,20 @@ C_MODE_END #if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus) extern "C" int madvise(void *addr, size_t len, int behav); #endif +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif +/** FreeBSD equivalent */ +#if defined(MADV_CORE) && !defined(MADV_DODUMP) +#define MADV_DODUMP MADV_CORE +#define MADV_DONTDUMP MADV_NOCORE +#define DODUMP_STR "MADV_CORE" +#define DONTDUMP_STR "MADV_NOCORE" +#else +#define DODUMP_STR "MADV_DODUMP" +#define DONTDUMP_STR "MADV_DONTDUMP" +#endif + #define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ #define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ diff --git a/include/my_sys.h b/include/my_sys.h index 35e05597c92..8f0d98f68bb 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -964,8 +964,6 @@ extern ulonglong my_getcputime(void); #endif #ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> - #ifndef MAP_NOSYNC #define MAP_NOSYNC 0 #endif diff --git a/libmariadb b/libmariadb -Subproject 544b6f1d12f0e5b2a141129075ff2d64feb0e4c +Subproject 261a5c435581c8d6c6341afac95bcc5c96d1435 diff --git a/mysql-test/std_data/binlog_before_20574.bin b/mysql-test/std_data/binlog_before_20574.bin Binary files differnew file mode 100644 index 00000000000..596a883dc71 --- /dev/null +++ b/mysql-test/std_data/binlog_before_20574.bin diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result index 2af8b805be8..0cc1805eadc 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result @@ -327,6 +327,14 @@ 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; +# +# MDEV-20591 Wrong Number of rows in mysqlbinlog output. +# +CREATE TABLE t1(c_char_utf8 CHAR(10) , +c_varchar_utf8 char(10) , +c_text_utf8 blob ); +INSERT into t1 values("B", "B", REPEAT("#", 2000)); +drop table t1; flush logs; INSERT INTO t1dec102 VALUES (-999.99); INSERT INTO t1dec102 VALUES (0); @@ -5274,6 +5282,47 @@ SET TIMESTAMP=1000000000/*!*/; DROP TABLE `t1`,`t2` /* generated by server */ /*!*/; # at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-317 ddl +/*!100001 SET @@session.gtid_seq_no=317*//*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +CREATE TABLE t1(c_char_utf8 CHAR(10) , +c_varchar_utf8 char(10) , +c_text_utf8 blob ) +/*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-318 +/*!100001 SET @@session.gtid_seq_no=318*//*!*/; +BEGIN +/*!*/; +# at # +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: +#Q> INSERT into t1 values("B", "B", REPEAT("#", 2000)) +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +### INSERT INTO `test`.`t1` +### SET +### @1='B' /* STRING(10) meta=65034 nullable=1 is_null=0 */ +### @2='B' /* STRING(10) meta=65034 nullable=1 is_null=0 */ +### @3='################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */ +# Number of rows: 1 +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-319 ddl +/*!100001 SET @@session.gtid_seq_no=319*//*!*/; +# at # +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +SET TIMESTAMP=1000000000/*!*/; +DROP TABLE `t1` /* generated by server */ +/*!*/; +# at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Rotate to master-bin.000002 pos: 4 DELIMITER ; # End of log file @@ -5287,17 +5336,17 @@ DELIMITER /*!*/; # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 010909 4:46:40 # at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Gtid list [0-1-316] +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Gtid list [0-1-319] # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000001 # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000002 # at # -#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-317 +#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-320 /*!100101 SET @@session.skip_parallel_replication=0*//*!*/; /*!100001 SET @@session.gtid_domain_id=0*//*!*/; /*!100001 SET @@session.server_id=1*//*!*/; -/*!100001 SET @@session.gtid_seq_no=317*//*!*/; +/*!100001 SET @@session.gtid_seq_no=320*//*!*/; BEGIN /*!*/; # at # diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test index 3146330f0cd..add977bf07a 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test @@ -438,6 +438,18 @@ INSERT INTO t2 SET b=1; UPDATE t1, t2 SET t1.a=10, t2.a=20; DROP TABLE t1,t2; +--echo # +--echo # MDEV-20591 Wrong Number of rows in mysqlbinlog output. +--echo # + +CREATE TABLE t1(c_char_utf8 CHAR(10) , + c_varchar_utf8 char(10) , + c_text_utf8 blob ); + +INSERT into t1 values("B", "B", REPEAT("#", 2000)); + +drop table t1; + flush logs; let $MYSQLD_DATADIR= `select @@datadir`; @@ -462,3 +474,4 @@ flush logs; --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/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ --error 1 --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000002 2>&1 + diff --git a/mysql-test/suite/binlog_encryption/binlog_mdev_20574_old_binlog.result b/mysql-test/suite/binlog_encryption/binlog_mdev_20574_old_binlog.result new file mode 100644 index 00000000000..cf660297640 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_mdev_20574_old_binlog.result @@ -0,0 +1,27 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +connection master; +include/rpl_stop_server.inc [server_number=1] +# Data in binlog +# CREATE TABLE t1 (a INT); +# INSERT INTO t1 VALUES (1),(2),(3); +# REPLACE INTO t1 VALUES (4); +include/rpl_start_server.inc [server_number=1] +connection slave; +RESET SLAVE; +RESET MASTER; +CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4; +include/start_slave.inc +DESC t1; +Field Type Null Key Default Extra +a int(11) YES NULL +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +4 +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/binlog_mdev_20574_old_binlog.test b/mysql-test/suite/binlog_encryption/binlog_mdev_20574_old_binlog.test new file mode 100644 index 00000000000..417df631878 --- /dev/null +++ b/mysql-test/suite/binlog_encryption/binlog_mdev_20574_old_binlog.test @@ -0,0 +1,46 @@ +# MDEV-20574 Position of events reported by mysqlbinlog is wrong with encrypted binlogs, SHOW BINLOG EVENTS reports the correct one. +# Test replicating off old master. +# Test case Desc:- When new server reads the data from old server binlog which +# does not send START_ENCRYPTION_EVENT to slave. +# We simulate old master by copying in pre-generated binlog files from earlier +# server versions with encrypted binlog. +--source include/have_binlog_format_row.inc +--source include/master-slave.inc +--source include/have_innodb.inc + +--connection slave +--source include/stop_slave.inc + +--connection master +--let $datadir= `SELECT @@datadir` + +--let $rpl_server_number= 1 +--source include/rpl_stop_server.inc + +--remove_file $datadir/master-bin.000001 +--remove_file $datadir/master-bin.state +--echo # Data in binlog +--echo # CREATE TABLE t1 (a INT); +--echo # INSERT INTO t1 VALUES (1),(2),(3); +--echo # REPLACE INTO t1 VALUES (4); + +--copy_file $MYSQL_TEST_DIR/std_data/binlog_before_20574.bin $datadir/master-bin.000001 + +--let $rpl_server_number= 1 +--source include/rpl_start_server.inc + +--source include/wait_until_connected_again.inc +--save_master_pos + +--connection slave +RESET SLAVE; +RESET MASTER; +--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 +eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4; +--source include/start_slave.inc +--sync_with_master +DESC t1; +SELECT * FROM t1 ORDER BY a; + +DROP TABLE t1; +--source include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result index a6054f00ebc..b783488b07a 100644 --- a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result +++ b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result @@ -104,6 +104,9 @@ DELIMITER /*!*/; #010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup ROLLBACK/*!*/; # at # +#010909 4:46:40 server id # end_log_pos # Ignorable +# Ignorable event type 164 (Start_encryption) +# at # #010909 4:46:40 server id # end_log_pos # Gtid list [] # at # #010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001 @@ -342,6 +345,9 @@ DELIMITER /*!*/; #010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup ROLLBACK/*!*/; # at # +#010909 4:46:40 server id # end_log_pos # Ignorable +# Ignorable event type 164 (Start_encryption) +# at # #010909 4:46:40 server id # end_log_pos # Gtid list [] # at # #010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001 @@ -502,6 +508,9 @@ DELIMITER /*!*/; #010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup ROLLBACK/*!*/; # at # +#010909 4:46:40 server id # end_log_pos # Ignorable +# Ignorable event type 164 (Start_encryption) +# at # #010909 4:46:40 server id # end_log_pos # Gtid list [] # at # #010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001 diff --git a/mysql-test/suite/binlog_encryption/mysqlbinlog.result b/mysql-test/suite/binlog_encryption/mysqlbinlog.result index 71758f7d6e7..e97e0569571 100644 --- a/mysql-test/suite/binlog_encryption/mysqlbinlog.result +++ b/mysql-test/suite/binlog_encryption/mysqlbinlog.result @@ -4,3 +4,4 @@ INSERT INTO t1 VALUES (1),(2),(3); REPLACE INTO t1 VALUES (4); DROP TABLE t1; FLUSH LOGS; +FOUND 1 /Ignorable event type 164.*/ in binlog_enc.sql diff --git a/mysql-test/suite/binlog_encryption/mysqlbinlog.test b/mysql-test/suite/binlog_encryption/mysqlbinlog.test index b80388aaa45..108dbd8782f 100644 --- a/mysql-test/suite/binlog_encryption/mysqlbinlog.test +++ b/mysql-test/suite/binlog_encryption/mysqlbinlog.test @@ -17,5 +17,8 @@ let outfile=$MYSQLTEST_VARDIR/tmp/binlog_enc.sql; exec $MYSQL_BINLOG $local > $outfile; exec $MYSQL_BINLOG $local --force-read >> $outfile; exec $MYSQL_BINLOG $remote >> $outfile; +--let SEARCH_FILE= $outfile +--let SEARCH_PATTERN= Ignorable event type 164.* +--source include/search_pattern_in_file.inc remove_file $outfile; diff --git a/mysql-test/suite/mariabackup/partial.test b/mysql-test/suite/mariabackup/partial.test index 559ba155972..53388b1947f 100644 --- a/mysql-test/suite/mariabackup/partial.test +++ b/mysql-test/suite/mariabackup/partial.test @@ -12,7 +12,7 @@ CREATE TABLE t2(i int) ENGINE INNODB; echo # xtrabackup backup; -let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let targetdir=$MYSQLTEST_VARDIR/tmp/backup; --disable_result_log exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.*1" --target-dir=$targetdir; --enable_result_log @@ -25,13 +25,27 @@ EOF write_file $targetdir/test/junk.frm; EOF +let server_cnf=$targetdir/server.cnf; +copy_file $MYSQLTEST_VARDIR/my.cnf $server_cnf; + +# Emulate server config file turnes on binary logs +perl; +my $binlog_path="$ENV{'targetdir'}/mysqld-bin"; +my $config_path=$ENV{'server_cnf'}; +open(my $fd, '>>', "$config_path"); +print $fd "\n[mysqld]\n"; +print $fd "log-bin=$binlog_path\n"; +close $fd; +EOF echo # xtrabackup prepare; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir; +exec $XTRABACKUP --defaults-file=$server_cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir; --enable_result_log list_files $targetdir/test *.cfg; +# There must not be binary logs created on --prepare step +list_files $targetdir/ mysqld-bin.*; let $MYSQLD_DATADIR= `select @@datadir`; ALTER TABLE t1 DISCARD TABLESPACE; diff --git a/mysql-test/suite/rpl/include/rpl_binlog_errors.inc b/mysql-test/suite/rpl/include/rpl_binlog_errors.inc index 46c76f2b04c..72f8bc053e3 100644 --- a/mysql-test/suite/rpl/include/rpl_binlog_errors.inc +++ b/mysql-test/suite/rpl/include/rpl_binlog_errors.inc @@ -431,5 +431,7 @@ call mtr.add_suppression("Can't generate a unique log-filename .*"); -- source include/stop_slave_sql.inc RESET SLAVE; RESET MASTER; +--remove_file $load_file +--remove_file $load_file2 --let $rpl_only_running_threads= 1 --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_000011.result b/mysql-test/suite/rpl/r/rpl_000011.result index 136a6a3aacb..eb0d89bd3cb 100644 --- a/mysql-test/suite/rpl/r/rpl_000011.result +++ b/mysql-test/suite/rpl/r/rpl_000011.result @@ -1,15 +1,13 @@ include/master-slave.inc [connection master] +connection slave; +connection master; create table t1 (n int); insert into t1 values(1); connection slave; -show global status like 'com_insert'; -Variable_name Value -Com_insert 1 +# Com_insert = 1 stop slave; -show global status like 'com_insert'; -Variable_name Value -Com_insert 1 +# Com_insert = 1 include/wait_for_slave_to_stop.inc start slave; include/wait_for_slave_to_start.inc diff --git a/mysql-test/suite/rpl/r/rpl_ip_mix.result b/mysql-test/suite/rpl/r/rpl_ip_mix.result index e139f863c8a..cc11f481991 100644 --- a/mysql-test/suite/rpl/r/rpl_ip_mix.result +++ b/mysql-test/suite/rpl/r/rpl_ip_mix.result @@ -64,3 +64,5 @@ Master-Host: 127.0.0.1 change master to master_host='0:0:0:0:0:0:0:1'; Master-Host: 0:0:0:0:0:0:0:1 CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; +connection slave; +reset slave all; diff --git a/mysql-test/suite/rpl/r/rpl_ip_mix2.result b/mysql-test/suite/rpl/r/rpl_ip_mix2.result index 70599d097a7..d304eff9ab4 100644 --- a/mysql-test/suite/rpl/r/rpl_ip_mix2.result +++ b/mysql-test/suite/rpl/r/rpl_ip_mix2.result @@ -64,3 +64,5 @@ Master-Host: 127.0.0.1 change master to master_host='0:0:0:0:0:0:0:1'; Master-Host: 0:0:0:0:0:0:0:1 CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; +connection slave; +reset slave all; diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result index 82f6f537329..2518b207111 100644 --- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result +++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result @@ -128,4 +128,6 @@ show binlog events in ''; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log purge master logs before now(); End of 5.0 tests +#cleanup include/stop_slave.inc +reset slave all; diff --git a/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result b/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result index 491fb68615c..269dc16733a 100644 --- a/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result +++ b/mysql-test/suite/rpl/r/rpl_row_find_row_debug.result @@ -15,7 +15,8 @@ DELETE FROM t1; DROP TABLE t1; connection slave; # Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log -Occurrences: update=1, delete=1 +FOUND 1 /The slave is applying a ROW event on behalf of an UPDATE statement on table t1 and is currently taking a considerable amount/ in mysqld.2.err +FOUND 1 /The slave is applying a ROW event on behalf of a DELETE statement on table t1 and is currently taking a considerable amount/ in mysqld.2.err include/stop_slave.inc SET GLOBAL debug_dbug = ''; SET GLOBAL log_warnings = 2; diff --git a/mysql-test/suite/rpl/r/rpl_skip_error.result b/mysql-test/suite/rpl/r/rpl_skip_error.result index 7d351339925..0172336a99c 100644 --- a/mysql-test/suite/rpl/r/rpl_skip_error.result +++ b/mysql-test/suite/rpl/r/rpl_skip_error.result @@ -1,5 +1,7 @@ include/master-slave.inc [connection master] +connection slave; +connection master; ==== Test Without sql_mode=strict_trans_tables ==== create table t1 (n int not null primary key); connection slave; @@ -105,9 +107,7 @@ t2 CREATE TABLE `t2` ( `data` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -show global status like 'slave_skipped_errors'; -Variable_name Value -Slave_skipped_errors 4 +# Slave_skipped_errros = 4 connection master; INSERT INTO t2 VALUES(1, 1); INSERT INTO t2 VALUES(2, 1); @@ -119,9 +119,7 @@ SET SQL_LOG_BIN=1; UPDATE t2 SET id= id + 3, data = 2; connection slave; -show global status like 'slave_skipped_errors'; -Variable_name Value -Slave_skipped_errors 5 +# Slave_skipped_errros = 5 **** We cannot execute a select as there are differences in the **** behavior between STMT and RBR. ==== Clean Up ==== diff --git a/mysql-test/suite/rpl/t/rpl_000011.test b/mysql-test/suite/rpl/t/rpl_000011.test index 216e568fc42..289b79f7de8 100644 --- a/mysql-test/suite/rpl/t/rpl_000011.test +++ b/mysql-test/suite/rpl/t/rpl_000011.test @@ -5,19 +5,19 @@ # source include/master-slave.inc; - +--connection slave +let $initial_com_insert= query_get_value(show global status like "Com_insert", Value, 1); +--connection master create table t1 (n int); insert into t1 values(1); -sync_slave_with_master; -show global status like 'com_insert'; +sync_slave_with_master; +let $current_com_insert= query_get_value(show global status like "Com_insert", Value, 1); +--let $delta_com_insert= `select $current_com_insert - $initial_com_insert from dual` +--echo # Com_insert = $delta_com_insert stop slave; -# Temporary work-around for bug MDEV-8301. There is a small window during -# thread exit where the local status values of a thread are counted twice -# in the global status. Remove this wait_condition.inc once MDEV-8301 is -# fixed. ---let $wait_condition= SELECT variable_value=1 FROM information_schema.global_status WHERE variable_name="Com_insert"; ---source include/wait_condition.inc -show global status like 'com_insert'; +let $current_com_insert= query_get_value(show global status like "Com_insert", Value, 1); +--let $delta_com_insert= `select $current_com_insert - $initial_com_insert from dual` +--echo # Com_insert = $delta_com_insert --source include/wait_for_slave_to_stop.inc start slave; --source include/wait_for_slave_to_start.inc diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix.test b/mysql-test/suite/rpl/t/rpl_ip_mix.test index 3ddbd598334..63c5fa9251c 100644 --- a/mysql-test/suite/rpl/t/rpl_ip_mix.test +++ b/mysql-test/suite/rpl/t/rpl_ip_mix.test @@ -44,3 +44,5 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); # clean up CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; +--connection slave +reset slave all; diff --git a/mysql-test/suite/rpl/t/rpl_ip_mix2.test b/mysql-test/suite/rpl/t/rpl_ip_mix2.test index feaf4af44cf..3fff54e52bf 100644 --- a/mysql-test/suite/rpl/t/rpl_ip_mix2.test +++ b/mysql-test/suite/rpl/t/rpl_ip_mix2.test @@ -45,3 +45,5 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); # clean up CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; +connection slave; +reset slave all; diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test index 358c0be5b3b..0d65a05bf50 100644 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test +++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test @@ -193,4 +193,8 @@ show binlog events in ''; purge master logs before now(); --echo End of 5.0 tests +--echo #cleanup + +--remove_file $MYSQLD_SLAVE_DATADIR/master.info --source include/stop_slave.inc +reset slave all; diff --git a/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test b/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test index fb7491b0077..9c0ee1cdbbb 100644 --- a/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test +++ b/mysql-test/suite/rpl/t/rpl_row_find_row_debug.test @@ -42,16 +42,11 @@ DROP TABLE t1; --sync_slave_with_master --echo # Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log -perl; - use strict; - my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set"; - open(FILE, "$log_error") or die("Unable to open $log_error: $!\n"); - my $upd_count = () = grep(/The slave is applying a ROW event on behalf of an UPDATE statement on table t1 and is currently taking a considerable amount/g,<FILE>); - seek(FILE, 0, 0) or die "Can't seek to beginning of file: $!"; - my $del_count = () = grep(/The slave is applying a ROW event on behalf of a DELETE statement on table t1 and is currently taking a considerable amount/g,<FILE>); - print "Occurrences: update=$upd_count, delete=$del_count\n"; - close(FILE); -EOF +--let SEARCH_FILE=$log_error_ +--let SEARCH_PATTERN=The slave is applying a ROW event on behalf of an UPDATE statement on table t1 and is currently taking a considerable amount +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=The slave is applying a ROW event on behalf of a DELETE statement on table t1 and is currently taking a considerable amount +--source include/search_pattern_in_file.inc # cleanup --source include/stop_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_skip_error.test b/mysql-test/suite/rpl/t/rpl_skip_error.test index fa8eeb73fba..d3ef834e8ec 100644 --- a/mysql-test/suite/rpl/t/rpl_skip_error.test +++ b/mysql-test/suite/rpl/t/rpl_skip_error.test @@ -26,6 +26,10 @@ source include/have_innodb.inc; source include/master-slave.inc; +--connection slave +let $initial_skipped_error= query_get_value(show global status like "Slave_skipped_errors", Value, 1); + +connection master; --echo ==== Test Without sql_mode=strict_trans_tables ==== create table t1 (n int not null primary key); @@ -133,8 +137,9 @@ connection slave; CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam; SHOW CREATE TABLE t2; -show global status like 'slave_skipped_errors'; - +let $current_skipped_error= query_get_value(show global status like "Slave_skipped_errors", Value, 1); +--let $delta_skipped_error= `select $current_skipped_error - $initial_skipped_error from dual` +--echo # Slave_skipped_errros = $delta_skipped_error connection master; INSERT INTO t2 VALUES(1, 1); @@ -151,7 +156,10 @@ sync_slave_with_master; let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); echo $error; -show global status like 'slave_skipped_errors'; + +let $current_skipped_error= query_get_value(show global status like "Slave_skipped_errors", Value, 1); +--let $delta_skipped_error= `select $current_skipped_error - $initial_skipped_error from dual` +--echo # Slave_skipped_errros = $delta_skipped_error --echo **** We cannot execute a select as there are differences in the --echo **** behavior between STMT and RBR. diff --git a/mysys/my_lockmem.c b/mysys/my_lockmem.c index b70d5948111..e159502a278 100644 --- a/mysys/my_lockmem.c +++ b/mysys/my_lockmem.c @@ -20,7 +20,6 @@ #include <my_list.h> #ifdef HAVE_MLOCK -#include <sys/mman.h> struct st_mem_list { diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c index 4faf05847d8..af86b19f309 100644 --- a/sql-common/client_plugin.c +++ b/sql-common/client_plugin.c @@ -28,11 +28,6 @@ There is no reference counting and no unloading either. */ -#if defined(_MSC_VER) -/* Silence warnings about variable 'unused' being used. */ -#define FORCE_INIT_OF_VARS 1 -#endif - #include <my_global.h> #include "mysql.h" #include <my_sys.h> @@ -243,12 +238,12 @@ int mysql_client_plugin_init() struct st_mysql_client_plugin **builtin; va_list unused; DBUG_ENTER("mysql_client_plugin_init"); - LINT_INIT_STRUCT(unused); if (initialized) DBUG_RETURN(0); bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */ + bzero(&unused, sizeof unused); mysql_mutex_init(0, &LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW); init_alloc_root(&mem_root, "client_plugin", 128, 128, MYF(0)); @@ -306,9 +301,7 @@ struct st_mysql_client_plugin * mysql_client_register_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin) { - va_list unused; DBUG_ENTER("mysql_client_register_plugin"); - LINT_INIT_STRUCT(unused); if (is_not_initialized(mysql, plugin->name)) DBUG_RETURN(NULL); @@ -324,7 +317,11 @@ mysql_client_register_plugin(MYSQL *mysql, plugin= NULL; } else + { + va_list unused; + bzero(&unused, sizeof unused); plugin= add_plugin(mysql, plugin, 0, 0, unused); + } mysql_mutex_unlock(&LOCK_load_client_plugin); DBUG_RETURN(plugin); diff --git a/sql/log_event.cc b/sql/log_event.cc index 060c4592a74..53762e0d6c0 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2101,6 +2101,19 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len, alg != BINLOG_CHECKSUM_ALG_OFF)) event_len= event_len - BINLOG_CHECKSUM_LEN; + /* + Create an object of Ignorable_log_event for unrecognized sub-class. + So that SLAVE SQL THREAD will only update the position and continue. + We should look for this flag first instead of judging by event_type + Any event can be Ignorable_log_event if it has this flag on. + look into @note of Ignorable_log_event + */ + if (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F) + { + ev= new Ignorable_log_event(buf, fdle, + get_type_str((Log_event_type) event_type)); + goto exit; + } switch(event_type) { case QUERY_EVENT: ev = new Query_log_event(buf, event_len, fdle, QUERY_EVENT); @@ -2227,24 +2240,13 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len, ev = new Start_encryption_log_event(buf, event_len, fdle); break; default: - /* - Create an object of Ignorable_log_event for unrecognized sub-class. - So that SLAVE SQL THREAD will only update the position and continue. - */ - if (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F) - { - ev= new Ignorable_log_event(buf, fdle, - get_type_str((Log_event_type) event_type)); - } - else - { - DBUG_PRINT("error",("Unknown event code: %d", - (uchar) buf[EVENT_TYPE_OFFSET])); - ev= NULL; - break; - } + DBUG_PRINT("error",("Unknown event code: %d", + (uchar) buf[EVENT_TYPE_OFFSET])); + ev= NULL; + break; } } +exit: if (ev) { @@ -3426,7 +3428,18 @@ static size_t calc_field_event_length(const uchar *ptr, uint type, uint meta) case MYSQL_TYPE_SET: return meta & 0xFF; case MYSQL_TYPE_BLOB: - return (meta <= 4 ? meta : 0); + switch (meta) { + default: + return 0; + case 1: + return *ptr + 1; + case 2: + return uint2korr(ptr) + 2; + case 3: + return uint3korr(ptr) + 3; + case 4: + return uint4korr(ptr) + 4; + } case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_VAR_STRING: length= meta; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d21cfc9af7d..bed82300099 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -163,16 +163,11 @@ extern "C" { // Because of SCO 3.2V4.2 #include <my_libwrap.h> -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif - #ifdef __WIN__ #include <crtdbg.h> #endif #ifdef HAVE_SOLARIS_LARGE_PAGES -#include <sys/mman.h> #if defined(__sun__) && defined(__GNUC__) && defined(__cplusplus) \ && defined(_XOPEN_SOURCE) extern int getpagesizes(size_t *, int); diff --git a/sql/slave.cc b/sql/slave.cc index f480e68232f..1ed701c75a2 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -6292,6 +6292,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) DBUG_ASSERT(debug_sync_service); DBUG_ASSERT(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); + dbug_rows_event_count = 0; };); #endif mysql_mutex_lock(&mi->data_lock); @@ -6818,7 +6819,18 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) mi->last_queued_gtid.seq_no == 1000) goto skip_relay_logging; }); + goto default_action; #endif + case START_ENCRYPTION_EVENT: + if (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F) + { + /* + If the event was not requested by the slave (the slave did not ask for + it), i.e. has end_log_pos=0, we do not increment mi->master_log_pos + */ + inc_pos= uint4korr(buf+LOG_POS_OFFSET) ? event_len : 0; + break; + } /* fall through */ default: default_action: diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 19f472e0280..4c67b14e8f5 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3926,32 +3926,6 @@ open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags, goto end; } - if (get_use_stat_tables_mode(thd) > NEVER && tables->table) - { - TABLE_SHARE *table_share= tables->table->s; - if (table_share && table_share->table_category == TABLE_CATEGORY_USER && - table_share->tmp_table == NO_TMP_TABLE) - { - if (table_share->stats_cb.stats_can_be_read || - !alloc_statistics_for_table_share(thd, table_share, FALSE)) - { - if (table_share->stats_cb.stats_can_be_read) - { - KEY *key_info= table_share->key_info; - KEY *key_info_end= key_info + table_share->keys; - KEY *table_key_info= tables->table->key_info; - for ( ; key_info < key_info_end; key_info++, table_key_info++) - table_key_info->read_stats= key_info->read_stats; - Field **field_ptr= table_share->field; - Field **table_field_ptr= tables->table->field; - for ( ; *field_ptr; field_ptr++, table_field_ptr++) - (*table_field_ptr)->read_stats= (*field_ptr)->read_stats; - tables->table->stats_is_read= table_share->stats_cb.stats_is_read; - } - } - } - } - process_view_routines: /* Again we may need cache all routines used by this view and add diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 54f7db3e684..5b649b739c6 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -329,9 +329,6 @@ TODO list: */ #include "mariadb.h" /* NO_EMBEDDED_ACCESS_CHECKS */ -#if defined(DBUG_OFF) && defined(HAVE_MADVISE) -#include <sys/mman.h> -#endif #include "sql_priv.h" #include "sql_basic_types.h" #include "sql_cache.h" @@ -2661,7 +2658,7 @@ size_t Query_cache::init_cache() #if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DONTDUMP) if (madvise(cache, query_cache_size+additional_data_size, MADV_DONTDUMP)) { - DBUG_PRINT("warning", ("coudn't mark query cache memory as MADV_DONTDUMP: %s", + DBUG_PRINT("warning", ("coudn't mark query cache memory as " DONTDUMP_STR ": %s", strerror(errno))); } #endif @@ -2830,7 +2827,7 @@ void Query_cache::free_cache() #if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DODUMP) if (madvise(cache, query_cache_size+additional_data_size, MADV_DODUMP)) { - DBUG_PRINT("warning", ("coudn't mark query cache memory as MADV_DODUMP: %s", + DBUG_PRINT("warning", ("coudn't mark query cache memory as " DODUMP_STR ": %s", strerror(errno))); } #endif diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 363c5d35499..1ffb7fe258e 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -865,7 +865,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) invoker.init(); prepare_derived_at_open= FALSE; create_tmp_table_for_derived= FALSE; - force_read_stats= FALSE; save_prep_leaf_list= FALSE; org_charset= 0; /* Restore THR_THD */ diff --git a/sql/sql_class.h b/sql/sql_class.h index 6af2ea53afc..c98c0e4621c 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2429,9 +2429,6 @@ public: */ bool create_tmp_table_for_derived; - /* The flag to force reading statistics from EITS tables */ - bool force_read_stats; - bool save_prep_leaf_list; /* container for handler's private per-connection data */ diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index f9ec262e0b8..a0f952955d5 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -428,16 +428,27 @@ static int send_file(THD *thd) /** Internal to mysql_binlog_send() routine that recalculates checksum for - a FD event (asserted) that needs additional arranment prior sending to slave. + 1. FD event (asserted) that needs additional arranment prior sending to slave. + 2. Start_encryption_log_event whose Ignored flag is set +TODO DBUG_ASSERT can be removed if this function is used for more general cases */ -inline void fix_checksum(String *packet, ulong ev_offset) + +inline void fix_checksum(enum_binlog_checksum_alg checksum_alg, String *packet, + ulong ev_offset) { + if (checksum_alg == BINLOG_CHECKSUM_ALG_OFF || + checksum_alg == BINLOG_CHECKSUM_ALG_UNDEF) + return; /* recalculate the crc for this event */ uint data_len = uint4korr(packet->ptr() + ev_offset + EVENT_LEN_OFFSET); ha_checksum crc; - DBUG_ASSERT(data_len == + DBUG_ASSERT((data_len == LOG_EVENT_MINIMAL_HEADER_LEN + FORMAT_DESCRIPTION_HEADER_LEN + - BINLOG_CHECKSUM_ALG_DESC_LEN + BINLOG_CHECKSUM_LEN); + BINLOG_CHECKSUM_ALG_DESC_LEN + BINLOG_CHECKSUM_LEN) || + (data_len == + LOG_EVENT_MINIMAL_HEADER_LEN + BINLOG_CRYPTO_SCHEME_LENGTH + + BINLOG_KEY_VERSION_LENGTH + BINLOG_NONCE_LENGTH + + BINLOG_CHECKSUM_LEN)); crc= my_checksum(0, (uchar *)packet->ptr() + ev_offset, data_len - BINLOG_CHECKSUM_LEN); int4store(packet->ptr() + ev_offset + data_len - BINLOG_CHECKSUM_LEN, crc); @@ -2215,6 +2226,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, THD *thd= info->thd; String *packet= info->packet; Log_event_type event_type; + bool initial_log_pos= info->clear_initial_log_pos; DBUG_ENTER("send_format_descriptor_event"); /** @@ -2313,7 +2325,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, (*packet)[FLAGS_OFFSET+ev_offset] &= ~LOG_EVENT_BINLOG_IN_USE_F; - if (info->clear_initial_log_pos) + if (initial_log_pos) { info->clear_initial_log_pos= false; /* @@ -2331,9 +2343,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, ST_CREATED_OFFSET+ev_offset, (ulong) 0); /* fix the checksum due to latest changes in header */ - if (info->current_checksum_alg != BINLOG_CHECKSUM_ALG_OFF && - info->current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF) - fix_checksum(packet, ev_offset); + fix_checksum(info->current_checksum_alg, packet, ev_offset); } else if (info->using_gtid_state) { @@ -2354,9 +2364,7 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, { int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+ ST_CREATED_OFFSET+ev_offset, (ulong) 0); - if (info->current_checksum_alg != BINLOG_CHECKSUM_ALG_OFF && - info->current_checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF) - fix_checksum(packet, ev_offset); + fix_checksum(info->current_checksum_alg, packet, ev_offset); } } @@ -2369,12 +2377,16 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, } /* - Read the following Start_encryption_log_event but don't send it to slave. - Slave doesn't need to know whether master's binlog is encrypted, - and if it'll want to encrypt its logs, it should generate its own - random nonce, not use the one from the master. + Read the following Start_encryption_log_event and send it to slave as + Ignorable_log_event. Although Slave doesn't need to know whether master's + binlog is encrypted but it needs to update slave log pos (for mysqlbinlog). + + If slave want to encrypt its logs, it should generate its own + random nonce, it should not use the one from the master. */ - packet->length(0); + /* reset transmit packet for the event read from binary log file */ + if (reset_transmit_packet(info, info->flags, &ev_offset, &info->errmsg)) + DBUG_RETURN(1); info->last_pos= linfo->pos; error= Log_event::read_log_event(log, packet, info->fdev, opt_master_verify_checksum @@ -2388,12 +2400,13 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, DBUG_RETURN(1); } - event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET]); + event_type= (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET + ev_offset]); if (event_type == START_ENCRYPTION_EVENT) { Start_encryption_log_event *sele= (Start_encryption_log_event *) - Log_event::read_log_event(packet->ptr(), packet->length(), &info->errmsg, - info->fdev, BINLOG_CHECKSUM_ALG_OFF); + Log_event::read_log_event(packet->ptr() + ev_offset, packet->length() + - ev_offset, &info->errmsg, info->fdev, + BINLOG_CHECKSUM_ALG_OFF); if (!sele) { info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG; @@ -2407,6 +2420,18 @@ static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log, delete sele; DBUG_RETURN(1); } + /* Make it Ignorable_log_event and send it */ + (*packet)[FLAGS_OFFSET+ev_offset] |= LOG_EVENT_IGNORABLE_F; + if (initial_log_pos) + int4store((char*) packet->ptr()+LOG_POS_OFFSET+ev_offset, (ulong) 0); + /* fix the checksum due to latest changes in header */ + fix_checksum(info->current_checksum_alg, packet, ev_offset); + if (my_net_write(info->net, (uchar*) packet->ptr(), packet->length())) + { + info->errmsg= "Failed on my_net_write()"; + info->error= ER_UNKNOWN_ERROR; + DBUG_RETURN(1); + } delete sele; } else if (start_pos == BIN_LOG_HEADER_SIZE) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6e7c4e1e51a..31d05220f64 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3119,7 +3119,7 @@ bool JOIN::make_aggr_tables_info() distinct in the engine, so we do this for all queries, not only GROUP BY queries. */ - if (tables_list && !procedure) + if (tables_list && top_join_tab_count && !procedure) { /* At the moment we only support push down for queries where diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e94bafedb83..2d38af625d1 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -4648,10 +4648,7 @@ fill_schema_table_by_open(THD *thd, MEM_ROOT *mem_root, } DBUG_ASSERT(thd->lex == lex); - thd->force_read_stats= get_schema_table_idx(schema_table) == SCH_STATISTICS; result= open_tables_only_view_structure(thd, table_list, can_deadlock); - (void) read_statistics_for_tables_if_needed(thd, table_list); - thd->force_read_stats= false; DEBUG_SYNC(thd, "after_open_table_ignore_flush"); @@ -6639,6 +6636,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables, KEY *key_info=show_table->s->key_info; if (show_table->file) { + (void) read_statistics_for_tables(thd, tables); show_table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_CONST | diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index aa95002bed3..abf6a8a3cad 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -2182,54 +2182,6 @@ int alloc_statistics_for_table(THD* thd, TABLE *table) /** - @brief - Check whether any persistent statistics for the processed command is needed - - @param - thd The thread handle - - @details - The function checks whether any persitent statistics for the processed - command is needed to be read. - - @retval - TRUE statistics is needed to be read - @retval - FALSE Otherwise -*/ - -static -inline bool statistics_for_command_is_needed(THD *thd) -{ - if (thd->bootstrap || thd->variables.use_stat_tables == NEVER) - return FALSE; - - if (thd->force_read_stats) - return TRUE; - - switch(thd->lex->sql_command) { - case SQLCOM_SELECT: - case SQLCOM_INSERT: - case SQLCOM_INSERT_SELECT: - case SQLCOM_UPDATE: - case SQLCOM_UPDATE_MULTI: - case SQLCOM_DELETE: - case SQLCOM_DELETE_MULTI: - case SQLCOM_REPLACE: - case SQLCOM_REPLACE_SELECT: - case SQLCOM_CREATE_TABLE: - case SQLCOM_SET_OPTION: - case SQLCOM_DO: - break; - default: - return FALSE; - } - - return TRUE; -} - - -/** @brief Allocate memory for the statistical data used by a table share @@ -2237,8 +2189,6 @@ inline bool statistics_for_command_is_needed(THD *thd) thd Thread handler @param table_share Table share for which the memory for statistical data is allocated - @param - is_safe TRUE <-> at any time only one thread can perform the function @note The function allocates the memory for the statistical data on a table in the @@ -2247,8 +2197,6 @@ inline bool statistics_for_command_is_needed(THD *thd) mysql.index_stats. The memory is allocated for the statistics on the table, on the tables's columns, and on the table's indexes. The memory is allocated in the table_share's mem_root. - If the parameter is_safe is TRUE then it is guaranteed that at any given time - only one thread is executed the code of the function. @retval 0 If the memory for all statistical data has been successfully allocated @@ -2267,16 +2215,10 @@ inline bool statistics_for_command_is_needed(THD *thd) Here the second and the third threads try to allocate the memory for statistical data at the same time. The precautions are taken to guarantee the correctness of the allocation. - - @note - Currently the function always is called with the parameter is_safe set - to FALSE. */ -int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *table_share, - bool is_safe) +static int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *table_share) { - Field **field_ptr; KEY *key_info, *end; TABLE_STATISTICS_CB *stats_cb= &table_share->stats_cb; @@ -2286,16 +2228,11 @@ int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *table_share, DEBUG_SYNC(thd, "statistics_mem_alloc_start1"); DEBUG_SYNC(thd, "statistics_mem_alloc_start2"); - if (!statistics_for_command_is_needed(thd)) - DBUG_RETURN(1); - - if (!is_safe) - mysql_mutex_lock(&table_share->LOCK_share); + mysql_mutex_lock(&table_share->LOCK_share); if (stats_cb->stats_can_be_read) { - if (!is_safe) - mysql_mutex_unlock(&table_share->LOCK_share); + mysql_mutex_unlock(&table_share->LOCK_share); DBUG_RETURN(0); } @@ -2306,8 +2243,7 @@ int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *table_share, sizeof(Table_statistics)); if (!table_stats) { - if (!is_safe) - mysql_mutex_unlock(&table_share->LOCK_share); + mysql_mutex_unlock(&table_share->LOCK_share); DBUG_RETURN(1); } memset(table_stats, 0, sizeof(Table_statistics)); @@ -2379,8 +2315,7 @@ int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *table_share, if (column_stats && index_stats && idx_avg_frequency) stats_cb->stats_can_be_read= TRUE; - if (!is_safe) - mysql_mutex_unlock(&table_share->LOCK_share); + mysql_mutex_unlock(&table_share->LOCK_share); DBUG_RETURN(0); } @@ -3200,9 +3135,6 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables) { if (!tables) return FALSE; - - if (!statistics_for_command_is_needed(thd)) - return FALSE; /* Do not read statistics for any query that explicity involves @@ -3335,9 +3267,64 @@ int read_histograms_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables) int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables) { + switch (thd->lex->sql_command) { + case SQLCOM_SELECT: + case SQLCOM_INSERT: + case SQLCOM_INSERT_SELECT: + case SQLCOM_UPDATE: + case SQLCOM_UPDATE_MULTI: + case SQLCOM_DELETE: + case SQLCOM_DELETE_MULTI: + case SQLCOM_REPLACE: + case SQLCOM_REPLACE_SELECT: + case SQLCOM_CREATE_TABLE: + case SQLCOM_SET_OPTION: + case SQLCOM_DO: + return read_statistics_for_tables(thd, tables); + default: + return 0; + } +} + + +int read_statistics_for_tables(THD *thd, TABLE_LIST *tables) +{ TABLE_LIST stat_tables[STATISTICS_TABLES]; Open_tables_backup open_tables_backup; - DBUG_ENTER("read_statistics_for_tables_if_needed"); + + DBUG_ENTER("read_statistics_for_tables"); + + if (thd->bootstrap || thd->variables.use_stat_tables == NEVER) + DBUG_RETURN(0); + + for (TABLE_LIST *tl= tables; tl; tl= tl->next_global) + { + if (tl->table) + { + TABLE_SHARE *table_share= tl->table->s; + if (table_share && table_share->table_category == TABLE_CATEGORY_USER && + table_share->tmp_table == NO_TMP_TABLE) + { + if (table_share->stats_cb.stats_can_be_read || + !alloc_statistics_for_table_share(thd, table_share)) + { + if (table_share->stats_cb.stats_can_be_read) + { + KEY *key_info= table_share->key_info; + KEY *key_info_end= key_info + table_share->keys; + KEY *table_key_info= tl->table->key_info; + for ( ; key_info < key_info_end; key_info++, table_key_info++) + table_key_info->read_stats= key_info->read_stats; + Field **field_ptr= table_share->field; + Field **table_field_ptr= tl->table->field; + for ( ; *field_ptr; field_ptr++, table_field_ptr++) + (*table_field_ptr)->read_stats= (*field_ptr)->read_stats; + tl->table->stats_is_read= table_share->stats_cb.stats_is_read; + } + } + } + } + } DEBUG_SYNC(thd, "statistics_read_start"); diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h index c0734c0f6ba..5fc9d7b5c75 100644 --- a/sql/sql_statistics.h +++ b/sql/sql_statistics.h @@ -116,9 +116,8 @@ bool check_eits_preferred(THD *thd) } int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables); +int read_statistics_for_tables(THD *thd, TABLE_LIST *tables); int collect_statistics_for_table(THD *thd, TABLE *table); -int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *share, - bool is_safe); void delete_stat_values_for_table_share(TABLE_SHARE *table_share); int alloc_statistics_for_table(THD *thd, TABLE *table); int update_statistics_for_table(THD *thd, TABLE *table); diff --git a/storage/connect/inihandl.cpp b/storage/connect/inihandl.cpp index 8e79aeac7ef..dacab3c485c 100644 --- a/storage/connect/inihandl.cpp +++ b/storage/connect/inihandl.cpp @@ -194,7 +194,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section ) } for (key = section->key; key; key = key->next) - if (key->name && key->name[0]) { + if (key->name[0]) { fprintf(file, "%s", SVP(key->name)); if (key->value) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index d6eff63b360..0c563954703 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -3355,25 +3355,22 @@ btr_parse_set_min_rec_mark( return(ptr + 2); } -/****************************************************************//** -Sets a record as the predefined minimum record. */ -void -btr_set_min_rec_mark( -/*=================*/ - rec_t* rec, /*!< in: record */ - mtr_t* mtr) /*!< in: mtr */ +/** Sets a record as the predefined minimum record. */ +void btr_set_min_rec_mark(rec_t* rec, mtr_t* mtr) { - ulint info_bits; + const bool comp = page_rec_is_comp(rec); - if (page_rec_is_comp(rec)) { - info_bits = rec_get_info_bits(rec, TRUE); + ut_ad(rec == page_rec_get_next_const(page_get_infimum_rec( + page_align(rec)))); + ut_ad(!(rec_get_info_bits(page_rec_get_next(rec), comp) + & REC_INFO_MIN_REC_FLAG)); + size_t info_bits = rec_get_info_bits(rec, comp); + if (comp) { rec_set_info_bits_new(rec, info_bits | REC_INFO_MIN_REC_FLAG); btr_set_min_rec_mark_log(rec, MLOG_COMP_REC_MIN_MARK, mtr); } else { - info_bits = rec_get_info_bits(rec, FALSE); - rec_set_info_bits_old(rec, info_bits | REC_INFO_MIN_REC_FLAG); btr_set_min_rec_mark_log(rec, MLOG_REC_MIN_MARK, mtr); diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 2731211db72..9d734e4a237 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -5911,6 +5911,9 @@ btr_cur_pessimistic_delete( #endif /* UNIV_ZIP_DEBUG */ } + rec_t* next_rec = NULL; + bool min_mark_next_rec = false; + if (page_is_leaf(page)) { const bool is_metadata = rec_is_metadata( rec, page_rec_is_comp(rec)); @@ -5988,20 +5991,14 @@ discard_page: goto return_after_reservations; } - rec_t* next_rec = page_rec_get_next(rec); + next_rec = page_rec_get_next(rec); if (!page_has_prev(page)) { - /* If we delete the leftmost node pointer on a non-leaf level, we must mark the new leftmost node pointer as the predefined minimum record */ - /* This will make page_zip_validate() fail until - page_cur_delete_rec() completes. This is harmless, - because everything will take place within a single - mini-transaction and because writing to the redo log - is an atomic operation (performed by mtr_commit()). */ - btr_set_min_rec_mark(next_rec, mtr); + min_mark_next_rec = true; } else if (dict_index_is_spatial(index)) { /* For rtree, if delete the leftmost node pointer, we need to update parent page. */ @@ -6069,6 +6066,11 @@ discard_page: block->zip_size(), mtr); page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, offsets, mtr); + + if (min_mark_next_rec) { + btr_set_min_rec_mark(next_rec, mtr); + } + #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index aa681e67201..fa6a33662ad 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -592,12 +592,6 @@ decrypt_failed: << " in file " << space->chain.start->name << " looks corrupted; key_version=" << key_version; - /* Mark page encrypted in case it should be. */ - if (space->crypt_data->type - != CRYPT_SCHEME_UNENCRYPTED) { - bpage->encrypted = true; - } - return false; } @@ -608,8 +602,7 @@ decrypt_failed: ut_d(fil_page_type_validate(space, dst_frame)); /* decrypt using crypt_buf to dst_frame */ - if (!fil_space_decrypt(space, slot->crypt_buf, - dst_frame, &bpage->encrypted)) { + if (!fil_space_decrypt(space, slot->crypt_buf, dst_frame)) { slot->release(); goto decrypt_failed; } @@ -1579,7 +1572,6 @@ buf_block_init( block->page.buf_fix_count = 0; block->page.io_fix = BUF_IO_NONE; block->page.flush_observer = NULL; - block->page.encrypted = false; block->page.real_size = 0; block->page.write_size = 0; block->modify_clock = 0; @@ -4056,7 +4048,6 @@ err_exit: if (encrypted) { ib::info() << "Row compressed page could be encrypted" " with key_version " << key_version; - block->page.encrypted = true; } if (space) { @@ -5264,7 +5255,6 @@ buf_page_init_low( bpage->newest_modification = 0; bpage->oldest_modification = 0; bpage->write_size = 0; - bpage->encrypted = false; bpage->real_size = 0; bpage->slot = NULL; @@ -5853,17 +5843,19 @@ buf_page_monitor( } /** Mark a table corrupted. -Also remove the bpage from LRU list. -@param[in] bpage Corrupted page. */ -static void buf_mark_space_corrupt(buf_page_t* bpage, const fil_space_t* space) +@param[in] bpage corrupted page +@param[in] space tablespace of the corrupted page */ +ATTRIBUTE_COLD +static void buf_mark_space_corrupt(buf_page_t* bpage, const fil_space_t& space) { /* If block is not encrypted find the table with specified space id, and mark it corrupted. Encrypted tables are marked unusable later e.g. in ::open(). */ - if (!bpage->encrypted) { - dict_set_corrupted_by_space(space); + if (!space.crypt_data + || space.crypt_data->type == CRYPT_SCHEME_UNENCRYPTED) { + dict_set_corrupted_by_space(&space); } else { - dict_set_encrypted_by_space(space); + dict_set_encrypted_by_space(&space); } } @@ -5902,7 +5894,7 @@ buf_corrupt_page_release(buf_page_t* bpage, const fil_space_t* space) mutex_exit(buf_page_get_mutex(bpage)); if (!srv_force_recovery) { - buf_mark_space_corrupt(bpage, space); + buf_mark_space_corrupt(bpage, *space); } /* After this point bpage can't be referenced. */ @@ -5955,7 +5947,6 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space) byte* dst_frame = (bpage->zip.data) ? bpage->zip.data : ((buf_block_t*) bpage)->frame; dberr_t err = DB_SUCCESS; - bool corrupted = false; uint key_version = buf_page_get_key_version(dst_frame, space->flags); /* In buf_decrypt_after_read we have either decrypted the page if @@ -5964,43 +5955,28 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space) not decrypted and it could be either encrypted and corrupted or corrupted or good page. If we decrypted, there page could still be corrupted if used key does not match. */ - const bool still_encrypted = (!space->full_crc32() && key_version) + const bool seems_encrypted = (!space->full_crc32() && key_version) && space->crypt_data - && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED - && !bpage->encrypted - && fil_space_verify_crypt_checksum(dst_frame, - bpage->zip_size()); + && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED; ut_ad(space->purpose != FIL_TYPE_TEMPORARY || space->full_crc32()); - if (!still_encrypted) { - /* If traditional checksums match, we assume that page is - not anymore encrypted. */ - if (space->full_crc32() - && !buf_page_is_zeroes(dst_frame, space->physical_size()) - && (key_version || space->is_compressed() - || space->purpose == FIL_TYPE_TEMPORARY)) { - corrupted = buf_page_full_crc32_is_corrupted( - space->id, dst_frame, - space->is_compressed()); - } else { - corrupted = buf_page_is_corrupted( - true, dst_frame, space->flags); - } - - if (!corrupted) { - bpage->encrypted = false; - } else { + /* If traditional checksums match, we assume that page is + not anymore encrypted. */ + if (space->full_crc32() + && !buf_page_is_zeroes(dst_frame, space->physical_size()) + && (key_version || space->is_compressed() + || space->purpose == FIL_TYPE_TEMPORARY)) { + if (buf_page_full_crc32_is_corrupted( + space->id, dst_frame, space->is_compressed())) { err = DB_PAGE_CORRUPTED; } + + } else if (buf_page_is_corrupted(true, dst_frame, space->flags)) { + err = DB_PAGE_CORRUPTED; } - /* Pages that we think are unencrypted but do not match the checksum - checks could be corrupted or encrypted or both. */ - if (corrupted && !bpage->encrypted) { - /* An error will be reported by - buf_page_io_complete(). */ - } else if (still_encrypted || (bpage->encrypted && corrupted)) { - bpage->encrypted = true; + if (seems_encrypted && err == DB_PAGE_CORRUPTED + && bpage->id.page_no() != 0) { err = DB_DECRYPTION_FAILED; ib::error() @@ -6061,7 +6037,6 @@ buf_page_io_complete(buf_page_t* bpage, bool dblwr, bool evict) if (io_type == BUF_IO_READ) { ulint read_page_no = 0; ulint read_space_id = 0; - uint key_version = 0; byte* frame = bpage->zip.data ? bpage->zip.data : reinterpret_cast<buf_block_t*>(bpage)->frame; @@ -6101,7 +6076,6 @@ buf_page_io_complete(buf_page_t* bpage, bool dblwr, bool evict) read_page_no = mach_read_from_4(frame + FIL_PAGE_OFFSET); read_space_id = mach_read_from_4( frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); - key_version = buf_page_get_key_version(frame, space->flags); if (bpage->id.space() == TRX_SYS_SPACE && buf_dblwr_page_inside(bpage->id.page_no())) { @@ -6213,24 +6187,9 @@ database_corrupted: || !is_predefined_tablespace(bpage->id.space())) && fil_page_get_type(frame) == FIL_PAGE_INDEX && page_is_leaf(frame)) { - - if (bpage->encrypted) { - ib::warn() - << "Table in tablespace " - << bpage->id.space() - << " encrypted. However key " - "management plugin or used " - << "key_version " << key_version - << " is not found or" - " used encryption algorithm or method does not match." - " Can't continue opening the table."; - } else { - - ibuf_merge_or_delete_for_page( - (buf_block_t*) bpage, bpage->id, - bpage->zip_size(), true); - } - + ibuf_merge_or_delete_for_page( + reinterpret_cast<buf_block_t*>(bpage), + bpage->id, bpage->zip_size(), true); } space->release_for_io(); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 65febb14a76..d215f92f80f 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -835,7 +835,7 @@ buf_flush_init_for_writing( if (use_full_checksum) { mach_write_to_4(page + srv_page_size - FIL_PAGE_FCRC32_END_LSN, - (ulint) newest_lsn); + static_cast<uint32_t>(newest_lsn)); } else { mach_write_to_8(page + srv_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM, newest_lsn); diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 38d1b9778a5..d81e16b63c1 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1014,7 +1014,6 @@ Decrypt a page. @param[in] space Tablespace @param[in] tmp_frame Temporary buffer used for decrypting @param[in,out] src_frame Page to decrypt -@param[out] decrypted true if page was decrypted @return decrypted page, or original not encrypted page if decryption is not needed.*/ UNIV_INTERN @@ -1022,13 +1021,11 @@ byte* fil_space_decrypt( const fil_space_t* space, byte* tmp_frame, - byte* src_frame, - bool* decrypted) + byte* src_frame) { dberr_t err = DB_SUCCESS; byte* res = NULL; const ulint physical_size = space->physical_size(); - *decrypted = false; ut_ad(space->crypt_data != NULL && space->crypt_data->is_encrypted()); ut_ad(space->pending_io()); @@ -1040,7 +1037,6 @@ fil_space_decrypt( if (err == DB_SUCCESS) { if (encrypted) { - *decrypted = true; /* Copy the decrypted page back to page buffer, not really any other options. */ memcpy(src_frame, tmp_frame, physical_size); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 138a420040d..13d606bcc34 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -5835,7 +5835,6 @@ add_all_virtual: buf_block_t* root = btr_root_block_get(index, RW_X_LATCH, &mtr); DBUG_ASSERT(root); - DBUG_ASSERT(!root->page.encrypted); if (fil_page_get_type(root->frame) != FIL_PAGE_TYPE_INSTANT) { DBUG_ASSERT(!"wrong page type"); err = DB_CORRUPTION; @@ -5925,8 +5924,7 @@ empty_table: mtr.start(); index->set_modified(mtr); if (buf_block_t* root = btr_root_block_get(index, RW_SX_LATCH, &mtr)) { - if (root->page.encrypted - || fil_page_get_type(root->frame) != FIL_PAGE_INDEX) { + if (fil_page_get_type(root->frame) != FIL_PAGE_INDEX) { DBUG_ASSERT(!"wrong page type"); goto err_exit; } diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index c21a26a898d..09050f0c197 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -336,9 +336,8 @@ ibuf_header_page_get( page_id_t(IBUF_SPACE_ID, FSP_IBUF_HEADER_PAGE_NO), 0, RW_X_LATCH, mtr); - if (!block->page.encrypted) { + if (block) { buf_block_dbg_add_level(block, SYNC_IBUF_HEADER); - page = buf_block_get_frame(block); } diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 1ec2eee9a77..e0fa2e734f8 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -515,14 +515,10 @@ btr_insert_on_non_leaf_level_func( mtr_t* mtr); /*!< in: mtr */ #define btr_insert_on_non_leaf_level(f,i,l,t,m) \ btr_insert_on_non_leaf_level_func(f,i,l,t,__FILE__,__LINE__,m) -/****************************************************************//** -Sets a record as the predefined minimum record. */ -void -btr_set_min_rec_mark( -/*=================*/ - rec_t* rec, /*!< in/out: record */ - mtr_t* mtr) /*!< in: mtr */ - MY_ATTRIBUTE((nonnull)); + +/** Sets a record as the predefined minimum record. */ +void btr_set_min_rec_mark(rec_t* rec, mtr_t* mtr) MY_ATTRIBUTE((nonnull)); + /** Seek to the parent page of a B-tree page. @param[in,out] index b-tree @param[in] block child page diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 647cc3d4274..93a27028ec4 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1491,8 +1491,6 @@ public: if written again we check is TRIM operation needed. */ - bool encrypted; /*!< page is still encrypted */ - ulint real_size; /*!< Real size of the page Normal pages == srv_page_size page compressed pages, payload diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h index 23d14797510..e022dd55215 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -174,16 +174,6 @@ void buf_flush_wait_flushed( lsn_t new_oldest); -/******************************************************************//** -Waits until a flush batch of the given type ends. This is called by -a thread that only wants to wait for a flush to end but doesn't do -any flushing itself. */ -void -buf_flush_wait_batch_end_wait_only( -/*===============================*/ - buf_pool_t* buf_pool, /*!< in: buffer pool instance */ - buf_flush_t type); /*!< in: BUF_FLUSH_LRU - or BUF_FLUSH_LIST */ /********************************************************************//** This function should be called at a mini-transaction commit, if a page was modified in it. Puts the block to the list of modified blocks, if it not diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h index 79924edceb4..fd0d3e12601 100644 --- a/storage/innobase/include/fil0crypt.h +++ b/storage/innobase/include/fil0crypt.h @@ -376,7 +376,6 @@ Decrypt a page @param[in] space Tablespace @param[in] tmp_frame Temporary buffer used for decrypting @param[in,out] src_frame Page to decrypt -@param[out] decrypted true if page was decrypted @return decrypted page, or original not encrypted page if decryption is not needed.*/ UNIV_INTERN @@ -384,8 +383,7 @@ byte* fil_space_decrypt( const fil_space_t* space, byte* tmp_frame, - byte* src_frame, - bool* decrypted) + byte* src_frame) MY_ATTRIBUTE((warn_unused_result)); /** diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index a6dd19cc147..0fc397cd288 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -1292,15 +1292,12 @@ ibool page_simple_validate_new( /*=====================*/ const page_t* page); /*!< in: index page in ROW_FORMAT!=REDUNDANT */ -/***************************************************************//** -This function checks the consistency of an index page. -@return TRUE if ok */ -ibool -page_validate( -/*==========*/ - const page_t* page, /*!< in: index page */ - dict_index_t* index); /*!< in: data dictionary index containing - the page record type definition */ +/** Check the consistency of an index page. +@param[in] page index page +@param[in] index B-tree or R-tree index +@return whether the page is valid */ +bool page_validate(const page_t* page, const dict_index_t* index) + MY_ATTRIBUTE((nonnull)); /***************************************************************//** Looks in the page record list for a record with the given heap number. @return record, NULL if not found */ diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index 5ab50b7bb8e..3507ea8830c 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -651,6 +651,10 @@ page_rec_get_next_low( return(NULL); } + ut_ad(page_rec_is_infimum(rec) + || !(rec_get_info_bits(page + offs, comp) + & REC_INFO_MIN_REC_FLAG)); + return(page + offs); } diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 31380f09d0f..644a9484af4 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -93,7 +93,6 @@ support cross-platform development and expose comonly used SQL names. */ #include <sys/stat.h> #ifndef _WIN32 -# include <sys/mman.h> /* mmap() for os0proc.cc */ # include <sched.h> # include "my_config.h" #endif diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h index 6732a12ecf1..a190b872549 100644 --- a/storage/innobase/include/ut0new.h +++ b/storage/innobase/include/ut0new.h @@ -129,9 +129,6 @@ InnoDB: #include <string.h> /* strlen(), strrchr(), strncmp() */ #include "my_global.h" /* needed for headers from mysql/psi/ */ -#if !defined(DBUG_OFF) && defined(HAVE_MADVISE) -#include <sys/mman.h> -#endif /* JAN: TODO: missing 5.7 header */ #ifdef HAVE_MYSQL_MEMORY_H @@ -252,7 +249,7 @@ static inline void ut_allocate_trace_dontdump(void *ptr, size_t bytes, #if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DONTDUMP) if (dontdump && madvise(ptr, bytes, MADV_DONTDUMP)) { - ib::warn() << "Failed to set memory to DONTDUMP: " + ib::warn() << "Failed to set memory to " DONTDUMP_STR ": " << strerror(errno) << " ptr " << ptr << " size " << bytes; @@ -270,7 +267,7 @@ static inline void ut_allocate_trace_dontdump(void *ptr, size_t bytes, static inline void ut_dodump(void* ptr, size_t m_size) { if (ptr && madvise(ptr, m_size, MADV_DODUMP)) { - ib::warn() << "Failed to set memory to DODUMP: " + ib::warn() << "Failed to set memory to " DODUMP_STR ": " << strerror(errno) << " ptr " << ptr << " size " << m_size; diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index c2bdaee8c13..f777e7b8378 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -2420,10 +2420,6 @@ page_cur_delete_rec( if (cur_n_owned <= PAGE_DIR_SLOT_MIN_N_OWNED) { page_dir_balance_slot(page, page_zip, cur_slot_no); } - -#ifdef UNIV_ZIP_DEBUG - ut_a(!page_zip || page_zip_validate(page_zip, page, index)); -#endif /* UNIV_ZIP_DEBUG */ } #ifdef UNIV_COMPILE_TEST_FUNCS diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index fa73b86f03f..a40372a2ed9 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -2353,19 +2353,16 @@ func_exit: return(ret); } -/***************************************************************//** -This function checks the consistency of an index page. -@return TRUE if ok */ -ibool -page_validate( -/*==========*/ - const page_t* page, /*!< in: index page */ - dict_index_t* index) /*!< in: data dictionary index containing - the page record type definition */ +/** Check the consistency of an index page. +@param[in] page index page +@param[in] index B-tree or R-tree index +@return whether the page is valid */ +bool page_validate(const page_t* page, const dict_index_t* index) { const page_dir_slot_t* slot; const rec_t* rec; const rec_t* old_rec = NULL; + const rec_t* first_rec = NULL; ulint offs; ulint n_slots; ibool ret = TRUE; @@ -2489,6 +2486,41 @@ wrong_page_type: goto next_rec; } + if (rec == first_rec) { + if ((rec_get_info_bits(rec, page_is_comp(page)) + & REC_INFO_MIN_REC_FLAG)) { + if (page_has_prev(page)) { + ib::error() << "REC_INFO_MIN_REC_FLAG " + "is set in on non-left page"; + ret = false; + } else if (!page_is_leaf(page)) { + /* leftmost node pointer page */ + } else if (!index->is_instant()) { + ib::error() << "REC_INFO_MIN_REC_FLAG " + "is set in a leaf-page record"; + ret = false; + } else if (!rec_get_deleted_flag( + rec, page_is_comp(page)) + != !index->table->instant) { + ib::error() << (index->table->instant + ? "Metadata record " + "is not delete-marked" + : "Metadata record " + "is delete-marked"); + ret = false; + } + } else if (!page_has_prev(page) + && index->is_instant()) { + ib::error() << "Metadata record is missing"; + ret = false; + } + } else if (rec_get_info_bits(rec, page_is_comp(page)) + & REC_INFO_MIN_REC_FLAG) { + ib::error() << "REC_INFO_MIN_REC_FLAG record is not " + "first in page"; + ret = false; + } + /* Check that the records are in the ascending order */ if (count >= PAGE_HEAP_NO_USER_LOW && !page_rec_is_supremum(rec)) { @@ -2595,6 +2627,11 @@ next_rec: old_rec = rec; rec = page_rec_get_next_const(rec); + if (page_rec_is_infimum(old_rec) + && page_rec_is_user_rec(rec)) { + first_rec = rec; + } + /* set old_offsets to offsets; recycle offsets */ { ulint* offs = old_offsets; diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 243f44ad118..d0318b51f4a 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -4315,10 +4315,6 @@ page_zip_clear_rec( } else { ut_ad(!rec_offs_any_extern(offsets)); } - -#ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page, index)); -#endif /* UNIV_ZIP_DEBUG */ } /**********************************************************************//** diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 148d223a364..a45d9f59caf 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -2022,29 +2022,13 @@ dberr_t PageConverter::operator()(buf_block_t* block) UNIV_NOTHROW ulint page_type; - dberr_t err = update_page(block, page_type); - if (err != DB_SUCCESS) return err; + if (dberr_t err = update_page(block, page_type)) { + return err; + } const bool full_crc32 = fil_space_t::full_crc32(get_space_flags()); - const bool page_compressed = fil_space_t::is_compressed(get_space_flags()); if (!block->page.zip.data) { - if (full_crc32 - && (block->page.encrypted || page_compressed) - && block->page.id.page_no() > 0) { - byte* page = block->frame; - mach_write_to_8(page + FIL_PAGE_LSN, m_current_lsn); - - if (!page_compressed) { - mach_write_to_4( - page + (srv_page_size - - FIL_PAGE_FCRC32_END_LSN), - (ulint) m_current_lsn); - } - - return err; - } - buf_flush_init_for_writing( NULL, block->frame, NULL, m_current_lsn, full_crc32); } else if (fil_page_type_is_index(page_type)) { @@ -3484,10 +3468,6 @@ not_encrypted: goto page_corrupted; } - if (encrypted) { - block->page.encrypted = true; - } - if ((err = callback(block)) != DB_SUCCESS) { goto func_exit; } else if (!updated) { diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 2431afcd1e9..e89f306b8cf 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -52,9 +52,6 @@ #ifdef HAVE_SYS_VADVISE_H #include <sys/vadvise.h> #endif -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif /* Functions defined in this file */ diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c index 12cb8f838ef..b464cf4f94e 100644 --- a/storage/maria/ma_extra.c +++ b/storage/maria/ma_extra.c @@ -14,9 +14,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ #include "maria_def.h" -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif #include "ma_blockrec.h" static void maria_extra_keyflag(MARIA_HA *info, diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c index e2c1e353616..2e7add8f61d 100644 --- a/storage/maria/ma_packrec.c +++ b/storage/maria/ma_packrec.c @@ -1528,9 +1528,6 @@ static uint max_bit(register uint value) /***************************************************************************** Some redefined functions to handle files when we are using memmap *****************************************************************************/ -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif #ifdef HAVE_MMAP diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index 54f7c21539b..2f130de1c7a 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -23,9 +23,6 @@ #include <my_getopt.h> #include <my_check_opt.h> #include <my_handler_errors.h> -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif static uint decode_bits; static char **default_argv; diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 22eb97b24f3..f377028be52 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -46,9 +46,6 @@ #ifdef HAVE_SYS_VADVISE_H #include <sys/vadvise.h> #endif -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif #include "rt_index.h" #include <mysqld_error.h> diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index 6c7144a949d..d1bf903bd46 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -15,9 +15,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ #include "myisamdef.h" -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif static void mi_extra_keyflag(MI_INFO *info, enum ha_extra_function function); diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index 72ce17b6a78..b28eaf21090 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -1479,9 +1479,6 @@ static uint max_bit(register uint value) /***************************************************************************** Some redefined functions to handle files when we are using memmap *****************************************************************************/ -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif #ifdef HAVE_MMAP diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index a3021ed72a7..f616a9f9b1a 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -21,9 +21,6 @@ #include <stdarg.h> #include <my_getopt.h> #include <my_bit.h> -#ifdef HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif static uint decode_bits; static char **default_argv; diff --git a/storage/sequence/mysql-test/sequence/group_by.result b/storage/sequence/mysql-test/sequence/group_by.result index 2941e85c1f4..7902fe6a348 100644 --- a/storage/sequence/mysql-test/sequence/group_by.result +++ b/storage/sequence/mysql-test/sequence/group_by.result @@ -97,3 +97,9 @@ count(NULL) select count(NULL) from seq_1_to_3; count(NULL) 0 +# +# MDEV-20753: Sequence with limit 0 crashes server +# +select count(NULL) from seq_1_to_3 limit 0; +count(NULL) +# End of 10.3 tests diff --git a/storage/sequence/mysql-test/sequence/group_by.test b/storage/sequence/mysql-test/sequence/group_by.test index b3f4ab58771..18e44cd2ab1 100644 --- a/storage/sequence/mysql-test/sequence/group_by.test +++ b/storage/sequence/mysql-test/sequence/group_by.test @@ -49,3 +49,10 @@ explain select count(*) from seq_1_to_15_step_2 group by mod(seq,2); create temporary table t1 select * from seq_1_to_3; select count(NULL) from t1; select count(NULL) from seq_1_to_3; + +--echo # +--echo # MDEV-20753: Sequence with limit 0 crashes server +--echo # +select count(NULL) from seq_1_to_3 limit 0; + +--echo # End of 10.3 tests diff --git a/storage/spider/mysql-test/spider/bugfix/include/select_by_null_deinit.inc b/storage/spider/mysql-test/spider/bugfix/include/select_by_null_deinit.inc new file mode 100644 index 00000000000..76b7582abfe --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/select_by_null_deinit.inc @@ -0,0 +1,11 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/bugfix/include/select_by_null_init.inc b/storage/spider/mysql-test/spider/bugfix/include/select_by_null_init.inc new file mode 100644 index 00000000000..d07ba2a9fee --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/include/select_by_null_init.inc @@ -0,0 +1,24 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='table "tbl_a", srv "s_2_1"'; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT pkey FROM tbl_a ORDER BY pkey; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; diff --git a/storage/spider/mysql-test/spider/bugfix/r/select_by_null.result b/storage/spider/mysql-test/spider/bugfix/r/select_by_null.result new file mode 100644 index 00000000000..a7fa1b3b91f --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/select_by_null.result @@ -0,0 +1,90 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +this test is for MDEV-16279 + +drop and create databases +connection master_1; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table and insert +connection child2_1; +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); +FLUSH TABLES; + +select test 1 +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT pkey FROM tbl_a WHERE NULL; +pkey +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT pkey FROM tbl_a ORDER BY pkey; +pkey +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 + +end of test diff --git a/storage/spider/mysql-test/spider/bugfix/t/select_by_null.cnf b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.cnf new file mode 100644 index 00000000000..05dfd8a0bce --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.cnf @@ -0,0 +1,3 @@ +!include include/default_mysqld.cnf +!include ../my_1_1.cnf +!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test new file mode 100644 index 00000000000..1f540b2a15f --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test @@ -0,0 +1,72 @@ +--source ../include/select_by_null_init.inc +--echo +--echo this test is for MDEV-16279 +--echo +--echo drop and create databases + +--connection master_1 +--disable_warnings +CREATE DATABASE auto_test_local; +USE auto_test_local; + +--connection child2_1 +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; +--enable_warnings + +--echo +--echo create table and insert + +--connection child2_1 +--disable_query_log +echo CHILD2_1_CREATE_TABLES; +eval $CHILD2_1_CREATE_TABLES; +--enable_query_log +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +--disable_query_log +echo CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + pkey int NOT NULL, + PRIMARY KEY (pkey) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); +INSERT INTO tbl_a (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29); +FLUSH TABLES; + +--echo +--echo select test 1 + +--connection child2_1 +TRUNCATE TABLE mysql.general_log; + +--connection master_1 +SELECT pkey FROM tbl_a WHERE NULL; + +--connection child2_1 +eval $CHILD2_1_SELECT_ARGUMENT1; +eval $CHILD2_1_SELECT_TABLES; + +--echo +--echo deinit +--disable_warnings + +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; + +--connection child2_1 +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; + +--enable_warnings +--source ../include/select_by_null_deinit.inc +--echo +--echo end of test |