From d3976cf72a41ddd660167473d3a86def881f88b6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 20 Sep 2017 15:59:40 +0200 Subject: [PATCH 01/23] remove an empty file with a wrong name --- cmake/CMakeLis.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 cmake/CMakeLis.txt diff --git a/cmake/CMakeLis.txt b/cmake/CMakeLis.txt deleted file mode 100644 index e69de29bb2d1d..0000000000000 From 8f3fd98d25da483efd2ce8eb2300d842b4f5e21f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 20 Sep 2017 17:07:05 +0200 Subject: [PATCH 02/23] connect fixes after-merge disable Mongo in 10.0, compiler warnings. --- storage/connect/CMakeLists.txt | 2 +- storage/connect/preparse.h | 2 +- storage/connect/tabmysql.h | 2 +- storage/connect/tabutil.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index f0f34c8eefc9a..1f687c3c8d886 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -247,7 +247,7 @@ ENDIF(CONNECT_WITH_ODBC) # # JDBC with MongoDB Java Driver included but disabled # -OPTION(CONNECT_WITH_MONGO "Compile CONNECT storage engine with MONGO support" ON) +#OPTION(CONNECT_WITH_MONGO "Compile CONNECT storage engine with MONGO support" ON) OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON) IF(CONNECT_WITH_JDBC) diff --git a/storage/connect/preparse.h b/storage/connect/preparse.h index f16624548fb74..3db7a2af1cd70 100644 --- a/storage/connect/preparse.h +++ b/storage/connect/preparse.h @@ -8,7 +8,7 @@ /***********************************************************************/ typedef struct _datpar { const char *Format; // Points to format to decode - char *Curp; // Points to current parsing position + const char *Curp; // Points to current parsing position char *InFmt; // Start of input format char *OutFmt; // Start of output format int Index[8]; // Indexes of date values diff --git a/storage/connect/tabmysql.h b/storage/connect/tabmysql.h index 39fba87bcc96f..4b61c7eb762ee 100644 --- a/storage/connect/tabmysql.h +++ b/storage/connect/tabmysql.h @@ -135,7 +135,7 @@ class TDBMYSQL : public TDBEXT { int m_Rc; // Return code from command //int AftRows; // The number of affected rows int N; // The current table index - int Port; // MySQL port number (0 = default) + unsigned Port; // MySQL port number (0 = default) //int Nparm; // The number of statement parameters //int Quoted; // The identifier quoting level }; // end of class TDBMYSQL diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp index a2c04e2cf6254..af77c87ef8d23 100644 --- a/storage/connect/tabutil.cpp +++ b/storage/connect/tabutil.cpp @@ -120,7 +120,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, FLD_REM, FLD_NO, FLD_CHARSET}; unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 0, 32, 32}; PCSZ fmt; - char *pn, *tn, *fld, *colname, *chset, v; + char *pn, *tn, *fld, *colname, v; //, *chset; int i, n, ncol = sizeof(buftyp) / sizeof(int); int prec, len, type, scale; int zconv = GetConvSize(); @@ -185,7 +185,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, colname = (char *)fp->field_name; crp->Kdata->SetValue(colname, i); - chset = (char *)fp->charset()->name; +// chset = (char *)fp->charset()->name; // v = (!strcmp(chset, "binary")) ? 'B' : 0; v = 0; From b7434bacbdd99d9c60499415f8be10aa59234dbf Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 20 Sep 2017 17:51:43 +0200 Subject: [PATCH 03/23] include/master-slave.inc must always be included last --- mysql-test/extra/rpl_tests/rpl_loaddata.test | 2 +- mysql-test/suite/engines/funcs/t/rpl_insert.test | 2 +- mysql-test/suite/parts/t/rpl_partition.test | 2 +- mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test | 2 +- mysql-test/suite/rpl/t/rpl_alter_extra_persistent.test | 2 +- mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test | 2 +- mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test | 2 +- mysql-test/suite/rpl/t/rpl_blackhole.test | 2 +- mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test | 2 +- mysql-test/suite/rpl/t/rpl_checksum.test | 2 +- mysql-test/suite/rpl/t/rpl_concurrency_error.test | 2 +- mysql-test/suite/rpl/t/rpl_conditional_comments.test | 2 +- mysql-test/suite/rpl/t/rpl_empty_master_host.test | 2 +- mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test | 2 +- mysql-test/suite/rpl/t/rpl_flush_logs.test | 2 +- mysql-test/suite/rpl/t/rpl_geometry.test | 2 +- mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test | 2 +- mysql-test/suite/rpl/t/rpl_grant.test | 2 +- mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test | 2 +- mysql-test/suite/rpl/t/rpl_heartbeat_debug.test | 2 +- mysql-test/suite/rpl/t/rpl_incident.test | 2 +- mysql-test/suite/rpl/t/rpl_init_slave_errors.test | 2 +- mysql-test/suite/rpl/t/rpl_innodb_bug68220.test | 2 +- mysql-test/suite/rpl/t/rpl_insert.test | 2 +- mysql-test/suite/rpl/t/rpl_invoked_features.test | 2 +- mysql-test/suite/rpl/t/rpl_loaddata_symlink.test | 2 +- mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test | 2 +- mysql-test/suite/rpl/t/rpl_mdev-11092.test | 2 +- mysql-test/suite/rpl/t/rpl_mdev8193.test | 2 +- mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size.test | 2 +- mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test | 2 +- mysql-test/suite/rpl/t/rpl_mixed_mixing_engines.test | 2 +- mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test | 2 +- mysql-test/suite/rpl/t/rpl_not_null_innodb.test | 2 +- mysql-test/suite/rpl/t/rpl_not_null_myisam.test | 2 +- mysql-test/suite/rpl/t/rpl_packet.test | 2 +- mysql-test/suite/rpl/t/rpl_performance_schema.test | 2 +- mysql-test/suite/rpl/t/rpl_read_only.test | 2 +- mysql-test/suite/rpl/t/rpl_report_port.test | 2 +- mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size.test | 2 +- mysql-test/suite/rpl/t/rpl_row_colSize.test | 2 +- mysql-test/suite/rpl/t/rpl_row_corruption.test | 2 +- mysql-test/suite/rpl/t/rpl_row_create_table.test | 2 +- mysql-test/suite/rpl/t/rpl_row_find_row.test | 2 +- mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test | 2 +- mysql-test/suite/rpl/t/rpl_row_index_choice.test | 2 +- mysql-test/suite/rpl/t/rpl_row_merge_engine.test | 2 +- mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test | 2 +- mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test | 2 +- mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test | 2 +- mysql-test/suite/rpl/t/rpl_row_trunc_temp.test | 2 +- mysql-test/suite/rpl/t/rpl_row_utf16.test | 2 +- mysql-test/suite/rpl/t/rpl_row_wide_table.test | 2 +- mysql-test/suite/rpl/t/rpl_savepoint.test | 2 +- mysql-test/suite/rpl/t/rpl_server_id_ignore.test | 2 +- mysql-test/suite/rpl/t/rpl_set_null_innodb.test | 2 +- mysql-test/suite/rpl/t/rpl_skip_error.test | 2 +- mysql-test/suite/rpl/t/rpl_skip_incident.test | 2 +- mysql-test/suite/rpl/t/rpl_skip_replication.test | 2 +- mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test | 2 +- mysql-test/suite/rpl/t/rpl_slave_skip.test | 2 +- mysql-test/suite/rpl/t/rpl_slow_query_log.test | 2 +- mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size.test | 2 +- mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test | 2 +- mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test | 2 +- mysql-test/suite/rpl/t/rpl_stm_loadfile.test | 2 +- mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test | 2 +- mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test | 2 +- mysql-test/suite/rpl/t/rpl_stm_user_variables.test | 2 +- mysql-test/suite/rpl/t/rpl_sync.test | 2 +- mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test | 2 +- mysql-test/suite/rpl/t/rpl_temporary_errors.test | 2 +- mysql-test/suite/rpl/t/sec_behind_master-5114.test | 2 +- mysql-test/t/create_or_replace2.test | 2 +- mysql-test/t/stat_tables_repl.test | 2 +- 75 files changed, 75 insertions(+), 75 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test index 67eb137bdf496..d04cefd175a19 100644 --- a/mysql-test/extra/rpl_tests/rpl_loaddata.test +++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test @@ -11,8 +11,8 @@ # check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and # Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986) --- source include/master-slave.inc source include/have_innodb.inc; +source include/master-slave.inc; --disable_query_log CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/engines/funcs/t/rpl_insert.test b/mysql-test/suite/engines/funcs/t/rpl_insert.test index 763a484ea5dc6..f57a6e226d1d7 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_insert.test +++ b/mysql-test/suite/engines/funcs/t/rpl_insert.test @@ -2,9 +2,9 @@ --echo # Bug#20821: INSERT DELAYED fails to write some rows to binlog --echo # ---source include/master-slave.inc --source include/not_embedded.inc --source include/not_windows.inc +--source include/master-slave.inc --disable_warnings CREATE SCHEMA IF NOT EXISTS mysqlslap; diff --git a/mysql-test/suite/parts/t/rpl_partition.test b/mysql-test/suite/parts/t/rpl_partition.test index e278b236f7ba4..cb6f84bbc713c 100644 --- a/mysql-test/suite/parts/t/rpl_partition.test +++ b/mysql-test/suite/parts/t/rpl_partition.test @@ -1,7 +1,7 @@ --source include/have_partition.inc --source include/have_innodb.inc ---source include/master-slave.inc --source include/big_test.inc +--source include/master-slave.inc --vertical_results diff --git a/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test index 6a6c4f2a7568b..10e5e938884e2 100644 --- a/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test +++ b/mysql-test/suite/roles/rpl_grant_revoke_current_role-8638.test @@ -1,5 +1,5 @@ ---source include/master-slave.inc --source include/have_binlog_format_mixed.inc +--source include/master-slave.inc --enable_connect_log diff --git a/mysql-test/suite/rpl/t/rpl_alter_extra_persistent.test b/mysql-test/suite/rpl/t/rpl_alter_extra_persistent.test index 3b2fff1cb1350..4e604787c70ed 100644 --- a/mysql-test/suite/rpl/t/rpl_alter_extra_persistent.test +++ b/mysql-test/suite/rpl/t/rpl_alter_extra_persistent.test @@ -1,5 +1,5 @@ ---source include/master-slave.inc --source include/have_binlog_format_row.inc +--source include/master-slave.inc --enable_connect_log --connection master diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test b/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test index 6996e1c73c788..32f08be7c4d88 100644 --- a/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test +++ b/mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test @@ -5,9 +5,9 @@ # is replication unsafe. # -source include/master-slave.inc; source include/have_binlog_format_mixed.inc; source include/have_innodb.inc; +source include/master-slave.inc; call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.'); diff --git a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test index b4798691ca3ae..49fbe9af57044 100644 --- a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test +++ b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test @@ -1,6 +1,6 @@ -source include/master-slave.inc; source include/have_innodb.inc; source include/have_binlog_format_statement.inc; +source include/master-slave.inc; connection slave; call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_blackhole.test b/mysql-test/suite/rpl/t/rpl_blackhole.test index 5f9b955aaa467..76b2e2421c9c9 100644 --- a/mysql-test/suite/rpl/t/rpl_blackhole.test +++ b/mysql-test/suite/rpl/t/rpl_blackhole.test @@ -15,8 +15,8 @@ # primary key lookup), and index/key with multiple matches (forcing an # index search). -source include/master-slave.inc; source include/have_blackhole.inc; +source include/master-slave.inc; call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test index a97801f9ab0d0..88b4f8fbba578 100644 --- a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test +++ b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test @@ -12,8 +12,8 @@ # and replication is started from it. # ---source include/master-slave.inc --source include/have_binlog_format_mixed.inc +--source include/master-slave.inc --connection slave # Make sure the slave is stopped while we are messing with master. diff --git a/mysql-test/suite/rpl/t/rpl_checksum.test b/mysql-test/suite/rpl/t/rpl_checksum.test index 1cf9091033e0f..93b108cbd1941 100644 --- a/mysql-test/suite/rpl/t/rpl_checksum.test +++ b/mysql-test/suite/rpl/t/rpl_checksum.test @@ -1,9 +1,9 @@ # WL2540 replication events checksum # Testing configuration parameters ---source include/master-slave.inc --source include/have_debug.inc --source include/have_binlog_format_mixed.inc +--source include/master-slave.inc call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log'); call mtr.add_suppression('Replication event checksum verification failed'); diff --git a/mysql-test/suite/rpl/t/rpl_concurrency_error.test b/mysql-test/suite/rpl/t/rpl_concurrency_error.test index 15d5d5502a1ac..c5cebb953e42c 100644 --- a/mysql-test/suite/rpl/t/rpl_concurrency_error.test +++ b/mysql-test/suite/rpl/t/rpl_concurrency_error.test @@ -17,9 +17,9 @@ # log, the error is ignored and only the non-transactional tables are changed. ############################################################################### ---source include/master-slave.inc --source include/have_innodb.inc --source include/have_binlog_format_statement.inc +--source include/master-slave.inc call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_conditional_comments.test b/mysql-test/suite/rpl/t/rpl_conditional_comments.test index 0e2c108bf6e92..bcc964a92c7a9 100644 --- a/mysql-test/suite/rpl/t/rpl_conditional_comments.test +++ b/mysql-test/suite/rpl/t/rpl_conditional_comments.test @@ -8,8 +8,8 @@ # will be binlogged as # 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/'. ############################################################################### -source include/master-slave.inc; source include/have_binlog_format_statement.inc; +source include/master-slave.inc; CREATE TABLE t1(c1 INT); source include/show_binlog_events.inc; diff --git a/mysql-test/suite/rpl/t/rpl_empty_master_host.test b/mysql-test/suite/rpl/t/rpl_empty_master_host.test index 66d30375a5951..0fc2d11a29dcb 100644 --- a/mysql-test/suite/rpl/t/rpl_empty_master_host.test +++ b/mysql-test/suite/rpl/t/rpl_empty_master_host.test @@ -16,8 +16,8 @@ # along the way if error/no error is thrown and/or if replication starts # working when expected. ---source include/master-slave.inc --source include/have_binlog_format_mixed.inc +--source include/master-slave.inc connection slave; STOP SLAVE; diff --git a/mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test b/mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test index f48880b5dfaed..201392346be83 100644 --- a/mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test @@ -2,8 +2,8 @@ # Purpose: To test having extra columns on the master WL#3915 ############################################################# -- source include/have_binlog_format_row.inc --- source include/master-slave.inc -- source include/have_innodb.inc +-- source include/master-slave.inc let $engine_type = 'InnoDB'; --source extra/rpl_tests/rpl_extra_col_master.test diff --git a/mysql-test/suite/rpl/t/rpl_flush_logs.test b/mysql-test/suite/rpl/t/rpl_flush_logs.test index 1d19576d47c72..6dad588f217b6 100644 --- a/mysql-test/suite/rpl/t/rpl_flush_logs.test +++ b/mysql-test/suite/rpl/t/rpl_flush_logs.test @@ -4,8 +4,8 @@ # works fine. # ---source include/master-slave.inc --source include/have_binlog_format_statement.inc +--source include/master-slave.inc connection master; # Test 'flush error logs' statement. diff --git a/mysql-test/suite/rpl/t/rpl_geometry.test b/mysql-test/suite/rpl/t/rpl_geometry.test index 769c49c96b180..415732a0228d9 100644 --- a/mysql-test/suite/rpl/t/rpl_geometry.test +++ b/mysql-test/suite/rpl/t/rpl_geometry.test @@ -1,5 +1,5 @@ -source include/master-slave.inc; source include/have_binlog_format_row.inc; +source include/master-slave.inc; # # Bug#48776, Bug#43784 diff --git a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test index 17417a55b8c7b..dca32c30a9444 100644 --- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test +++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test @@ -8,9 +8,9 @@ # Finish the following tests by calling its common test script: # extra/rpl_tests/rpl_get_master_version_and_clock.test. -source include/master-slave.inc; source include/have_debug.inc; source include/have_debug_sync.inc; +source include/master-slave.inc; # # The test is not supposed to have any binglog affairs. diff --git a/mysql-test/suite/rpl/t/rpl_grant.test b/mysql-test/suite/rpl/t/rpl_grant.test index 1091e5aab0dcf..b40d400afbdc4 100644 --- a/mysql-test/suite/rpl/t/rpl_grant.test +++ b/mysql-test/suite/rpl/t/rpl_grant.test @@ -1,7 +1,7 @@ # Tests of grants and users -source include/master-slave.inc; source include/not_embedded.inc; +source include/master-slave.inc; --echo **** On Master **** connection master; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test index 43634ec1528a0..5b13a5e1fc112 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test @@ -1,6 +1,6 @@ ---source include/master-slave.inc --source include/have_innodb.inc --source include/have_debug.inc +--source include/master-slave.inc CREATE TABLE t1 (i int) ENGINE=InnoDB; diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test b/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test index 7cdf67d65323a..6a426ed1e9fa3 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_debug.test @@ -1,7 +1,7 @@ # Testing master to slave heartbeat protocol, test cases that need debug build. ---source include/master-slave.inc --source include/have_debug.inc +--source include/master-slave.inc connection slave; --source include/stop_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test index adf20953b0f10..60ffd43bf5256 100644 --- a/mysql-test/suite/rpl/t/rpl_incident.test +++ b/mysql-test/suite/rpl/t/rpl_incident.test @@ -1,5 +1,5 @@ ---source include/master-slave.inc --source include/have_debug.inc +--source include/master-slave.inc --echo **** On Master **** CREATE TABLE t1 (a INT); diff --git a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test index 067d21a4e461d..f08832e7e7299 100644 --- a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test +++ b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test @@ -29,8 +29,8 @@ # Configuring the Environment ###################################################################### source include/have_debug.inc; -source include/master-slave.inc; source include/have_log_bin.inc; +source include/master-slave.inc; connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test b/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test index 76e7c60fd5997..1e4f40a0019df 100644 --- a/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test @@ -1,6 +1,6 @@ --source include/have_innodb.inc ---source include/master-slave.inc --source include/have_binlog_format_row.inc +--source include/master-slave.inc # # Bug#68220: innodb_rows_updated is misleading on slave when *info_repository=TABLE diff --git a/mysql-test/suite/rpl/t/rpl_insert.test b/mysql-test/suite/rpl/t/rpl_insert.test index 2a29139ac48de..4881450881883 100644 --- a/mysql-test/suite/rpl/t/rpl_insert.test +++ b/mysql-test/suite/rpl/t/rpl_insert.test @@ -2,9 +2,9 @@ --echo # Bug#20821: INSERT DELAYED fails to write some rows to binlog --echo # ---source include/master-slave.inc --source include/not_embedded.inc --source include/not_windows.inc +--source include/master-slave.inc disable_query_log; call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features.test b/mysql-test/suite/rpl/t/rpl_invoked_features.test index 7770c36c39769..91391cf8372ed 100644 --- a/mysql-test/suite/rpl/t/rpl_invoked_features.test +++ b/mysql-test/suite/rpl/t/rpl_invoked_features.test @@ -5,8 +5,8 @@ # Features for Replication. ######################################### ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc disable_query_log; call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test b/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test index c73fa2897f368..e5ee400d2310f 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test @@ -4,8 +4,8 @@ # if the path of the load data file is a symbolic link. # --source include/not_windows.inc ---source include/master-slave.inc --source include/have_binlog_format_statement.inc +--source include/master-slave.inc create table t1(a int not null auto_increment, b int, primary key(a) ); load data infile '../../std_data/rpl_loaddata.dat' into table t1; diff --git a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test index 0e6608fd8485d..2761f169e83fa 100644 --- a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test +++ b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test @@ -1,8 +1,8 @@ ---source include/master-slave.inc --source include/have_debug.inc --source include/have_debug_sync.inc --source include/have_binlog_format_row.inc --source include/have_innodb.inc +--source include/master-slave.inc connection master; diff --git a/mysql-test/suite/rpl/t/rpl_mdev-11092.test b/mysql-test/suite/rpl/t/rpl_mdev-11092.test index c8b2b7f2ad1e2..31a385b40e6fc 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev-11092.test +++ b/mysql-test/suite/rpl/t/rpl_mdev-11092.test @@ -1,8 +1,8 @@ --source include/have_innodb.inc ---source include/master-slave.inc --source include/not_embedded.inc --source include/not_windows.inc --source include/have_binlog_format_row.inc +--source include/master-slave.inc ######################################################################################## call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_mdev8193.test b/mysql-test/suite/rpl/t/rpl_mdev8193.test index 29c26bb3da4f6..dcad3e5f9b0bd 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev8193.test +++ b/mysql-test/suite/rpl/t/rpl_mdev8193.test @@ -1,5 +1,5 @@ ---source include/master-slave.inc --source include/have_binlog_format_statement.inc +--source include/master-slave.inc --connection slave diff --git a/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size.test b/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size.test index 3850a84cbf1fb..81b01cc91404a 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size.test @@ -1,8 +1,8 @@ --source include/have_innodb.inc ---source include/master-slave.inc --source include/not_embedded.inc --source include/not_windows.inc --source include/have_binlog_format_mixed.inc +--source include/master-slave.inc --source extra/rpl_tests/rpl_binlog_max_cache_size.test --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test index b2e8308b34dcf..fa948f8f5fe31 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test @@ -3,8 +3,8 @@ ################################################################################ --source include/have_udf.inc --source include/have_binlog_format_mixed.inc ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc --let $engine=Innodb set session storage_engine=innodb; diff --git a/mysql-test/suite/rpl/t/rpl_mixed_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_mixed_mixing_engines.test index 747374b89c22f..a9c8f6fe3e1e1 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_mixing_engines.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_mixing_engines.test @@ -3,8 +3,8 @@ # tables. For further details, please, read WL#2687 and WL#5072. ################################################################################### --source include/have_binlog_format_mixed.inc ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc let $engine_type=Innodb; let $database_name=test; diff --git a/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test b/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test index 8092ff141db61..93ec9acf5ea45 100644 --- a/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test +++ b/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test @@ -3,8 +3,8 @@ # tables. For further details, please, read WL#2687 and WL#5072. ################################################################################### --source include/have_binlog_format_mixed.inc ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc --disable_query_log SET SESSION binlog_direct_non_transactional_updates = OFF; diff --git a/mysql-test/suite/rpl/t/rpl_not_null_innodb.test b/mysql-test/suite/rpl/t/rpl_not_null_innodb.test index 1e67ba4eda107..6a1cc341060a1 100644 --- a/mysql-test/suite/rpl/t/rpl_not_null_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_not_null_innodb.test @@ -11,9 +11,9 @@ # 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures) # ################################################################################# ---source include/master-slave.inc --source include/have_innodb.inc --source include/have_binlog_format_row.inc +--source include/master-slave.inc let $engine=Innodb; --source extra/rpl_tests/rpl_not_null.test diff --git a/mysql-test/suite/rpl/t/rpl_not_null_myisam.test b/mysql-test/suite/rpl/t/rpl_not_null_myisam.test index dcfaf006dadbd..6ef0b65d5ffee 100644 --- a/mysql-test/suite/rpl/t/rpl_not_null_myisam.test +++ b/mysql-test/suite/rpl/t/rpl_not_null_myisam.test @@ -11,8 +11,8 @@ # 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures) # ################################################################################# ---source include/master-slave.inc --source include/have_binlog_format_row.inc +--source include/master-slave.inc let $engine=MyISAM; --source extra/rpl_tests/rpl_not_null.test diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test index 0e74481bb6143..e850ae36700ac 100644 --- a/mysql-test/suite/rpl/t/rpl_packet.test +++ b/mysql-test/suite/rpl/t/rpl_packet.test @@ -9,8 +9,8 @@ # BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET # max-out size db name -source include/master-slave.inc; source include/have_binlog_format_row.inc; +source include/master-slave.inc; call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, .*error.* 1153"); call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet"); let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________; diff --git a/mysql-test/suite/rpl/t/rpl_performance_schema.test b/mysql-test/suite/rpl/t/rpl_performance_schema.test index 0562b0ea65855..18aabe5272d8f 100644 --- a/mysql-test/suite/rpl/t/rpl_performance_schema.test +++ b/mysql-test/suite/rpl/t/rpl_performance_schema.test @@ -1,6 +1,6 @@ ---source include/master-slave.inc --source include/have_perfschema.inc --source include/have_binlog_format_mixed.inc +--source include/master-slave.inc UPDATE performance_schema.setup_instruments SET ENABLED="NO"; diff --git a/mysql-test/suite/rpl/t/rpl_read_only.test b/mysql-test/suite/rpl/t/rpl_read_only.test index fb92803847ab0..c4781bbbb3bea 100644 --- a/mysql-test/suite/rpl/t/rpl_read_only.test +++ b/mysql-test/suite/rpl/t/rpl_read_only.test @@ -1,6 +1,6 @@ # Test case for BUG #11733 --- source include/master-slave.inc -- source include/have_innodb.inc +-- source include/master-slave.inc call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_report_port.test b/mysql-test/suite/rpl/t/rpl_report_port.test index 6e728a678ad01..2a14d278d489b 100644 --- a/mysql-test/suite/rpl/t/rpl_report_port.test +++ b/mysql-test/suite/rpl/t/rpl_report_port.test @@ -17,8 +17,8 @@ # case on doing SHOW SLAVE HOSTS on the master, we get the actual port number # of the slave (ie. SLAVE_PORT). -source include/master-slave.inc; source include/have_binlog_format_mixed.inc; +source include/master-slave.inc; connection master; diff --git a/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size.test b/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size.test index 9c8489658f8ef..cc031d382e0e1 100644 --- a/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size.test +++ b/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size.test @@ -1,8 +1,8 @@ --source include/have_innodb.inc ---source include/master-slave.inc --source include/not_embedded.inc --source include/not_windows.inc --source include/have_binlog_format_row.inc +--source include/master-slave.inc --source extra/rpl_tests/rpl_binlog_max_cache_size.test --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_colSize.test b/mysql-test/suite/rpl/t/rpl_row_colSize.test index cdffe2e333b0a..21c68b55e9265 100644 --- a/mysql-test/suite/rpl/t/rpl_row_colSize.test +++ b/mysql-test/suite/rpl/t/rpl_row_colSize.test @@ -6,8 +6,8 @@ # having columns that are smaller (shorter) than the slave. # ################################################################## --- source include/master-slave.inc -- source include/have_binlog_format_row.inc +-- source include/master-slave.inc --disable_warnings DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/rpl/t/rpl_row_corruption.test b/mysql-test/suite/rpl/t/rpl_row_corruption.test index e05273a2f9ca7..acf3964f0c524 100644 --- a/mysql-test/suite/rpl/t/rpl_row_corruption.test +++ b/mysql-test/suite/rpl/t/rpl_row_corruption.test @@ -1,7 +1,7 @@ # ---source include/master-slave.inc --source include/have_debug.inc --source include/have_binlog_format_row.inc +--source include/master-slave.inc # BUG#11753004: 44360: REPLICATION FAILED diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test index da73d753dcde1..03f9d6a953b0b 100644 --- a/mysql-test/suite/rpl/t/rpl_row_create_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test @@ -1,8 +1,8 @@ # Testing table creations for row-based replication. --source include/have_binlog_format_row.inc ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc connection slave; --source include/have_innodb.inc connection master; diff --git a/mysql-test/suite/rpl/t/rpl_row_find_row.test b/mysql-test/suite/rpl/t/rpl_row_find_row.test index 7f633c5aa9755..444706aca7f61 100644 --- a/mysql-test/suite/rpl/t/rpl_row_find_row.test +++ b/mysql-test/suite/rpl/t/rpl_row_find_row.test @@ -16,8 +16,8 @@ # has been fixed. # --- source include/master-slave.inc -- source include/have_binlog_format_row.inc +-- source include/master-slave.inc # # Case #1: master has key, but slave has not. diff --git a/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test index 2b35f68ff6302..6fdcd885930ae 100644 --- a/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test @@ -3,8 +3,8 @@ ################################################################################ --source include/have_udf.inc --source include/have_binlog_format_row.inc ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc --let $engine=Innodb set session storage_engine=innodb; diff --git a/mysql-test/suite/rpl/t/rpl_row_index_choice.test b/mysql-test/suite/rpl/t/rpl_row_index_choice.test index 6d4053f973705..0ad9b315d6639 100644 --- a/mysql-test/suite/rpl/t/rpl_row_index_choice.test +++ b/mysql-test/suite/rpl/t/rpl_row_index_choice.test @@ -1,7 +1,7 @@ --source include/have_binlog_format_row.inc ---source include/master-slave.inc --source include/have_debug.inc --source include/have_innodb.inc +--source include/master-slave.inc # Bug#58997: Row-based replication breaks on table with only fulltext index: connection master; diff --git a/mysql-test/suite/rpl/t/rpl_row_merge_engine.test b/mysql-test/suite/rpl/t/rpl_row_merge_engine.test index dcbb8b891d87b..c28d4a89651b6 100644 --- a/mysql-test/suite/rpl/t/rpl_row_merge_engine.test +++ b/mysql-test/suite/rpl/t/rpl_row_merge_engine.test @@ -12,8 +12,8 @@ # deletes their contents through the merge table. Finally, the slave # is synchronized with the master and (after the fix) it won't crash. # ---source include/master-slave.inc --source include/have_binlog_format_row.inc +--source include/master-slave.inc --connection master CREATE TABLE t1 (a int) ENGINE=MyISAM; diff --git a/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test b/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test index 57d67c5c71b68..b3808680db282 100644 --- a/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test @@ -1,6 +1,6 @@ -- source include/have_binlog_format_row.inc --- source include/master-slave.inc -- source include/have_innodb.inc +-- source include/master-slave.inc # # BUG#52868 Wrong handling of NULL value during update, replication out of sync diff --git a/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test b/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test index a78f7ad42718e..0882d60320326 100644 --- a/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test +++ b/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test @@ -12,8 +12,8 @@ # This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave after # some statements have been issued. --- source include/master-slave.inc -- source include/have_binlog_format_row.inc +-- source include/master-slave.inc -- source extra/rpl_tests/rpl_show_relaylog_events.inc --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test b/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test index e8ac74f0125df..5bdd1ff8b6bcb 100644 --- a/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test +++ b/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test @@ -26,9 +26,9 @@ # with mysqlbinlog reporting that it was unable to succeed in # reading the event. --- source include/master-slave.inc -- source include/have_innodb.inc -- source include/have_binlog_format_row.inc +-- source include/master-slave.inc -- disable_warnings DROP TABLE IF EXISTS `t1`; diff --git a/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test b/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test index 394bf949f7206..a8d7f77d9300e 100644 --- a/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test +++ b/mysql-test/suite/rpl/t/rpl_row_trunc_temp.test @@ -6,8 +6,8 @@ # table was binlogged in RBR. # ---source include/master-slave.inc --source include/have_binlog_format_row.inc +--source include/master-slave.inc #This statement is not binlogged in RBR. CREATE TEMPORARY TABLE t1(c1 INTEGER); diff --git a/mysql-test/suite/rpl/t/rpl_row_utf16.test b/mysql-test/suite/rpl/t/rpl_row_utf16.test index e3e7a51c0029f..595a149e5e668 100644 --- a/mysql-test/suite/rpl/t/rpl_row_utf16.test +++ b/mysql-test/suite/rpl/t/rpl_row_utf16.test @@ -1,6 +1,6 @@ --- source include/master-slave.inc -- source include/have_binlog_format_row.inc -- source include/have_utf16.inc +-- source include/master-slave.inc # # BUG#51716: Char column with utf16 character set gives wrong padding on slave diff --git a/mysql-test/suite/rpl/t/rpl_row_wide_table.test b/mysql-test/suite/rpl/t/rpl_row_wide_table.test index b1d161330969f..01473f991bf3c 100644 --- a/mysql-test/suite/rpl/t/rpl_row_wide_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_wide_table.test @@ -8,8 +8,8 @@ # in corrupt binlog ################################################################## --- source include/master-slave.inc -- source include/have_binlog_format_row.inc +-- source include/master-slave.inc --disable_warnings DROP TABLE IF EXISTS t300; diff --git a/mysql-test/suite/rpl/t/rpl_savepoint.test b/mysql-test/suite/rpl/t/rpl_savepoint.test index 2aacd1fa81e6d..a61c506f12f16 100644 --- a/mysql-test/suite/rpl/t/rpl_savepoint.test +++ b/mysql-test/suite/rpl/t/rpl_savepoint.test @@ -1,5 +1,5 @@ ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc --echo # --echo # Bug#50124 Rpl failure on DROP table with concurrent txn/non-txn diff --git a/mysql-test/suite/rpl/t/rpl_server_id_ignore.test b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test index 1e6d46c9d40c8..537978f17014a 100644 --- a/mysql-test/suite/rpl/t/rpl_server_id_ignore.test +++ b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test @@ -17,8 +17,8 @@ # b. nullifying the list and resuming of taking binlog from the very beginning with # executing events this time -source include/master-slave.inc; source include/have_binlog_format_mixed.inc; +source include/master-slave.inc; connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_set_null_innodb.test b/mysql-test/suite/rpl/t/rpl_set_null_innodb.test index 2d0c34e1d0a95..5ef102634981a 100644 --- a/mysql-test/suite/rpl/t/rpl_set_null_innodb.test +++ b/mysql-test/suite/rpl/t/rpl_set_null_innodb.test @@ -1,6 +1,6 @@ -- source include/have_binlog_format_mixed_or_row.inc --- source include/master-slave.inc -- source include/have_innodb.inc +-- source include/master-slave.inc -- let $engine= InnoDB -- source extra/rpl_tests/rpl_set_null.test diff --git a/mysql-test/suite/rpl/t/rpl_skip_error.test b/mysql-test/suite/rpl/t/rpl_skip_error.test index 142cd53b9dd64..a3c430ef00974 100644 --- a/mysql-test/suite/rpl/t/rpl_skip_error.test +++ b/mysql-test/suite/rpl/t/rpl_skip_error.test @@ -23,8 +23,8 @@ # bug in this test: BUG#30594: rpl.rpl_skip_error is nondeterministic: # BUG#39393: slave-skip-errors does not work when using ROW based replication -source include/master-slave.inc; source include/have_innodb.inc; +source include/master-slave.inc; --echo ==== Test Without sql_mode=strict_trans_tables ==== diff --git a/mysql-test/suite/rpl/t/rpl_skip_incident.test b/mysql-test/suite/rpl/t/rpl_skip_incident.test index 959fde9374edf..50e466b132903 100644 --- a/mysql-test/suite/rpl/t/rpl_skip_incident.test +++ b/mysql-test/suite/rpl/t/rpl_skip_incident.test @@ -1,5 +1,5 @@ ---source include/master-slave.inc --source include/have_debug.inc +--source include/master-slave.inc --echo **** On Master **** CREATE TABLE t1 (a INT); diff --git a/mysql-test/suite/rpl/t/rpl_skip_replication.test b/mysql-test/suite/rpl/t/rpl_skip_replication.test index f815554d4afc4..806f19b9e868d 100644 --- a/mysql-test/suite/rpl/t/rpl_skip_replication.test +++ b/mysql-test/suite/rpl/t/rpl_skip_replication.test @@ -1,5 +1,5 @@ ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc connection slave; # Test that SUPER is required to change @@replicate_events_marked_for_skip. diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index b1af6e92c29b6..69319bad4a006 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -20,9 +20,9 @@ --source include/have_binlog_format_statement.inc --source include/have_innodb.inc --source include/have_debug.inc ---source include/master-slave.inc --source include/not_embedded.inc --source include/not_var_link.inc +--source include/master-slave.inc ########################################################################## # Loading data diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test index f2129bd7f1878..d64f394055cad 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_skip.test +++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test @@ -4,8 +4,8 @@ # test for MIXED mode. source include/have_binlog_format_mixed.inc; -source include/master-slave.inc; source include/have_innodb.inc; +source include/master-slave.inc; --echo **** On Slave **** connection slave; diff --git a/mysql-test/suite/rpl/t/rpl_slow_query_log.test b/mysql-test/suite/rpl/t/rpl_slow_query_log.test index faf037a9dff06..6b2886bbd8df2 100644 --- a/mysql-test/suite/rpl/t/rpl_slow_query_log.test +++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test @@ -25,8 +25,8 @@ # Note that due to the sleep() command the insert is written to the binary # log in row format. -source include/master-slave.inc; source include/have_binlog_format_statement.inc; +source include/master-slave.inc; CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); diff --git a/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size.test b/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size.test index 352213304b6d1..93cc06111e474 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size.test +++ b/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size.test @@ -1,8 +1,8 @@ --source include/have_innodb.inc ---source include/master-slave.inc --source include/not_embedded.inc --source include/not_windows.inc --source include/have_binlog_format_statement.inc +--source include/master-slave.inc --source extra/rpl_tests/rpl_binlog_max_cache_size.test --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test index 7770fc77748b9..b395654a7142f 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test +++ b/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test @@ -5,8 +5,8 @@ ################################################################################### --source include/big_test.inc --source include/have_binlog_format_statement.inc ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc --source extra/rpl_tests/rpl_drop_create_temp_table.test --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test index 1e66b76abc8ee..774c87f551e4f 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test @@ -3,8 +3,8 @@ ################################################################################ --source include/have_udf.inc --source include/have_binlog_format_statement.inc ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc --let $engine=Innodb set session storage_engine=innodb; diff --git a/mysql-test/suite/rpl/t/rpl_stm_loadfile.test b/mysql-test/suite/rpl/t/rpl_stm_loadfile.test index 5d2c85b2cb670..bb8c39ca87312 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_stm_loadfile.test @@ -13,8 +13,8 @@ ########## # Includes --- source include/master-slave.inc -- source include/have_binlog_format_statement.inc +-- source include/master-slave.inc disable_query_log; call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test index db6e6bd14bfc6..5e982644cd9e4 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test +++ b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test @@ -19,8 +19,8 @@ # IO thread does not do it in an uncontrolled manner. --source include/have_binlog_format_statement.inc ---source include/master-slave.inc --source include/have_innodb.inc +--source include/master-slave.inc --disable_query_log CREATE TABLE t1 (c1 TEXT) engine=InnoDB; diff --git a/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test index dfe2e49bb907f..76b2aed3f24fa 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test @@ -1,9 +1,9 @@ ################################################################################ # Please, check ./extra/rpl_tests/rpl_start_stop_slave.test ################################################################################ ---source include/master-slave.inc --source include/have_binlog_format_statement.inc --source include/have_innodb.inc +--source include/master-slave.inc # make innodb updates run fast --connection slave diff --git a/mysql-test/suite/rpl/t/rpl_stm_user_variables.test b/mysql-test/suite/rpl/t/rpl_stm_user_variables.test index 64691a1b634f2..22a6600105e69 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_user_variables.test +++ b/mysql-test/suite/rpl/t/rpl_stm_user_variables.test @@ -2,8 +2,8 @@ # BUG#49562: SBR out of sync when using numeric data types + user variable # --- source include/master-slave.inc -- source include/have_binlog_format_statement.inc +-- source include/master-slave.inc ## Setup user variables for several numeric types, so that we get ## coverage on the User_var_log_event different val types diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test index 820ec19925f3d..20b82930aeab0 100644 --- a/mysql-test/suite/rpl/t/rpl_sync.test +++ b/mysql-test/suite/rpl/t/rpl_sync.test @@ -26,12 +26,12 @@ # Configuring the environment ######################################################################################## --echo =====Configuring the enviroment=======; ---source include/master-slave.inc --source include/not_embedded.inc --source include/not_valgrind.inc --source include/have_debug.inc --source include/have_innodb.inc --source include/not_crashrep.inc +--source include/master-slave.inc call mtr.add_suppression('Attempting backtrace'); call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); diff --git a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test index 70a2063c23c44..786600c480f60 100644 --- a/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test +++ b/mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test @@ -9,9 +9,9 @@ # 4: sync to slave and check the number of temp tables on slave. # -source include/master-slave.inc; source include/have_binlog_format_mixed.inc; source include/have_innodb.inc; +source include/master-slave.inc; --echo ==== Initialize ==== diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test index 250ccf4c1cdb5..4a53297678744 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test +++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test @@ -1,6 +1,6 @@ source include/have_binlog_format_row.inc; -source include/master-slave.inc; source include/have_innodb.inc; +source include/master-slave.inc; call mtr.add_suppression("Deadlock found"); call mtr.add_suppression("Can't find record in 't.'"); diff --git a/mysql-test/suite/rpl/t/sec_behind_master-5114.test b/mysql-test/suite/rpl/t/sec_behind_master-5114.test index ff8cab54c4f81..d1d21bfa76676 100644 --- a/mysql-test/suite/rpl/t/sec_behind_master-5114.test +++ b/mysql-test/suite/rpl/t/sec_behind_master-5114.test @@ -1,5 +1,5 @@ -source include/master-slave.inc; source include/have_binlog_format_statement.inc; +source include/master-slave.inc; call mtr.add_suppression("Unsafe statement written to the binary log"); diff --git a/mysql-test/t/create_or_replace2.test b/mysql-test/t/create_or_replace2.test index be1bd9a3d817b..da451796e12ce 100644 --- a/mysql-test/t/create_or_replace2.test +++ b/mysql-test/t/create_or_replace2.test @@ -3,9 +3,9 @@ # --source include/have_debug.inc ---source include/master-slave.inc --source include/have_binlog_format_row.inc --source include/have_xtradb.inc +--source include/master-slave.inc --disable_warnings drop table if exists t1; diff --git a/mysql-test/t/stat_tables_repl.test b/mysql-test/t/stat_tables_repl.test index 999c49d37cfca..ac24c9dcbd716 100644 --- a/mysql-test/t/stat_tables_repl.test +++ b/mysql-test/t/stat_tables_repl.test @@ -1,6 +1,6 @@ --source include/have_stat_tables.inc ---source include/master-slave.inc --source include/have_binlog_format_row.inc +--source include/master-slave.inc --echo # --echo # Bug mdev-485: unexpected failure with replication of DROP/ALTER table From 378beed0a680172d6570117c853d803e30983199 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 20 Sep 2017 20:02:01 +0200 Subject: [PATCH 04/23] MDEV-13290: Assertion Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' or `! is_set()' failed followup for 97c2a7354b6 - don't use thd->is_error(), the error could've been set before TABLE_LIST::cleanup_items. Use the error handler to count errors. This fixes rpl.rpl_row_binlog_max_cache_size - it was failing when ER_STMT_CACHE_FULL happened duing multi-table update. Because multi_update::abort_result_set() calls do_updates() to update as much as possible, so one cannot rely on thd->is_error() after that. --- sql/sql_class.h | 22 ++++++++++++++++++++++ sql/table.cc | 11 +++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/sql/sql_class.h b/sql/sql_class.h index 57ff65cb41612..7429ac586ea13 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1468,6 +1468,28 @@ class Dummy_error_handler : public Internal_error_handler }; +/** + Implements the trivial error handler which counts errors as they happen. +*/ + +class Counting_error_handler : public Internal_error_handler +{ +public: + int errors; + bool handle_condition(THD *thd, + uint sql_errno, + const char* sqlstate, + Sql_condition::enum_warning_level level, + const char* msg, + Sql_condition ** cond_hdl) + { + errors++; + return false; + } + Counting_error_handler() : errors(0) {} +}; + + /** This class is an internal error handler implementation for DROP TABLE statements. The thing is that there may be warnings during diff --git a/sql/table.cc b/sql/table.cc index ff9c4217b7d89..36ed9be808415 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4628,7 +4628,13 @@ void TABLE_LIST::cleanup_items() int TABLE_LIST::view_check_option(THD *thd, bool ignore_failure) { - if (check_option && check_option->val_int() == 0) + Counting_error_handler ceh; + thd->push_internal_handler(&ceh); + bool res= check_option && check_option->val_int() == 0; + thd->pop_internal_handler(); + if (ceh.errors) + return(VIEW_CHECK_ERROR); + if (res) { TABLE_LIST *main_view= top_table(); if (ignore_failure) @@ -4642,9 +4648,6 @@ int TABLE_LIST::view_check_option(THD *thd, bool ignore_failure) main_view->view_name.str); return(VIEW_CHECK_ERROR); } - /* We check thd->error() because it can be set by conversion problem. */ - if (thd->is_error()) - return(VIEW_CHECK_ERROR); return(VIEW_CHECK_OK); } From c9c1adc649524c8365c31f8f2df5cbf9c2b60ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 21 Sep 2017 08:21:06 +0300 Subject: [PATCH 05/23] Avoid comparison of unsigned to signed --- storage/innobase/rem/rem0rec.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index d4d1a2bab142e..245dde45bb339 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -1570,7 +1570,7 @@ rec_copy_prefix_to_dtuple_func( ulint* offsets = offsets_; rec_offs_init(offsets_); - ut_ad(is_leaf || n_fields <= index->n_uniq + 1); + ut_ad(is_leaf || n_fields <= unsigned(index->n_uniq + 1)); offsets = rec_get_offsets(rec, index, offsets, is_leaf, n_fields, &heap); From bb7a70c9551c1756b1d1736ca4f6a0a965795873 Mon Sep 17 00:00:00 2001 From: sachin Date: Mon, 11 Sep 2017 17:46:56 +0530 Subject: [PATCH 06/23] MDEV-10767 /tmp/wsrep_recovery.${RANDOM} file created in unallowed SELinux context Problem:- To create file in /tmp dir mysqld require permission initrc_tmp_t. And mysqld does not have his permission. Solution:- Instead of giving mysqld permission of initrc_tmp_t , we redirected log to file in /tmp dir through shell. I also removed a earlier workarround in mysqld_safe.sh , which create tmp log file in datadir. --- scripts/galera_recovery.sh | 2 +- scripts/mysqld_safe.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh index d734ceb7ac7c6..de2e653c49722 100644 --- a/scripts/galera_recovery.sh +++ b/scripts/galera_recovery.sh @@ -69,7 +69,7 @@ parse_arguments() { wsrep_recover_position() { # Redirect server's error log to the log file. eval /usr/sbin/mysqld $cmdline_args --user=$user --wsrep_recover \ - --log-error="$log_file" + --disable-log-error 2> "$log_file" ret=$? if [ $ret -ne 0 ]; then # Something went wrong, let us also print the error log so that it diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index e5708b51be57c..5564f92a27cd6 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -246,7 +246,7 @@ wsrep_recover_position() { local euid=$(id -u) local ret=0 - local wr_logfile=$(mktemp $DATADIR/wsrep_recovery.XXXXXX) + local wr_logfile=$(mktemp wsrep_recovery.XXXXXX) # safety checks if [ -z $wr_logfile ]; then @@ -264,11 +264,11 @@ wsrep_recover_position() { local wr_pidfile="$DATADIR/"`@HOSTNAME@`"-recover.pid" - local wr_options="--log_error='$wr_logfile' --pid-file='$wr_pidfile'" + local wr_options="--disable-log-error --pid-file='$wr_pidfile'" log_notice "WSREP: Running position recovery with $wr_options" - eval_log_error "$mysqld_cmd --wsrep_recover $wr_options" + eval_log_error "$mysqld_cmd --wsrep_recover $wr_options 2> $wr_logfile" local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)" if [ -z "$rp" ]; then From 9c373d4d1d4595eac9f493cac18a884876d6753c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 21 Sep 2017 10:07:28 +0300 Subject: [PATCH 07/23] Fix bogus rec_get_offsets() debug assertion failures for ROW_FORMAT=REDUNDANT When the debug parameter 'bool leaf' was added to rec_get_offsets(), also some debug assertions for reading the heap_no of ROW_FORMAT=REDUNDANT records were added. However, the heap number is uninitialized when offsets are being computed for to-be-inserted records. For debug builds, initialize the heap number to a dummy value, so that the record will be interpreted as 'user record'. The infimum and supremum pseudo-records are never copied from the page frame and never inserted; they are part of the page creation. rec_convert_dtuple_to_rec_old(): Remove a bogus memset() in debug builds. --- storage/innobase/page/page0cur.cc | 6 ++++++ storage/innobase/rem/rem0rec.cc | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index 23a11fcfaa386..113c31e44ae20 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -1176,9 +1176,15 @@ page_cur_parse_insert_rec( ut_memcpy(buf + mismatch_index, ptr, end_seg_len); if (page_is_comp(page)) { + /* Make rec_get_offsets() and rec_offs_make_valid() happy. */ + ut_d(rec_set_heap_no_new(buf + origin_offset, + PAGE_HEAP_NO_USER_LOW)); rec_set_info_and_status_bits(buf + origin_offset, info_and_status_bits); } else { + /* Make rec_get_offsets() and rec_offs_make_valid() happy. */ + ut_d(rec_set_heap_no_old(buf + origin_offset, + PAGE_HEAP_NO_USER_LOW)); rec_set_info_bits_old(buf + origin_offset, info_and_status_bits); } diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index 245dde45bb339..8bb0f0187cbaa 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -1130,17 +1130,14 @@ rec_convert_dtuple_to_rec_old( /* Calculate the offset of the origin in the physical record */ rec = buf + rec_get_converted_extra_size(data_size, n_fields, n_ext); -#ifdef UNIV_DEBUG - /* Suppress Valgrind warnings of ut_ad() - in mach_write_to_1(), mach_write_to_2() et al. */ - memset(buf, 0xff, rec - buf + data_size); -#endif /* UNIV_DEBUG */ /* Store the number of fields */ rec_set_n_fields_old(rec, n_fields); /* Set the info bits of the record */ rec_set_info_bits_old(rec, dtuple_get_info_bits(dtuple) & REC_INFO_BITS_MASK); + /* Make rec_get_offsets() and rec_offs_make_valid() happy. */ + ut_d(rec_set_heap_no_old(rec, PAGE_HEAP_NO_USER_LOW)); /* Store the data and the offsets */ @@ -1254,6 +1251,8 @@ rec_convert_dtuple_to_rec_comp( temp = false; } } else { + /* Make rec_get_offsets() and rec_offs_make_valid() happy. */ + ut_d(rec_set_heap_no_new(rec, PAGE_HEAP_NO_USER_LOW)); nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1); switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) { From 02de2385a2d89fdac74524efea1a76c4d314f5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 21 Sep 2017 10:15:27 +0300 Subject: [PATCH 08/23] page_rec_is_leaf(): Fix sign mismatch warnings --- storage/innobase/include/page0page.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 3b6a0215249bb..53a58de229d13 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -328,10 +328,10 @@ bool page_rec_is_leaf(const page_t* rec) { const page_t* page = page_align(rec); - ut_ad(rec - page >= page_get_infimum_offset(page)); + ut_ad(ulint(rec - page) >= page_get_infimum_offset(page)); bool leaf = page_is_leaf(page); ut_ad(!page_rec_is_comp(rec) - || !page_rec_is_user_rec_low(rec - page) + || !page_rec_is_user_rec_low(ulint(rec - page)) || leaf == !rec_get_node_ptr_flag(rec)); return leaf; } From e84f5356c3b99633142e0e8b0dfa9919b75649c3 Mon Sep 17 00:00:00 2001 From: Sachin Setiya Date: Thu, 21 Sep 2017 13:22:49 +0530 Subject: [PATCH 09/23] MDEV-12290 Wrong timestamps in binary log causes replication issues Binlog_background_thread does not make a call to set_time(), And when we call binlog_checkpoint_log_event->write() , we write the wrong timestamp. In this patch we correct this by calling thd->set_time(). --- sql/log.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/log.cc b/sql/log.cc index 7a24e3743c024..3d6b0cbbc4a9c 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -9278,7 +9278,9 @@ binlog_background_thread(void *arg __attribute__((unused))) while (queue) { THD_STAGE_INFO(thd, stage_binlog_processing_checkpoint_notify); - DEBUG_SYNC(current_thd, "binlog_background_thread_before_mark_xid_done"); + DEBUG_SYNC(thd, "binlog_background_thread_before_mark_xid_done"); + /* Set the thread start time */ + thd->set_time(); /* Grab next pointer first, as mark_xid_done() may free the element. */ next= queue->next_in_queue; mysql_bin_log.mark_xid_done(queue->binlog_id, true); From 1015196e0a9013e93158eaef2a690cd921660e57 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 21 Sep 2017 10:03:40 +0200 Subject: [PATCH 10/23] cleanup: TABLE_LIST::view_check_option don't prepare for checking view's CHECK OPTION, if there is no CHECK OPTION in the first place. --- sql/table.cc | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/sql/table.cc b/sql/table.cc index 36ed9be808415..54f7bc7b473ae 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4628,25 +4628,28 @@ void TABLE_LIST::cleanup_items() int TABLE_LIST::view_check_option(THD *thd, bool ignore_failure) { - Counting_error_handler ceh; - thd->push_internal_handler(&ceh); - bool res= check_option && check_option->val_int() == 0; - thd->pop_internal_handler(); - if (ceh.errors) - return(VIEW_CHECK_ERROR); - if (res) - { - TABLE_LIST *main_view= top_table(); - if (ignore_failure) + if (check_option) + { + Counting_error_handler ceh; + thd->push_internal_handler(&ceh); + bool res= check_option->val_int() == 0; + thd->pop_internal_handler(); + if (ceh.errors) + return(VIEW_CHECK_ERROR); + if (res) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED), - main_view->view_db.str, main_view->view_name.str); - return(VIEW_CHECK_SKIP); + TABLE_LIST *main_view= top_table(); + if (ignore_failure) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED), + main_view->view_db.str, main_view->view_name.str); + return(VIEW_CHECK_SKIP); + } + my_error(ER_VIEW_CHECK_FAILED, MYF(0), main_view->view_db.str, + main_view->view_name.str); + return(VIEW_CHECK_ERROR); } - my_error(ER_VIEW_CHECK_FAILED, MYF(0), main_view->view_db.str, - main_view->view_name.str); - return(VIEW_CHECK_ERROR); } return(VIEW_CHECK_OK); } From 05da63f0483e2e1d2389e9c6829f269db014dfbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 21 Sep 2017 12:05:21 +0300 Subject: [PATCH 11/23] Correct debug assertions Node pointer recors contain dict_index_get_n_unique_in_tree_nonleaf(index)+1 instead of index->n_uniq+1 fields. rec_get_offsets_func(): Remove the incorrect assertion. Later in the function there are assertion for checking the exact field count. --- storage/innobase/rem/rem0rec.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index 8bb0f0187cbaa..c26614d5eae5d 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -589,8 +589,6 @@ rec_get_offsets_func( infimum and supremum record based on the heap number. */ ut_d(const bool is_user_rec = rec_get_heap_no_old(rec) >= PAGE_HEAP_NO_USER_LOW); - ut_ad(n <= ulint(index->n_fields + !leaf) || index->is_dummy - || dict_index_is_ibuf(index)); /* The infimum and supremum records carry 1 field. */ ut_ad(is_user_rec || n == 1); ut_ad(!is_user_rec || leaf || index->is_dummy @@ -1569,7 +1567,8 @@ rec_copy_prefix_to_dtuple_func( ulint* offsets = offsets_; rec_offs_init(offsets_); - ut_ad(is_leaf || n_fields <= unsigned(index->n_uniq + 1)); + ut_ad(is_leaf || n_fields + <= dict_index_get_n_unique_in_tree_nonleaf(index) + 1); offsets = rec_get_offsets(rec, index, offsets, is_leaf, n_fields, &heap); From db7fd021fed180f1cae6d4274ff31658c9cf7b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 21 Sep 2017 12:31:30 +0300 Subject: [PATCH 12/23] Add have_debug.inc to skip the test faster in non-debug builds --- mysql-test/suite/innodb/t/innodb-index-online.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test index 24e3cd1ba2295..e09a65a878af1 100644 --- a/mysql-test/suite/innodb/t/innodb-index-online.test +++ b/mysql-test/suite/innodb/t/innodb-index-online.test @@ -1,4 +1,5 @@ --source include/innodb_page_size_small.inc +--source include/have_debug.inc --source include/have_debug_sync.inc let $innodb_metrics_select= From 0a44ae6528d1fdb2d4a9dab1be7e36931eac8236 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 21 Sep 2017 16:30:24 +0300 Subject: [PATCH 13/23] Fix that FLUSH TABLES FOR EXPORT also works for Aria tables. - Added missing test case for MyISAM --- mysql-test/r/myisam.result | 8 ++++++++ mysql-test/suite/maria/maria.result | 8 ++++++++ mysql-test/suite/maria/maria.test | 13 +++++++++++++ mysql-test/t/myisam.test | 13 +++++++++++++ storage/maria/ha_maria.cc | 2 +- 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 5b41b35c1ba44..78eb374b1424d 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -2569,6 +2569,14 @@ OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK DROP TABLE t1; +CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b)) engine=myisam; +INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'), +(6,'0'),(7,'0'); +flush tables test.t1 for export; +insert into t1 values (8,'0'); +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +unlock tables; +drop table t1; show variables like 'myisam_block_size'; Variable_name Value myisam_block_size 1024 diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index 88f39827f27a1..b5fbcbe113d35 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -2790,3 +2790,11 @@ test.t1 check status OK SET aria_repair_threads=@@global.aria_repair_threads; SET aria_sort_buffer_size=@@global.aria_sort_buffer_size; DROP TABLE t1; +CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b)); +INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'), +(6,'0'),(7,'0'); +flush tables test.t1 for export; +insert into t1 values (8,'0'); +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +unlock tables; +drop table t1; diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test index 1b930a22c3597..e710f32ef8003 100644 --- a/mysql-test/suite/maria/maria.test +++ b/mysql-test/suite/maria/maria.test @@ -2018,6 +2018,19 @@ SET aria_repair_threads=@@global.aria_repair_threads; SET aria_sort_buffer_size=@@global.aria_sort_buffer_size; DROP TABLE t1; +# +# Check FLUSH FOR EXPORT +# + +CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b)); +INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'), + (6,'0'),(7,'0'); +flush tables test.t1 for export; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +insert into t1 values (8,'0'); +unlock tables; +drop table t1; + # # End of test # diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 572fa55e70f00..0da542e499e37 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1769,6 +1769,19 @@ ALTER TABLE t1 DISABLE KEYS; OPTIMIZE TABLE t1; DROP TABLE t1; +# +# Check FLUSH FOR EXPORT +# + +CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b)) engine=myisam; +INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'), + (6,'0'),(7,'0'); +flush tables test.t1 for export; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +insert into t1 values (8,'0'); +unlock tables; +drop table t1; + # # Check some variables # diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 119a002a11a09..868281be57204 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -989,7 +989,7 @@ int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_FILE_BASED | HA_CAN_GEOMETRY | CANNOT_ROLLBACK_FLAG | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS | HA_CAN_REPAIR | - HA_CAN_VIRTUAL_COLUMNS | + HA_CAN_VIRTUAL_COLUMNS | HA_CAN_EXPORT | HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT), can_enable_indexes(1), bulk_insert_single_undo(BULK_INSERT_NONE) {} From 3fbd4aa03208833001296e63847c7922ff0bdd8b Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 21 Sep 2017 16:05:39 +0000 Subject: [PATCH 14/23] CMake : Do not use FindPkgConfig on Windows Even if cmake can find pkg-config (e.g the one supplied with strawberry perl ), we cannot link with pkg-config-found libraries or use the headers -they are mingw, 32bit-only. --- cmake/systemd.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake index 6986cb748ce0d..f7365066ef6fd 100644 --- a/cmake/systemd.cmake +++ b/cmake/systemd.cmake @@ -13,11 +13,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -INCLUDE(FindPkgConfig) -# http://www.cmake.org/cmake/help/v3.0/module/FindPkgConfig.html - MACRO(CHECK_SYSTEMD) IF(UNIX) + INCLUDE(FindPkgConfig) + # http://www.cmake.org/cmake/help/v3.0/module/FindPkgConfig.html SET(WITH_SYSTEMD "auto" CACHE STRING "Enable systemd scripts and notification support") IF(WITH_SYSTEMD STREQUAL "yes" OR WITH_SYSTEMD STREQUAL "auto") IF(PKG_CONFIG_FOUND) From cb1b466c0c3fa72a058fe6462261f70b11d45c53 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 16 Aug 2017 13:26:53 +0200 Subject: [PATCH 15/23] CONNECT: compilation fix tabtyp was defined under ODBC_SUPPORT, but used outside of it too (under JDBC_SUPPORT). --- storage/connect/ha_connect.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 0278211c620e6..692c7674eb6d9 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -5379,10 +5379,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd, #endif // __WIN__ //int hdr, mxe; int port = 0, mxr = 0, rc = 0, mul = 0, lrecl = 0; + PCSZ tabtyp = NULL; #if defined(ODBC_SUPPORT) POPARM sop= NULL; PCSZ ucnc= NULL; - PCSZ tabtyp = NULL; bool cnc= false; int cto= -1, qto= -1; #endif // ODBC_SUPPORT From 8d0448d5075fe822e37f81b740e83f03ab318448 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 21 Sep 2017 18:05:07 +0200 Subject: [PATCH 16/23] MDEV-13861 Assertion `0' failed in Protocol::end_statement followup for 378beed0a68 - only count WARN_LEVEL_ERROR, not warnings or notes. --- mysql-test/r/insert.result | 6 ++++++ mysql-test/t/insert.test | 10 ++++++++++ sql/sql_class.h | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 8b03a3363de40..39cb4cac85db0 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -745,3 +745,9 @@ f1 f2 drop view v1; drop table t1; SET @@sql_mode= @save_mode; +CREATE TABLE t1 (f INT); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE f <=> 'foo' WITH CHECK OPTION; +REPLACE INTO v1 SET f = NULL; +ERROR HY000: CHECK OPTION failed 'test.v1' +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index e28eeb9f87663..9e84bf3ee5f60 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -602,3 +602,13 @@ remove_file $MYSQLD_DATADIR/test/t1.txt; drop view v1; drop table t1; SET @@sql_mode= @save_mode; + +# +# MDEV-13861 Assertion `0' failed in Protocol::end_statement +# +CREATE TABLE t1 (f INT); +CREATE VIEW v1 AS SELECT * FROM t1 WHERE f <=> 'foo' WITH CHECK OPTION; +--error ER_VIEW_CHECK_FAILED +REPLACE INTO v1 SET f = NULL; +DROP VIEW v1; +DROP TABLE t1; diff --git a/sql/sql_class.h b/sql/sql_class.h index 7429ac586ea13..3aeb812703014 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1483,7 +1483,8 @@ class Counting_error_handler : public Internal_error_handler const char* msg, Sql_condition ** cond_hdl) { - errors++; + if (level == Sql_condition::WARN_LEVEL_ERROR) + errors++; return false; } Counting_error_handler() : errors(0) {} From 46a2917c0fd287755d9e357a98d04ed2c8b1ba0a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 20 Sep 2017 00:02:06 +0200 Subject: [PATCH 17/23] MDEV-13208 Cannot import libmariadbclient.so.18 from python libmariadbclient_18 version nodes, specially for debian builds --- libmysql/CMakeLists.txt | 11 +++++++++++ libmysql/libmysql_versions.ld.in | 2 ++ 2 files changed, 13 insertions(+) diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 8e60d2675214f..acbd80b48758f 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -391,6 +391,10 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") *; }; + libmariadbclient_18 { + /* empty here. aliases are added above */ + }; + libmysqlclient_16 { /* empty here. aliases are added above */ }; @@ -399,16 +403,23 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET (CLIENT_API_5_1_LIST) SET (CLIENT_API_5_1_ALIASES) + SET (DEBIAN9_ALIASES) FOREACH (f ${CLIENT_API_FUNCTIONS_5_1} ${CLIENT_API_5_1_EXTRA}) SET(CLIENT_API_5_1_LIST "${CLIENT_API_5_1_LIST}\t${f};\n") SET(CLIENT_API_5_1_ALIASES "${CLIENT_API_5_1_ALIASES}\"${f}@libmysqlclient_16\" = ${f};\n") + SET(DEBIAN9_ALIASES "${DEBIAN9_ALIASES}\"${f}@libmariadbclient_18\" = ${f};\n") ENDFOREACH() SET (CLIENT_API_5_5_LIST) FOREACH (f ${CLIENT_API_FUNCTIONS_5_5} ${CLIENT_API_5_5_EXTRA}) SET(CLIENT_API_5_5_LIST "${CLIENT_API_5_5_LIST}\t${f};\n") + SET(DEBIAN9_ALIASES "${DEBIAN9_ALIASES}\"${f}@libmariadbclient_18\" = ${f};\n") ENDFOREACH() + IF(NOT DEB) + SET (DEBIAN9_ALIASES) + ENDIF() + ELSE (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING) SET (CLIENT_API_5_1_ALIASES "/* Versioning disabled per user request. MDEV-5982 */") ENDIF (NOT DISABLE_LIBMYSQLCLIENT_SYMBOL_VERSIONING) diff --git a/libmysql/libmysql_versions.ld.in b/libmysql/libmysql_versions.ld.in index 0cf5b45cc1829..f3b27e1cd1faa 100644 --- a/libmysql/libmysql_versions.ld.in +++ b/libmysql/libmysql_versions.ld.in @@ -16,6 +16,8 @@ @CLIENT_API_5_1_ALIASES@ +@DEBIAN9_ALIASES@ + /* On Fedora the following symbols are exported, but renamed into a mysql_ namespace. We export them as aliases, but keep original symbols too. See From f4f48e06215fe6717865ccbe27ddc388a2cb86b8 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 19 Sep 2017 11:18:45 +0200 Subject: [PATCH 18/23] MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change Implement a special Copy_field method for timestamps, that copies timestamps without converting them to MYSQL_TIME (the conversion is lossy around DST change dates). --- mysql-test/r/old-mode.result | 23 ++++++++++++ ...ral_format_mariadb53_to_mysql56_dst.result | 28 ++++++++++++++ ...poral_format_mariadb53_to_mysql56_dst.test | 37 +++++++++++++++++++ mysql-test/t/old-mode.test | 17 +++++++++ sql/field_conv.cc | 16 +++++++- 5 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/rpl/r/rpl_temporal_format_mariadb53_to_mysql56_dst.result create mode 100644 mysql-test/suite/rpl/t/rpl_temporal_format_mariadb53_to_mysql56_dst.test diff --git a/mysql-test/r/old-mode.result b/mysql-test/r/old-mode.result index c2ee3324ede05..398e719cf02ee 100644 --- a/mysql-test/r/old-mode.result +++ b/mysql-test/r/old-mode.result @@ -127,3 +127,26 @@ Warning 1264 Out of range value for column 'a' at row 1 Warning 1264 Out of range value for column 'b' at row 1 DROP TABLE t1; SET @@global.mysql56_temporal_format=DEFAULT; +set time_zone='Europe/Moscow'; +set global mysql56_temporal_format=false; +create table t1 (a timestamp); +set timestamp=1288477526; +insert t1 values (null); +set timestamp=1288481126; +insert t1 values (null); +select a, unix_timestamp(a) from t1; +a unix_timestamp(a) +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288481126 +set global mysql56_temporal_format=true; +select a, unix_timestamp(a) from t1; +a unix_timestamp(a) +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288481126 +alter table t1 modify a timestamp; +select a, unix_timestamp(a) from t1; +a unix_timestamp(a) +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288481126 +drop table t1; +set time_zone=DEFAULT; diff --git a/mysql-test/suite/rpl/r/rpl_temporal_format_mariadb53_to_mysql56_dst.result b/mysql-test/suite/rpl/r/rpl_temporal_format_mariadb53_to_mysql56_dst.result new file mode 100644 index 0000000000000..352101cb8cd47 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_temporal_format_mariadb53_to_mysql56_dst.result @@ -0,0 +1,28 @@ +include/master-slave.inc +[connection master] +set global time_zone='Europe/Moscow'; +set time_zone='UTC'; +stop slave; +start slave; +set global mysql56_temporal_format=false; +set global time_zone='Europe/Moscow'; +set time_zone='UTC'; +create table t1 (pk int primary key, t timestamp not null); +set timestamp = 1288477526; +insert into t1 values (1,null); +set timestamp = 1288481126; +insert into t1 values (2,null); +select pk, t, unix_timestamp(t) from t1; +pk t unix_timestamp(t) +1 2010-10-30 22:25:26 1288477526 +2 2010-10-30 23:25:26 1288481126 +set time_zone=default; +select pk, t, unix_timestamp(t) from t1; +pk t unix_timestamp(t) +1 2010-10-31 02:25:26 1288477526 +2 2010-10-31 02:25:26 1288481126 +set global time_zone=default; +drop table t1; +set global time_zone=default; +set global mysql56_temporal_format=default; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_temporal_format_mariadb53_to_mysql56_dst.test b/mysql-test/suite/rpl/t/rpl_temporal_format_mariadb53_to_mysql56_dst.test new file mode 100644 index 0000000000000..511bdc1518491 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_temporal_format_mariadb53_to_mysql56_dst.test @@ -0,0 +1,37 @@ +# +# MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change +# +source include/have_binlog_format_row.inc; +source include/master-slave.inc; + +connection slave; +set global time_zone='Europe/Moscow'; +set time_zone='UTC'; +stop slave; +start slave; + +connection master; +set global mysql56_temporal_format=false; +set global time_zone='Europe/Moscow'; +set time_zone='UTC'; + +create table t1 (pk int primary key, t timestamp not null); +set timestamp = 1288477526; +insert into t1 values (1,null); +set timestamp = 1288481126; +insert into t1 values (2,null); + +sync_slave_with_master; + +select pk, t, unix_timestamp(t) from t1; +set time_zone=default; +select pk, t, unix_timestamp(t) from t1; + +set global time_zone=default; + +connection master; +drop table t1; +set global time_zone=default; +set global mysql56_temporal_format=default; + +source include/rpl_end.inc; diff --git a/mysql-test/t/old-mode.test b/mysql-test/t/old-mode.test index 0572570d12267..99c92f8093d7a 100644 --- a/mysql-test/t/old-mode.test +++ b/mysql-test/t/old-mode.test @@ -83,3 +83,20 @@ SELECT TO_DAYS(a), TO_DAYS(b) FROM t1; DROP TABLE t1; SET @@global.mysql56_temporal_format=DEFAULT; +# +# MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change +# +set time_zone='Europe/Moscow'; +set global mysql56_temporal_format=false; +create table t1 (a timestamp); +set timestamp=1288477526; +insert t1 values (null); +set timestamp=1288481126; +insert t1 values (null); +select a, unix_timestamp(a) from t1; +set global mysql56_temporal_format=true; +select a, unix_timestamp(a) from t1; +alter table t1 modify a timestamp; +select a, unix_timestamp(a) from t1; +drop table t1; +set time_zone=DEFAULT; diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 7b57c7da10455..74c5fb5b502f4 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -417,6 +417,18 @@ static void do_field_decimal(Copy_field *copy) } +static void do_field_timestamp(Copy_field *copy) +{ + DBUG_ASSERT(copy->from_field->type() == MYSQL_TYPE_TIMESTAMP); + DBUG_ASSERT(copy->to_field->type() == MYSQL_TYPE_TIMESTAMP); + ulong sec_part; + Field_timestamp *f= static_cast(copy->from_field); + Field_timestamp *t= static_cast(copy->to_field); + my_time_t ts= f->get_timestamp(&sec_part); + t->store_TIME(ts, sec_part); +} + + static void do_field_temporal(Copy_field *copy) { MYSQL_TIME ltime; @@ -724,7 +736,9 @@ Copy_field::get_copy_func(Field *to,Field *from) ((to->table->in_use->variables.sql_mode & (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE)) && mysql_type_to_time_type(to->type()) != MYSQL_TIMESTAMP_TIME)) - return do_field_temporal; + return (from->type() == MYSQL_TYPE_TIMESTAMP && + to->type() == MYSQL_TYPE_TIMESTAMP) + ? do_field_timestamp : do_field_temporal; /* Do binary copy */ } // Check if identical fields From f8a800bec81983910a96a5dc38f3aeb9b7528bce Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 19 Sep 2017 23:50:32 +0200 Subject: [PATCH 19/23] bugfix: copy timestamps correctly in INSERT...SELECT don't do it via MYSQL_TIME, that conversion is lossy around DST change dates. --- mysql-test/r/old-mode.result | 22 ++++++++++++++++++++++ mysql-test/t/old-mode.test | 17 +++++++++++++++++ sql/field.cc | 17 +++++++++++++++++ sql/field.h | 1 + sql/field_conv.cc | 19 ++++++++++++------- 5 files changed, 69 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/old-mode.result b/mysql-test/r/old-mode.result index 398e719cf02ee..b9a3edd4e9424 100644 --- a/mysql-test/r/old-mode.result +++ b/mysql-test/r/old-mode.result @@ -149,4 +149,26 @@ a unix_timestamp(a) 2010-10-31 02:25:26 1288477526 2010-10-31 02:25:26 1288481126 drop table t1; +set global mysql56_temporal_format=false; +create table t1 (a timestamp); +set timestamp=1288477526; +insert t1 values (null); +set timestamp=1288481126; +insert t1 values (null); +select a, unix_timestamp(a) from t1; +a unix_timestamp(a) +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288481126 +set global mysql56_temporal_format=true; +select a, unix_timestamp(a) from t1; +a unix_timestamp(a) +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288481126 +create table t2 (a timestamp); +insert t2 select a from t1; +select a, unix_timestamp(a) from t2; +a unix_timestamp(a) +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288481126 +drop table t1, t2; set time_zone=DEFAULT; diff --git a/mysql-test/t/old-mode.test b/mysql-test/t/old-mode.test index 99c92f8093d7a..ed33da523c72c 100644 --- a/mysql-test/t/old-mode.test +++ b/mysql-test/t/old-mode.test @@ -86,6 +86,8 @@ SET @@global.mysql56_temporal_format=DEFAULT; # # MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change # + +# Copy_field set time_zone='Europe/Moscow'; set global mysql56_temporal_format=false; create table t1 (a timestamp); @@ -99,4 +101,19 @@ select a, unix_timestamp(a) from t1; alter table t1 modify a timestamp; select a, unix_timestamp(a) from t1; drop table t1; + +# field_conv_incompatible() +set global mysql56_temporal_format=false; +create table t1 (a timestamp); +set timestamp=1288477526; +insert t1 values (null); +set timestamp=1288481126; +insert t1 values (null); +select a, unix_timestamp(a) from t1; +set global mysql56_temporal_format=true; +select a, unix_timestamp(a) from t1; +create table t2 (a timestamp); +insert t2 select a from t1; +select a, unix_timestamp(a) from t2; +drop table t1, t2; set time_zone=DEFAULT; diff --git a/sql/field.cc b/sql/field.cc index 8eb37c56c7e60..6a28b38a612b2 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5064,6 +5064,23 @@ int Field_timestamp::store(longlong nr, bool unsigned_val) } +int Field_timestamp::store_timestamp(Field_timestamp *from) +{ + ulong sec_part; + my_time_t ts= from->get_timestamp(&sec_part); + store_TIME(ts, sec_part); + if (!ts && !sec_part && get_thd()->variables.sql_mode & MODE_NO_ZERO_DATE) + { + ErrConvString s( + STRING_WITH_LEN("0000-00-00 00:00:00.000000") - (decimals() ? 6 - decimals() : 7), + system_charset_info); + set_datetime_warning(WARN_DATA_TRUNCATED, &s, MYSQL_TIMESTAMP_DATETIME, 1); + return 1; + } + return 0; +} + + double Field_timestamp::val_real(void) { return (double) Field_timestamp::val_int(); diff --git a/sql/field.h b/sql/field.h index 30f24ecc1bb28..154037df767e8 100644 --- a/sql/field.h +++ b/sql/field.h @@ -2186,6 +2186,7 @@ class Field_timestamp :public Field_temporal { int store(longlong nr, bool unsigned_val); int store_time_dec(MYSQL_TIME *ltime, uint dec); int store_decimal(const my_decimal *); + int store_timestamp(Field_timestamp *from); double val_real(void); longlong val_int(void); String *val_str(String*,String *); diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 74c5fb5b502f4..850403afb9703 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -219,6 +219,13 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions) } +static int copy_timestamp_fields(Field *from, Field *to) +{ + DBUG_ASSERT(from->type() == MYSQL_TYPE_TIMESTAMP); + DBUG_ASSERT(to->type() == MYSQL_TYPE_TIMESTAMP); + return ((Field_timestamp*)to)->store_timestamp((Field_timestamp*)from); +} + static void do_skip(Copy_field *copy __attribute__((unused))) { } @@ -419,13 +426,7 @@ static void do_field_decimal(Copy_field *copy) static void do_field_timestamp(Copy_field *copy) { - DBUG_ASSERT(copy->from_field->type() == MYSQL_TYPE_TIMESTAMP); - DBUG_ASSERT(copy->to_field->type() == MYSQL_TYPE_TIMESTAMP); - ulong sec_part; - Field_timestamp *f= static_cast(copy->from_field); - Field_timestamp *t= static_cast(copy->to_field); - my_time_t ts= f->get_timestamp(&sec_part); - t->store_TIME(ts, sec_part); + copy_timestamp_fields(copy->from_field, copy->to_field); } @@ -938,6 +939,10 @@ int field_conv_incompatible(Field *to, Field *from) my_decimal buff; return to->store_decimal(from->val_decimal(&buff)); } + if (from->type() == MYSQL_TYPE_TIMESTAMP && to->type() == MYSQL_TYPE_TIMESTAMP) + { + return copy_timestamp_fields(from, to); + } if (from->cmp_type() == TIME_RESULT) { MYSQL_TIME ltime; From bc4409ab4ee3729f09151a4d7bdc6d95fdcaa3a1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 22 Sep 2017 01:12:00 +0200 Subject: [PATCH 20/23] MDEV-13868 cannot insert 1288481126 in a timestamp column in Europe/Moscow make insert NULL into a timestamp mark the field as having an explicit value. So that the field won't be assigned the value again in TABLE::update_default_field() make Item_func_now_local::save_in_field(timestamp_field) not to go through MYSQL_TIME - this conversion is lossy around DST change times. This fixes inserting a default value into a timestamp field. --- mysql-test/r/old-mode.result | 8 ++++++++ mysql-test/t/old-mode.test | 2 ++ sql/field.cc | 30 ------------------------------ sql/field.h | 3 +-- sql/item_timefunc.cc | 19 +++++++++++++++++++ sql/item_timefunc.h | 1 + 6 files changed, 31 insertions(+), 32 deletions(-) diff --git a/mysql-test/r/old-mode.result b/mysql-test/r/old-mode.result index 61987c398b97a..73ad613048aaf 100644 --- a/mysql-test/r/old-mode.result +++ b/mysql-test/r/old-mode.result @@ -132,21 +132,29 @@ set global mysql56_temporal_format=false; create table t1 (a timestamp); set timestamp=1288477526; insert t1 values (null); +insert t1 values (); set timestamp=1288481126; insert t1 values (null); +insert t1 values (); select a, unix_timestamp(a) from t1; a unix_timestamp(a) 2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288481126 2010-10-31 02:25:26 1288481126 set global mysql56_temporal_format=true; select a, unix_timestamp(a) from t1; a unix_timestamp(a) 2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288481126 2010-10-31 02:25:26 1288481126 alter table t1 modify a timestamp; select a, unix_timestamp(a) from t1; a unix_timestamp(a) 2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288481126 2010-10-31 02:25:26 1288481126 drop table t1; set global mysql56_temporal_format=false; diff --git a/mysql-test/t/old-mode.test b/mysql-test/t/old-mode.test index 3b763ae51581e..d7e8ce8ee5543 100644 --- a/mysql-test/t/old-mode.test +++ b/mysql-test/t/old-mode.test @@ -93,8 +93,10 @@ set global mysql56_temporal_format=false; create table t1 (a timestamp); set timestamp=1288477526; insert t1 values (null); +insert t1 values (); set timestamp=1288481126; insert t1 values (null); +insert t1 values (); select a, unix_timestamp(a) from t1; set global mysql56_temporal_format=true; select a, unix_timestamp(a) from t1; diff --git a/sql/field.cc b/sql/field.cc index a872fab252031..f4775ef712833 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5260,36 +5260,6 @@ int Field_timestamp::set_time() return 0; } -/** - Mark the field as having an explicit default value. - - @param value if available, the value that the field is being set to - @returns whether the explicit default bit was set - - @note - Fields that have an explicit default value should not be updated - automatically via the DEFAULT or ON UPDATE functions. The functions - that deal with data change functionality (INSERT/UPDATE/LOAD), - determine if there is an explicit value for each field before performing - the data change, and call this method to mark the field. - - For timestamp columns, the only case where a column is not marked - as been given a value are: - - It's explicitly assigned with DEFAULT - - We assign NULL to a timestamp field that is defined as NOT NULL. - This is how MySQL has worked since it's start. -*/ - -bool Field_timestamp::set_explicit_default(Item *value) -{ - if (((value->type() == Item::DEFAULT_VALUE_ITEM && - !((Item_default_value*)value)->arg) || - (!maybe_null() && value->null_value))) - return false; - set_has_explicit_value(); - return true; -} - #ifdef NOT_USED static void store_native(ulonglong num, uchar *to, uint bytes) { diff --git a/sql/field.h b/sql/field.h index 91c24327b2867..13d43201c6a83 100644 --- a/sql/field.h +++ b/sql/field.h @@ -975,7 +975,7 @@ class Field: public Value_source { return bitmap_is_set(&table->has_value_set, field_index); } - virtual bool set_explicit_default(Item *value); + bool set_explicit_default(Item *value); /** Evaluates the @c UPDATE default function, if one exists, and stores the @@ -2403,7 +2403,6 @@ class Field_timestamp :public Field_temporal { void sql_type(String &str) const; bool zero_pack() const { return 0; } int set_time(); - bool set_explicit_default(Item *value); int evaluate_update_default_function() { int res= 0; diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 6e476dfa74658..8dbd47444f2fd 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1734,6 +1734,25 @@ void Item_func_now::print(String *str, enum_query_type query_type) str->append(')'); } + +int Item_func_now_local::save_in_field(Field *field, bool no_conversions) +{ + if (field->type() == MYSQL_TYPE_TIMESTAMP) + { + THD *thd= field->get_thd(); + my_time_t ts= thd->query_start(); + uint dec= MY_MIN(decimals, field->decimals()); + ulong sec_part= dec ? thd->query_start_sec_part() : 0; + sec_part-= my_time_fraction_remainder(sec_part, dec); + field->set_notnull(); + ((Field_timestamp*)field)->store_TIME(ts, sec_part); + return 0; + } + else + return Item_temporal_func::save_in_field(field, no_conversions); +} + + /** Converts current time in my_time_t to MYSQL_TIME represenatation for local time zone. Defines time zone (local) used for whole NOW function. diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index b0a083bf24fbd..dccccc479efe5 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -748,6 +748,7 @@ class Item_func_now_local :public Item_func_now public: Item_func_now_local(THD *thd, uint dec): Item_func_now(thd, dec) {} const char *func_name() const { return "current_timestamp"; } + int save_in_field(Field *field, bool no_conversions); virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); virtual enum Functype functype() const { return NOW_FUNC; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) From a5e1f60b3167e0057e64166df06424f1fb96bec3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 21 Sep 2017 20:08:59 +0200 Subject: [PATCH 21/23] bugfix: ALTER TABLE and TIMESTAMPs around DST change time Implement a special Copy_func function for timestamps, that copies timestamps without converting them to MYSQL_TIME (the conversion is lossy around DST change time). This fixes ALTER TABLE part of main.old-mode test. This is 10.2 version of f4f48e06215 --- sql/field.h | 2 ++ sql/field_conv.cc | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/sql/field.h b/sql/field.h index 13d43201c6a83..cd65cb9c58096 100644 --- a/sql/field.h +++ b/sql/field.h @@ -699,6 +699,7 @@ class Field: public Value_source static void do_field_real(Copy_field *copy); static void do_field_string(Copy_field *copy); static void do_field_temporal(Copy_field *copy); + static void do_field_timestamp(Copy_field *copy); static void do_field_decimal(Copy_field *copy); public: static void *operator new(size_t size, MEM_ROOT *mem_root) throw () @@ -2388,6 +2389,7 @@ class Field_timestamp :public Field_temporal { TABLE_SHARE *share); enum_field_types type() const { return MYSQL_TYPE_TIMESTAMP;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; } + Copy_func *get_copy_func(const Field *from) const; int store(const char *to,uint length,CHARSET_INFO *charset); int store(double nr); int store(longlong nr, bool unsigned_val); diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 85101fd5f0a38..15df2c398a3d0 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -417,6 +417,16 @@ void Field::do_field_decimal(Copy_field *copy) } +void Field::do_field_timestamp(Copy_field *copy) +{ + Field_timestamp *f= static_cast(copy->from_field); + Field_timestamp *t= static_cast(copy->to_field); + ulong sec_part; + my_time_t ts= f->get_timestamp(&sec_part); + t->store_TIME(ts, sec_part); +} + + void Field::do_field_temporal(Copy_field *copy) { MYSQL_TIME ltime; @@ -706,6 +716,16 @@ void Copy_field::set(Field *to,Field *from,bool save) } +Field::Copy_func *Field_timestamp::get_copy_func(const Field *from) const +{ + Field::Copy_func *copy= Field_temporal::get_copy_func(from); + if (copy == do_field_temporal && from->type() == MYSQL_TYPE_TIMESTAMP) + return do_field_timestamp; + else + return copy; +} + + Field::Copy_func *Field_temporal::get_copy_func(const Field *from) const { /* If types are not 100 % identical then convert trough get_date() */ From 68d1a598bcda36d375fd295e3e65cdf8aef027f1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 21 Sep 2017 21:21:36 +0200 Subject: [PATCH 22/23] bugfix: copy timestamps correctly in INSERT...SELECT Implement Field_timestamp::save_in_field(timestamp_field) that stores timestamp values without converting them to MYSQL_TIME and back, because this conversion is lossy around DST change time. This fixes main.old-mode test. This is 10.2 version of f8a800bec81 --- sql/field.cc | 67 ++++++++++++++++++++++++++++++++++++----------- sql/field.h | 3 +++ sql/field_conv.cc | 7 ++--- 3 files changed, 57 insertions(+), 20 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index f4775ef712833..a18bb80857369 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1808,6 +1808,33 @@ int Field::store(const char *to, uint length, CHARSET_INFO *cs, } +static int timestamp_to_TIME(THD *thd, MYSQL_TIME *ltime, my_time_t ts, + ulong sec_part, ulonglong fuzzydate) +{ + thd->time_zone_used= 1; + if (ts == 0 && sec_part == 0) + { + if (fuzzydate & TIME_NO_ZERO_DATE) + return 1; + set_zero_time(ltime, MYSQL_TIMESTAMP_DATETIME); + } + else + { + thd->variables.time_zone->gmt_sec_to_TIME(ltime, ts); + ltime->second_part= sec_part; + } + return 0; +} + + +int Field::store_timestamp(my_time_t ts, ulong sec_part) +{ + MYSQL_TIME ltime; + THD *thd= get_thd(); + timestamp_to_TIME(thd, <ime, ts, sec_part, 0); + return store_time_dec(<ime, decimals()); +} + /** Pack the field into a format suitable for storage and transfer. @@ -4966,6 +4993,13 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg, } +int Field_timestamp::save_in_field(Field *to) +{ + ulong sec_part; + my_time_t ts= get_timestamp(&sec_part); + return to->store_timestamp(ts, sec_part); +} + my_time_t Field_timestamp::get_timestamp(const uchar *pos, ulong *sec_part) const { @@ -5092,6 +5126,22 @@ int Field_timestamp::store(longlong nr, bool unsigned_val) } +int Field_timestamp::store_timestamp(my_time_t ts, ulong sec_part) +{ + store_TIME(ts, sec_part); + if (ts == 0 && sec_part == 0 && + get_thd()->variables.sql_mode & TIME_NO_ZERO_DATE) + { + ErrConvString s( + STRING_WITH_LEN("0000-00-00 00:00:00.000000") - (decimals() ? 6 - decimals() : 7), + system_charset_info); + set_datetime_warning(WARN_DATA_TRUNCATED, &s, MYSQL_TIMESTAMP_DATETIME, 1); + return 1; + } + return 0; +} + + double Field_timestamp::val_real(void) { return (double) Field_timestamp::val_int(); @@ -5195,22 +5245,9 @@ Field_timestamp::validate_value_in_record(THD *thd, const uchar *record) const bool Field_timestamp::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { - THD *thd= get_thd(); - thd->time_zone_used= 1; ulong sec_part; - my_time_t temp= get_timestamp(&sec_part); - if (temp == 0 && sec_part == 0) - { /* Zero time is "000000" */ - if (fuzzydate & TIME_NO_ZERO_DATE) - return 1; - set_zero_time(ltime, MYSQL_TIMESTAMP_DATETIME); - } - else - { - thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)temp); - ltime->second_part= sec_part; - } - return 0; + my_time_t ts= get_timestamp(&sec_part); + return timestamp_to_TIME(get_thd(), ltime, ts, sec_part, fuzzydate); } diff --git a/sql/field.h b/sql/field.h index cd65cb9c58096..2167b90e26cfb 100644 --- a/sql/field.h +++ b/sql/field.h @@ -842,6 +842,7 @@ class Field: public Value_source virtual int store(longlong nr, bool unsigned_val)=0; virtual int store_decimal(const my_decimal *d)=0; virtual int store_time_dec(MYSQL_TIME *ltime, uint dec); + virtual int store_timestamp(my_time_t timestamp, ulong sec_part); int store_time(MYSQL_TIME *ltime) { return store_time_dec(ltime, TIME_SECOND_PART_DIGITS); } int store(const char *to, uint length, CHARSET_INFO *cs, @@ -2395,6 +2396,8 @@ class Field_timestamp :public Field_temporal { int store(longlong nr, bool unsigned_val); int store_time_dec(MYSQL_TIME *ltime, uint dec); int store_decimal(const my_decimal *); + int store_timestamp(my_time_t timestamp, ulong sec_part); + int save_in_field(Field *to); double val_real(void); longlong val_int(void); String *val_str(String*,String *); diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 15df2c398a3d0..c3ad0c878b552 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -419,11 +419,8 @@ void Field::do_field_decimal(Copy_field *copy) void Field::do_field_timestamp(Copy_field *copy) { - Field_timestamp *f= static_cast(copy->from_field); - Field_timestamp *t= static_cast(copy->to_field); - ulong sec_part; - my_time_t ts= f->get_timestamp(&sec_part); - t->store_TIME(ts, sec_part); + // XXX why couldn't we do it everywhere? + copy->from_field->save_in_field(copy->to_field); } From ca3c8d9b58fdc267b7c4df1ce3afde5ec6599344 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 22 Sep 2017 13:57:25 +0200 Subject: [PATCH 23/23] shut out Connect cmake-time warning about missing Findlibmondgodoc.cmake --- storage/connect/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 6dc0684353549..d422b076fc240 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -303,7 +303,7 @@ IF(CONNECT_WITH_MONGO) C:/mongo-c-driver/lib D:/mongo-c-driver/lib) ENDIF(WIN32) - FIND_PACKAGE(libmongoc-1.0 1.7) + FIND_PACKAGE(libmongoc-1.0 1.7 QUIET) IF (libmongoc-1.0_FOUND) INCLUDE_DIRECTORIES(${MONGOC_INCLUDE_DIRS}) SET(MONGOC_LIBRARY ${MONGOC_LIBRARIES})