From 578b6ba02af4ecd0468e452578cebf3a2a506216 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 14 Jan 2020 14:23:15 +0100 Subject: [PATCH 01/16] MDEV-19457: sys_vars.wsrep_provider_basic failed in buildbot If the initialization of the wsrep provider failed, in some cases the internal variable wrep_inited indicating that the initialization has already been completed is still set to "1", which then leads to confusion in the initialization status. To solve the problem, we should set this variable to "1" only if the wsrep provider initialization really completed successfully. An earlier issue has already been fixed for branch 10.4, and this patch contains a fix for earlier versions (where Galera 3.x is used). --- sql/wsrep_mysqld.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 0627127c6e0..c256467706b 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -599,7 +599,6 @@ int wsrep_init() { // enable normal operation in case no provider is specified wsrep_ready_set(TRUE); - wsrep_inited= 1; global_system_variables.wsrep_on = 0; wsrep_init_args args; args.logger_cb = wsrep_log_cb; @@ -610,10 +609,15 @@ int wsrep_init() { DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode)); WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode); + wsrep_ready_set(FALSE); wsrep->free(wsrep); free(wsrep); wsrep = NULL; } + else + { + wsrep_inited= 1; + } return rcode; } else From 982294ac1680938ac9223fb64a64e21f0cbc322a Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 14 Jan 2020 13:57:14 +0100 Subject: [PATCH 02/16] MDEV-17601: MariaDB Galera does not expect 'mbstream' as streamfmt Setting "streamfmt=mbstream" in the "[sst]" section causes SST to fail because the format automatically switches to 'tar' by default (insead of mbstream). To fix this, we need to add mbstream to the list of valid values for the format, making it synonymous with xbstream. This must be done both in the SST script and when parsing the options of the corresponding utilities. --- extra/mariabackup/CMakeLists.txt | 2 +- extra/mariabackup/innobackupex.cc | 9 +++++---- extra/mariabackup/xtrabackup.cc | 5 +++-- scripts/wsrep_sst_mariabackup.sh | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt index 9e5b8506658..edbb4e28ab2 100644 --- a/extra/mariabackup/CMakeLists.txt +++ b/extra/mariabackup/CMakeLists.txt @@ -94,7 +94,7 @@ ENDIF() ######################################################################## -# xbstream binary +# mbstream binary ######################################################################## MYSQL_ADD_EXECUTABLE(mbstream ds_buffer.c diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 5382f876f74..e3cb7fa5cde 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -600,8 +600,8 @@ static struct my_option ibx_long_options[] = {"stream", OPT_STREAM, "This option specifies the format in which to " "do the streamed backup. The option accepts a string argument. The " "backup will be done to STDOUT in the specified format. Currently, " - "the only supported formats are tar and xbstream. This option is " - "passed directly to xtrabackup's --stream option.", + "the only supported formats are tar and mbstream/xbstream. This " + "option is passed directly to xtrabackup's --stream option.", (uchar*) &ibx_xtrabackup_stream_str, (uchar*) &ibx_xtrabackup_stream_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -669,7 +669,7 @@ innobackupex [--compress] [--compress-threads=NUMBER-OF-THREADS] [--compress-chu [--include=REGEXP] [--user=NAME]\n\ [--password=WORD] [--port=PORT] [--socket=SOCKET]\n\ [--no-timestamp] [--ibbackup=IBBACKUP-BINARY]\n\ - [--slave-info] [--galera-info] [--stream=tar|xbstream]\n\ + [--slave-info] [--galera-info] [--stream=tar|mbstream|xbstream]\n\ [--defaults-file=MY.CNF] [--defaults-group=GROUP-NAME]\n\ [--databases=LIST] [--no-lock] \n\ [--tmpdir=DIRECTORY] [--tables-file=FILE]\n\ @@ -765,7 +765,8 @@ ibx_get_one_option(int optid, } break; case OPT_STREAM: - if (!strcasecmp(argument, "xbstream")) + if (!strcasecmp(argument, "mbstream") || + !strcasecmp(argument, "xbstream")) xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM; else { ibx_msg("Invalid --stream argument: %s\n", argument); diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index b9cb8a8007a..137ae021381 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -675,7 +675,7 @@ struct my_option xb_client_options[] = {"stream", OPT_XTRA_STREAM, "Stream all backup files to the standard output " "in the specified format." - "Supported format is 'xbstream'." + "Supported format is 'mbstream' or 'xbstream'." , (G_PTR*) &xtrabackup_stream_str, (G_PTR*) &xtrabackup_stream_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1398,7 +1398,8 @@ xb_get_one_option(int optid, xtrabackup_target_dir= xtrabackup_real_target_dir; break; case OPT_XTRA_STREAM: - if (!strcasecmp(argument, "xbstream")) + if (!strcasecmp(argument, "mbstream") || + !strcasecmp(argument, "xbstream")) xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM; else { diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 59d2e12817b..a2d10beee06 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -386,8 +386,8 @@ read_cnf() get_stream() { - if [[ $sfmt == 'xbstream' ]];then - wsrep_log_info "Streaming with xbstream" + if [[ $sfmt == 'mbstream' || $sfmt == 'xbstream' ]];then + wsrep_log_info "Streaming with ${sfmt}" if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then strmcmd="${XBSTREAM_BIN} -x" else From 42049f9d397b1e82d7ba5de8ac01acea537b0924 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 20 Jan 2020 14:30:13 +0100 Subject: [PATCH 03/16] cleanup: simplify install_layout.cmake --- cmake/install_layout.cmake | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index 7c3036be0a0..d1bb477c072 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -139,11 +139,10 @@ SET(INSTALL_SYSCONF2DIR_RPM "/etc/my.cnf.d") # IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(INSTALL_LIBDIR_RPM "lib64") - SET(INSTALL_PLUGINDIR_RPM "lib64/mysql/plugin") ELSE() SET(INSTALL_LIBDIR_RPM "lib") - SET(INSTALL_PLUGINDIR_RPM "lib/mysql/plugin") ENDIF() +SET(INSTALL_PLUGINDIR_RPM "${INSTALL_LIBDIR_RPM}/mysql/plugin") # SET(INSTALL_INCLUDEDIR_RPM "include/mysql") # @@ -235,17 +234,18 @@ SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "") # Set INSTALL_FOODIR variables for chosen layout (for example, INSTALL_BINDIR # will be defined as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE # layout is chosen) -FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN SYSCONF SYSCONF2 - INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA UNIX_ADDR - SYSTEMD_UNIT SYSTEMD_SYSUSERS SYSTEMD_TMPFILES) - SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}} - CACHE STRING "${var} installation directory" ${FORCE}) - MARK_AS_ADVANCED(INSTALL_${var}DIR) +GET_CMAKE_PROPERTY(ALL_VARS VARIABLES) +FOREACH (V ${ALL_VARS}) + IF (V MATCHES "^(INSTALL_([A-Z_0-9]+)DIR)_${INSTALL_LAYOUT}$") + SET(var ${CMAKE_MATCH_1}) + SET(${var} "${${V}}" CACHE STRING "${CMAKE_MATCH_2} installation directory" ${FORCE}) + MARK_AS_ADVANCED(${var}) - IF(IS_ABSOLUTE ${INSTALL_${var}DIR}) - SET(INSTALL_${var}DIRABS ${INSTALL_${var}DIR}) - ELSE() - SET(INSTALL_${var}DIRABS "${CMAKE_INSTALL_PREFIX}/${INSTALL_${var}DIR}") + IF(IS_ABSOLUTE "${${var}}") + SET(${var}ABS "${${var}}") + ELSE() + SET(${var}ABS "${CMAKE_INSTALL_PREFIX}/${${var}}") + ENDIF() ENDIF() ENDFOREACH() From 8870f18e1df8774b76c30792f6c7bf04230f2a58 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 20 Jan 2020 15:10:39 +0100 Subject: [PATCH 04/16] MDEV-17292 Package the pam_user_map module --- cmake/cpack_rpm.cmake | 3 +++ cmake/install_layout.cmake | 6 ++++++ debian/mariadb-server-10.2.install | 2 ++ plugin/auth_pam/CMakeLists.txt | 10 ++++++++++ plugin/auth_pam/mapper/user_map.conf | 13 +++++++++++++ 5 files changed, 34 insertions(+) create mode 100644 plugin/auth_pam/mapper/user_map.conf diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 82fadd6b689..8a2313cd20c 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -100,8 +100,11 @@ SET(ignored "%ignore /etc" "%ignore /etc/init.d" "%ignore /etc/logrotate.d" + "%ignore /etc/security" "%ignore /etc/systemd" "%ignore /etc/systemd/system" + "%ignore /lib" + "%ignore /lib/security" "%ignore ${CMAKE_INSTALL_PREFIX}" "%ignore ${CMAKE_INSTALL_PREFIX}/bin" "%ignore ${CMAKE_INSTALL_PREFIX}/include" diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index d1bb477c072..57c57992f18 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -163,6 +163,7 @@ SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock" SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system") SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d") SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d") +SET(INSTALL_PAMDIR_RPM "/lib/security") # # DEB layout @@ -195,6 +196,11 @@ SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock") SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system") SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d") SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d") +IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(INSTALL_PAMDIR_DEB "/lib/x86_64-linux-gnu/security") +ELSE() + SET(INSTALL_PAMDIR_DEB "/lib/i386-linux-gnu/security") +ENDIF() # # SVR4 layout diff --git a/debian/mariadb-server-10.2.install b/debian/mariadb-server-10.2.install index 1ac1c67472c..d35fdf87b94 100644 --- a/debian/mariadb-server-10.2.install +++ b/debian/mariadb-server-10.2.install @@ -3,7 +3,9 @@ debian/additions/debian-start.inc.sh usr/share/mysql debian/additions/echo_stderr usr/share/mysql debian/additions/mysqld_safe_syslog.cnf etc/mysql/conf.d etc/apparmor.d/usr.sbin.mysqld +etc/security/user_map.conf lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf +lib/*/security/pam_user_map.so usr/bin/aria_chk usr/bin/aria_dump_log usr/bin/aria_ftdump diff --git a/plugin/auth_pam/CMakeLists.txt b/plugin/auth_pam/CMakeLists.txt index 606fef002e7..0efb0b07feb 100644 --- a/plugin/auth_pam/CMakeLists.txt +++ b/plugin/auth_pam/CMakeLists.txt @@ -10,5 +10,15 @@ IF(HAVE_PAM_APPL_H) ENDIF(HAVE_STRNDUP) FIND_LIBRARY(PAM_LIBRARY pam) MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam MODULE_ONLY) + + IF(TARGET auth_pam) + ADD_LIBRARY(pam_user_map MODULE mapper/pam_user_map.c) + TARGET_LINK_LIBRARIES(pam_user_map pam) + SET_TARGET_PROPERTIES (pam_user_map PROPERTIES PREFIX "") + IF(INSTALL_PAMDIR) + INSTALL(TARGETS pam_user_map DESTINATION ${INSTALL_PAMDIR} COMPONENT Server) + INSTALL(FILES mapper/user_map.conf DESTINATION /etc/security COMPONENT Server) + ENDIF() + ENDIF() ENDIF(HAVE_PAM_APPL_H) diff --git a/plugin/auth_pam/mapper/user_map.conf b/plugin/auth_pam/mapper/user_map.conf new file mode 100644 index 00000000000..4af8fb0fe10 --- /dev/null +++ b/plugin/auth_pam/mapper/user_map.conf @@ -0,0 +1,13 @@ +# +# Configuration file for pam_user_map.so +# +# defines mapping in the form +# +# orig_user_name: mapped_user_name +# +# or (to map all users in a specific group) +# +# @group_name: mapped_user_name +# +# comments and empty lines are ignored +# From 10a5e1eccb9cfe7b86436254c958b2b40a246b52 Mon Sep 17 00:00:00 2001 From: Alice Sherepa Date: Thu, 16 Jan 2020 23:37:15 +0100 Subject: [PATCH 05/16] MDEV-21360 save/restore debud_dbug instead of total reset at the end of the test --- .../extra/binlog_tests/binlog_index.inc | 4 +- mysql-test/extra/rpl_tests/rpl_corruption.inc | 7 +-- mysql-test/extra/rpl_tests/rpl_parallel.inc | 21 ++++----- .../rpl_tests/rpl_stop_middle_group.test | 4 +- mysql-test/suite/binlog/r/binlog_index.result | 3 +- .../binlog_encryption/binlog_index.result | 3 +- .../binlog_encryption/rpl_corruption.result | 6 +-- .../binlog_encryption/rpl_parallel.result | 19 ++++---- .../rpl_parallel_ignored_errors.result | 2 +- .../innodb_fts/r/concurrent_insert.result | 2 +- .../suite/innodb_fts/r/sync_block.result | 4 +- .../suite/innodb_fts/t/concurrent_insert.test | 2 +- mysql-test/suite/innodb_fts/t/sync_block.test | 4 +- .../include/rpl_parallel_ignored_errors.inc | 2 +- .../suite/rpl/r/circular_serverid0.result | 2 +- mysql-test/suite/rpl/r/rpl_corruption.result | 6 +-- .../r/rpl_domain_id_filter_io_crash.result | 2 + .../rpl_domain_id_filter_master_crash.result | 1 - .../suite/rpl/r/rpl_gtid_reconnect.result | 2 +- .../rpl/r/rpl_mariadb_slave_capability.result | 6 +-- mysql-test/suite/rpl/r/rpl_parallel.result | 19 ++++---- .../rpl/r/rpl_parallel_ignored_errors.result | 2 +- .../rpl/r/rpl_parallel_optimistic.result | 2 +- .../rpl/r/rpl_stm_stop_middle_group.result | 3 +- .../suite/rpl/t/circular_serverid0.test | 3 +- .../rpl/t/rpl_domain_id_filter_io_crash.test | 3 +- .../t/rpl_domain_id_filter_master_crash.test | 1 - .../suite/rpl/t/rpl_gtid_reconnect.test | 2 +- .../rpl/t/rpl_mariadb_slave_capability.test | 8 ++-- .../suite/rpl/t/rpl_parallel_optimistic.test | 2 +- .../suite/rpl/t/rpl_stm_lcase_tblnames.test | 2 +- .../suite/sys_vars/r/debug_dbug_func.result | 44 +++++++++---------- .../suite/sys_vars/t/debug_dbug_func.test | 30 ++++++------- 33 files changed, 110 insertions(+), 113 deletions(-) diff --git a/mysql-test/extra/binlog_tests/binlog_index.inc b/mysql-test/extra/binlog_tests/binlog_index.inc index 50215aef9a9..47adcb8df7a 100644 --- a/mysql-test/extra/binlog_tests/binlog_index.inc +++ b/mysql-test/extra/binlog_tests/binlog_index.inc @@ -22,7 +22,7 @@ call mtr.add_suppression('Could not open .*'); call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); flush tables; -let $old=`select @@debug`; +SET @saved_dbug = @@SESSION.debug_dbug; RESET MASTER; @@ -273,6 +273,6 @@ SELECT @index; -- replace_regex /\.[\\\/]master/master/ SELECT @index; -eval SET SESSION debug_dbug="$old"; +SET @@SESSION.debug_dbug = @saved_dbug; --echo End of tests diff --git a/mysql-test/extra/rpl_tests/rpl_corruption.inc b/mysql-test/extra/rpl_tests/rpl_corruption.inc index 88f683ed53d..c97b3b35766 100644 --- a/mysql-test/extra/rpl_tests/rpl_corruption.inc +++ b/mysql-test/extra/rpl_tests/rpl_corruption.inc @@ -74,6 +74,7 @@ while ($i) { # Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing --echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS set @saved_dbug = @@global.debug_dbug; + SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; --echo SHOW BINLOG EVENTS; --disable_query_log @@ -131,12 +132,13 @@ let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_R --source include/wait_for_slave_io_error.inc --connection master SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -SET GLOBAL debug_dbug= ""; +SET GLOBAL debug_dbug=@saved_dbug; SET GLOBAL master_verify_checksum=1; # Emulate corruption in network --echo # 5. Slave. Corruption in network --connection slave +SET @saved_dbug_slave = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="+d,corrupt_queue_event"; START SLAVE IO_THREAD; let $slave_io_errno= 1595,1743; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE @@ -153,7 +155,7 @@ let $slave_sql_errno= 1593; --source include/wait_for_slave_sql_error.inc SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; -SET GLOBAL debug_dbug= ""; +SET GLOBAL debug_dbug=@saved_dbug_slave; # Start normal replication and compare same table on master # and slave @@ -172,6 +174,5 @@ set @@global.debug_dbug = @saved_dbug; SET GLOBAL master_verify_checksum = @old_master_verify_checksum; DROP TABLE t1; --sync_slave_with_master -set @@global.debug_dbug = @saved_dbug; --source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_parallel.inc b/mysql-test/extra/rpl_tests/rpl_parallel.inc index 42354343084..e2dbb7c3f18 100644 --- a/mysql-test/extra/rpl_tests/rpl_parallel.inc +++ b/mysql-test/extra/rpl_tests/rpl_parallel.inc @@ -1651,7 +1651,6 @@ SELECT * FROM t2 WHERE a >= 40 ORDER BY a; --sync_with_master SELECT * FROM t2 WHERE a >= 40 ORDER BY a; --source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; SET DEBUG_SYNC= 'RESET'; SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=10; @@ -1951,7 +1950,6 @@ SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; --source include/stop_slave.inc SET GLOBAL debug_dbug=@old_dbug; - --echo *** MDEV-6676 - test disabling domain-based parallel replication *** --connection server_1 # Let's do a bunch of transactions that will conflict if run out-of-order in @@ -2000,7 +1998,7 @@ SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; # so sleep is ok here. And it's in general not possible to trigger reliably # the race with debug_sync, since the bugfix makes the race impossible). -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; # Group commit with cid=10000, two event groups. @@ -2012,7 +2010,7 @@ INSERT INTO t3 VALUES (120, 0); SET @commit_id= 10001; INSERT INTO t3 VALUES (121, 0); -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a >= 120 ORDER BY a; --source include/save_master_gtid.inc @@ -2044,7 +2042,7 @@ SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep'; # We inject a small sleep in the corresponding record_gtid() to make the race # easier to hit. -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; # Group commit with cid=10010, two event groups. @@ -2059,8 +2057,7 @@ INSERT INTO t3 VALUES (130, 0); SET @commit_id= 10011; INSERT INTO t3 VALUES (131, 0); -SET SESSION debug_dbug=@old_dbug; - +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a >= 130 ORDER BY a; --source include/save_master_gtid.inc @@ -2097,7 +2094,7 @@ SET GLOBAL debug_dbug= '+d,inject_mdev8031'; # complete. Finally an extra KILL check catches an unhandled, lingering # deadlock kill. So rather artificial, but at least it exercises the # relevant code paths. -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; SET @commit_id= 10200; @@ -2119,7 +2116,7 @@ UPDATE t3 SET b=b+1 WHERE a=204; UPDATE t3 SET b=b+1 WHERE a=203; UPDATE t3 SET b=b+1 WHERE a=205; UPDATE t3 SET b=b+1 WHERE a=205; -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a>=200 ORDER BY a; --source include/save_master_gtid.inc @@ -2144,7 +2141,7 @@ SET @old_max= @@GLOBAL.max_relay_log_size; SET GLOBAL max_relay_log_size= 4096; --connection server_1 -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; --let $large= `SELECT REPEAT("*", 8192)` @@ -2167,7 +2164,7 @@ eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; --enable_query_log -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a>=200 ORDER BY a; --source include/save_master_gtid.inc @@ -2178,7 +2175,7 @@ SELECT * FROM t3 WHERE a>=200 ORDER BY a; SELECT * FROM t3 WHERE a>=200 ORDER BY a; --source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_debg; +SET GLOBAL debug_dbug= @old_dbug; SET GLOBAL max_relay_log_size= @old_max; --source include/start_slave.inc diff --git a/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test index 43c561c5b85..5c88c14d9b5 100644 --- a/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test +++ b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test @@ -13,6 +13,7 @@ create table tm (a int auto_increment primary key) engine=myisam; create table ti (a int auto_increment primary key) engine=innodb; sync_slave_with_master; +SET @saved_dbug = @@GLOBAL.debug_dbug; set @@global.debug_dbug="+d,stop_slave_middle_group"; connection master; @@ -135,8 +136,7 @@ eval SELECT "$error" AS Last_SQL_Error, @check as `true`; select max(a) as two from tm; select max(a) as one from ti; -set @@global.debug_dbug="-d"; - +SET @@GLOBAL.debug_dbug = @saved_dbug; # # clean-up # diff --git a/mysql-test/suite/binlog/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result index bb5d9ff74f1..1f3428e6eef 100644 --- a/mysql-test/suite/binlog/r/binlog_index.result +++ b/mysql-test/suite/binlog/r/binlog_index.result @@ -5,6 +5,7 @@ call mtr.add_suppression('Turning logging off for the whole duration of the MySQ call mtr.add_suppression('Could not open .*'); call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); flush tables; +SET @saved_dbug = @@SESSION.debug_dbug; RESET MASTER; flush logs; flush logs; @@ -183,5 +184,5 @@ master-bin.000011 master-bin.000012 master-bin.000013 -SET SESSION debug_dbug=""; +SET @@SESSION.debug_dbug = @saved_dbug; End of tests diff --git a/mysql-test/suite/binlog_encryption/binlog_index.result b/mysql-test/suite/binlog_encryption/binlog_index.result index bb5d9ff74f1..1f3428e6eef 100644 --- a/mysql-test/suite/binlog_encryption/binlog_index.result +++ b/mysql-test/suite/binlog_encryption/binlog_index.result @@ -5,6 +5,7 @@ call mtr.add_suppression('Turning logging off for the whole duration of the MySQ call mtr.add_suppression('Could not open .*'); call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); flush tables; +SET @saved_dbug = @@SESSION.debug_dbug; RESET MASTER; flush logs; flush logs; @@ -183,5 +184,5 @@ master-bin.000011 master-bin.000012 master-bin.000013 -SET SESSION debug_dbug=""; +SET @@SESSION.debug_dbug = @saved_dbug; End of tests diff --git a/mysql-test/suite/binlog_encryption/rpl_corruption.result b/mysql-test/suite/binlog_encryption/rpl_corruption.result index db72bb304fc..f32b7c58ad1 100644 --- a/mysql-test/suite/binlog_encryption/rpl_corruption.result +++ b/mysql-test/suite/binlog_encryption/rpl_corruption.result @@ -34,10 +34,11 @@ START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1595,1743] connection master; SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -SET GLOBAL debug_dbug= ""; +SET GLOBAL debug_dbug=@saved_dbug; SET GLOBAL master_verify_checksum=1; # 5. Slave. Corruption in network connection slave; +SET @saved_dbug_slave = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="+d,corrupt_queue_event"; START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1595,1743] @@ -47,7 +48,7 @@ SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; START SLAVE SQL_THREAD; include/wait_for_slave_sql_error.inc [errno=1593] SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; -SET GLOBAL debug_dbug= ""; +SET GLOBAL debug_dbug=@saved_dbug_slave; # 7. Seek diff for tables on master and slave connection slave; include/start_slave.inc @@ -60,5 +61,4 @@ set @@global.debug_dbug = @saved_dbug; SET GLOBAL master_verify_checksum = @old_master_verify_checksum; DROP TABLE t1; connection slave; -set @@global.debug_dbug = @saved_dbug; include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel.result b/mysql-test/suite/binlog_encryption/rpl_parallel.result index 20f3facea27..20d7687ec3f 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel.result +++ b/mysql-test/suite/binlog_encryption/rpl_parallel.result @@ -1227,7 +1227,6 @@ a 45 46 include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; SET DEBUG_SYNC= 'RESET'; SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=10; @@ -1513,7 +1512,7 @@ SET GLOBAL slave_parallel_threads=10; SET @old_dbug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; connection server_1; -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; SET @commit_id= 10000; ANALYZE TABLE t2; @@ -1522,7 +1521,7 @@ test.t2 analyze status OK INSERT INTO t3 VALUES (120, 0); SET @commit_id= 10001; INSERT INTO t3 VALUES (121, 0); -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a >= 120 ORDER BY a; a b 120 0 @@ -1544,7 +1543,7 @@ include/stop_slave.inc SET @old_dbug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep'; connection server_1; -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; SET @old_server_id= @@SESSION.server_id; SET SESSION server_id= 100; @@ -1554,7 +1553,7 @@ SET SESSION server_id= @old_server_id; INSERT INTO t3 VALUES (130, 0); SET @commit_id= 10011; INSERT INTO t3 VALUES (131, 0); -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a >= 130 ORDER BY a; a b 130 0 @@ -1580,7 +1579,7 @@ include/stop_slave.inc SET @old_dbug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,inject_mdev8031'; connection server_1; -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; SET @commit_id= 10200; INSERT INTO t3 VALUES (203, 1); @@ -1601,7 +1600,7 @@ UPDATE t3 SET b=b+1 WHERE a=204; UPDATE t3 SET b=b+1 WHERE a=203; UPDATE t3 SET b=b+1 WHERE a=205; UPDATE t3 SET b=b+1 WHERE a=205; -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a>=200 ORDER BY a; a b 201 3 @@ -1631,11 +1630,11 @@ SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill'; SET @old_max= @@GLOBAL.max_relay_log_size; SET GLOBAL max_relay_log_size= 4096; connection server_1; -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; SET @commit_id= 10210; Omit long queries that cause relaylog rotations and transaction retries... -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a>=200 ORDER BY a; a b 201 6 @@ -1655,7 +1654,7 @@ a b 204 7 205 5 include/stop_slave.inc -SET GLOBAL debug_dbug= @old_debg; +SET GLOBAL debug_dbug= @old_dbug; SET GLOBAL max_relay_log_size= @old_max; include/start_slave.inc *** MDEV-8725: Assertion on ROLLBACK statement in the binary log *** diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result b/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result index 570d2534ed7..3dd5a3ea83c 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_ignored_errors.result @@ -4,7 +4,7 @@ connection server_2; include/stop_slave.inc SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; -SET @old_dbug= @@GLOBAL.debug_dbug; +SET @old_debug= @@GLOBAL.debug_dbug; SET GLOBAL slave_parallel_mode='optimistic'; SET GLOBAL slave_parallel_threads= 3; CHANGE MASTER TO master_use_gtid=slave_pos; diff --git a/mysql-test/suite/innodb_fts/r/concurrent_insert.result b/mysql-test/suite/innodb_fts/r/concurrent_insert.result index 9be7ba35f30..e91ea02b1de 100644 --- a/mysql-test/suite/innodb_fts/r/concurrent_insert.result +++ b/mysql-test/suite/innodb_fts/r/concurrent_insert.result @@ -29,7 +29,7 @@ ALTER TABLE t2 drop index idx1; connection default; set DEBUG_SYNC= 'now SIGNAL fts_drop_index'; connection con1; -SET @@GLOBAL.debug_dbug = @saved_dbug; drop table t1, t2; connection default; set DEBUG_SYNC=RESET; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/innodb_fts/r/sync_block.result b/mysql-test/suite/innodb_fts/r/sync_block.result index f9f695c42f4..65bee127e80 100644 --- a/mysql-test/suite/innodb_fts/r/sync_block.result +++ b/mysql-test/suite/innodb_fts/r/sync_block.result @@ -39,7 +39,7 @@ SLEEP(2) SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02'; sql_text INSERT INTO t1(title) VALUES('mysql database') -SET GLOBAL debug_dbug = @old_debug_dbug; +SET GLOBAL debug_dbug = @old_debug; TRUNCATE TABLE mysql.slow_log; DROP TABLE t1; # Case 2: Sync blocks DML(insert) on other tables. @@ -71,7 +71,7 @@ SLEEP(2) # slow log results should be empty here. SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02'; sql_text -SET GLOBAL debug_dbug = @old_debug_dbug; +SET GLOBAL debug_dbug = @old_debug; TRUNCATE TABLE mysql.slow_log; DROP TABLE t1,t2; disconnect con1; diff --git a/mysql-test/suite/innodb_fts/t/concurrent_insert.test b/mysql-test/suite/innodb_fts/t/concurrent_insert.test index 1505767d835..35debd87cea 100644 --- a/mysql-test/suite/innodb_fts/t/concurrent_insert.test +++ b/mysql-test/suite/innodb_fts/t/concurrent_insert.test @@ -46,7 +46,7 @@ set DEBUG_SYNC= 'now SIGNAL fts_drop_index'; connection con1; reap; -SET @@GLOBAL.debug_dbug = @saved_dbug; drop table t1, t2; connection default; set DEBUG_SYNC=RESET; +SET @@GLOBAL.debug_dbug = @saved_dbug; diff --git a/mysql-test/suite/innodb_fts/t/sync_block.test b/mysql-test/suite/innodb_fts/t/sync_block.test index 1dd3c2bc38e..895d2ba8a59 100644 --- a/mysql-test/suite/innodb_fts/t/sync_block.test +++ b/mysql-test/suite/innodb_fts/t/sync_block.test @@ -61,7 +61,7 @@ SELECT SLEEP(2); -- echo # slow log results should only contain INSERT INTO t1. SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02'; -SET GLOBAL debug_dbug = @old_debug_dbug; +SET GLOBAL debug_dbug = @old_debug; TRUNCATE TABLE mysql.slow_log; DROP TABLE t1; @@ -107,7 +107,7 @@ SELECT SLEEP(2); -- echo # slow log results should be empty here. SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02'; -SET GLOBAL debug_dbug = @old_debug_dbug; +SET GLOBAL debug_dbug = @old_debug; TRUNCATE TABLE mysql.slow_log; DROP TABLE t1,t2; diff --git a/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc b/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc index 25da12f30a3..7a6a758a508 100644 --- a/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc +++ b/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc @@ -47,7 +47,7 @@ --source include/stop_slave.inc SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; -SET @old_dbug= @@GLOBAL.debug_dbug; +SET @old_debug= @@GLOBAL.debug_dbug; SET GLOBAL slave_parallel_mode='optimistic'; SET GLOBAL slave_parallel_threads= 3; CHANGE MASTER TO master_use_gtid=slave_pos; diff --git a/mysql-test/suite/rpl/r/circular_serverid0.result b/mysql-test/suite/rpl/r/circular_serverid0.result index 112f9359ac4..928a0a48888 100644 --- a/mysql-test/suite/rpl/r/circular_serverid0.result +++ b/mysql-test/suite/rpl/r/circular_serverid0.result @@ -1,9 +1,9 @@ include/rpl_init.inc [topology=1->2->1] include/rpl_connect.inc [creating M4] include/rpl_connect.inc [creating M2] -SET @old_debug= @@global.debug; connection M2; STOP SLAVE; +SET @old_debug= @@global.debug; SET GLOBAL debug_dbug= "+d,dbug.rows_events_to_delay_relay_logging"; START SLAVE IO_THREAD; include/wait_for_slave_io_to_start.inc diff --git a/mysql-test/suite/rpl/r/rpl_corruption.result b/mysql-test/suite/rpl/r/rpl_corruption.result index db72bb304fc..f32b7c58ad1 100644 --- a/mysql-test/suite/rpl/r/rpl_corruption.result +++ b/mysql-test/suite/rpl/r/rpl_corruption.result @@ -34,10 +34,11 @@ START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1595,1743] connection master; SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -SET GLOBAL debug_dbug= ""; +SET GLOBAL debug_dbug=@saved_dbug; SET GLOBAL master_verify_checksum=1; # 5. Slave. Corruption in network connection slave; +SET @saved_dbug_slave = @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="+d,corrupt_queue_event"; START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1595,1743] @@ -47,7 +48,7 @@ SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; START SLAVE SQL_THREAD; include/wait_for_slave_sql_error.inc [errno=1593] SET GLOBAL debug_dbug="-d,corrupt_read_log_event_char"; -SET GLOBAL debug_dbug= ""; +SET GLOBAL debug_dbug=@saved_dbug_slave; # 7. Seek diff for tables on master and slave connection slave; include/start_slave.inc @@ -60,5 +61,4 @@ set @@global.debug_dbug = @saved_dbug; SET GLOBAL master_verify_checksum = @old_master_verify_checksum; DROP TABLE t1; connection slave; -set @@global.debug_dbug = @saved_dbug; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result index a2b1d03c4fd..b8415977154 100644 --- a/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result +++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter_io_crash.result @@ -26,6 +26,7 @@ CHANGE MASTER TO IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos; include/start_slave.inc DO_DOMAIN_IDS (AFTER) : IGNORE_DOMAIN_IDS (AFTER) : +SET @saved_dbug = @@GLOBAL.debug_dbug; SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; connection master; START TRANSACTION; @@ -414,4 +415,5 @@ connection slave; include/stop_slave.inc CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(); include/start_slave.inc +SET @@GLOBAL.debug_dbug = @saved_dbug; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result index 457947cabe0..0a414cb3b1f 100644 --- a/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result +++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter_master_crash.result @@ -37,7 +37,6 @@ IGNORE_DOMAIN_IDS (AFTER) : 1 connection master; include/rpl_start_server.inc [server_number=1] # Master has restarted successfully -set @@global.debug_dbug="-d"; connection slave; include/stop_slave.inc include/start_slave.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result b/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result index d5037f8cf94..4f50d7c6d85 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result @@ -27,7 +27,7 @@ a connection server_1; include/kill_binlog_dump_threads.inc INSERT INTO t1 VALUES (10); -SET @old_dbug= @@GLOBAL.debug_dbug; +SET @old_debug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output"; SET GLOBAL debug_dbug="+d,gtid_force_reconnect_at_10_1_100"; connection server_2; diff --git a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result index b96153a226a..d384422f88a 100644 --- a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result +++ b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result @@ -2,10 +2,10 @@ include/master-slave.inc [connection master] connection master; set @old_master_binlog_checksum= @@global.binlog_checksum; -set @old_slave_dbug= @@global.debug_dbug; connection slave; include/stop_slave.inc # Test slave with no capability gets dummy event, which is ignored. +set @old_dbug= @@global.debug_dbug; SET @@global.debug_dbug='+d,simulate_slave_capability_none'; include/start_slave.inc connection master; @@ -50,7 +50,7 @@ slave-relay-bin.000005 # Annotate_rows # # INSERT INTO t1 /* A comment just to m slave-relay-bin.000005 # Table_map # # table_id: # (test.t1) slave-relay-bin.000005 # Write_rows_v1 # # table_id: # flags: STMT_END_F slave-relay-bin.000005 # Query # # COMMIT -set @@global.debug_dbug= @old_slave_dbug; +set @@global.debug_dbug= @old_dbug; # Test dummy event is checksummed correctly. connection master; set @@global.binlog_checksum = CRC32; @@ -148,10 +148,10 @@ select @@global.log_slave_updates; select @@global.replicate_annotate_row_events; @@global.replicate_annotate_row_events 1 -set @@global.debug_dbug= @old_slave_dbug; Clean up. connection master; set @@global.binlog_checksum = @old_master_binlog_checksum; DROP TABLE t1, t2; connection slave; +set @@global.debug_dbug= @old_dbug; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result index d994e4fdef6..e1dbc15d3b9 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel.result +++ b/mysql-test/suite/rpl/r/rpl_parallel.result @@ -1226,7 +1226,6 @@ a 45 46 include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; SET DEBUG_SYNC= 'RESET'; SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=10; @@ -1512,7 +1511,7 @@ SET GLOBAL slave_parallel_threads=10; SET @old_dbug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; connection server_1; -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; SET @commit_id= 10000; ANALYZE TABLE t2; @@ -1521,7 +1520,7 @@ test.t2 analyze status OK INSERT INTO t3 VALUES (120, 0); SET @commit_id= 10001; INSERT INTO t3 VALUES (121, 0); -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a >= 120 ORDER BY a; a b 120 0 @@ -1543,7 +1542,7 @@ include/stop_slave.inc SET @old_dbug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep'; connection server_1; -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; SET @old_server_id= @@SESSION.server_id; SET SESSION server_id= 100; @@ -1553,7 +1552,7 @@ SET SESSION server_id= @old_server_id; INSERT INTO t3 VALUES (130, 0); SET @commit_id= 10011; INSERT INTO t3 VALUES (131, 0); -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a >= 130 ORDER BY a; a b 130 0 @@ -1579,7 +1578,7 @@ include/stop_slave.inc SET @old_dbug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,inject_mdev8031'; connection server_1; -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; SET @commit_id= 10200; INSERT INTO t3 VALUES (203, 1); @@ -1600,7 +1599,7 @@ UPDATE t3 SET b=b+1 WHERE a=204; UPDATE t3 SET b=b+1 WHERE a=203; UPDATE t3 SET b=b+1 WHERE a=205; UPDATE t3 SET b=b+1 WHERE a=205; -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a>=200 ORDER BY a; a b 201 3 @@ -1630,11 +1629,11 @@ SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill'; SET @old_max= @@GLOBAL.max_relay_log_size; SET GLOBAL max_relay_log_size= 4096; connection server_1; -SET @old_dbug= @@SESSION.debug_dbug; +SET @old_dbug_slave= @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,binlog_force_commit_id"; SET @commit_id= 10210; Omit long queries that cause relaylog rotations and transaction retries... -SET SESSION debug_dbug=@old_dbug; +SET SESSION debug_dbug=@old_dbug_slave; SELECT * FROM t3 WHERE a>=200 ORDER BY a; a b 201 6 @@ -1654,7 +1653,7 @@ a b 204 7 205 5 include/stop_slave.inc -SET GLOBAL debug_dbug= @old_debg; +SET GLOBAL debug_dbug= @old_dbug; SET GLOBAL max_relay_log_size= @old_max; include/start_slave.inc *** MDEV-8725: Assertion on ROLLBACK statement in the binary log *** diff --git a/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result b/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result index 570d2534ed7..3dd5a3ea83c 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result @@ -4,7 +4,7 @@ connection server_2; include/stop_slave.inc SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; -SET @old_dbug= @@GLOBAL.debug_dbug; +SET @old_debug= @@GLOBAL.debug_dbug; SET GLOBAL slave_parallel_mode='optimistic'; SET GLOBAL slave_parallel_threads= 3; CHANGE MASTER TO master_use_gtid=slave_pos; diff --git a/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result b/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result index 5d514d23101..862851c7a49 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result @@ -352,7 +352,7 @@ include/save_master_gtid.inc connection server_2; include/sync_with_master_gtid.inc include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; +SET @old_debug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; connection server_1; ALTER TABLE t2 COMMENT "123abc"; diff --git a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result index f08f50f2467..b670a16bfcd 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result +++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result @@ -6,6 +6,7 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state create table tm (a int auto_increment primary key) engine=myisam; create table ti (a int auto_increment primary key) engine=innodb; connection slave; +SET @saved_dbug = @@GLOBAL.debug_dbug; set @@global.debug_dbug="+d,stop_slave_middle_group"; connection master; begin; @@ -74,7 +75,7 @@ two select max(a) as one from ti; one 1 -set @@global.debug_dbug="-d"; +SET @@GLOBAL.debug_dbug = @saved_dbug; include/rpl_reset.inc connection master; drop table tm, ti; diff --git a/mysql-test/suite/rpl/t/circular_serverid0.test b/mysql-test/suite/rpl/t/circular_serverid0.test index 20ad58e2c52..097a2932404 100644 --- a/mysql-test/suite/rpl/t/circular_serverid0.test +++ b/mysql-test/suite/rpl/t/circular_serverid0.test @@ -22,10 +22,9 @@ # The parameter reflects binlog-row-event-max-size @cnf. --let $row_size=1024 -SET @old_debug= @@global.debug; - --connection M2 STOP SLAVE; +SET @old_debug= @@global.debug; SET GLOBAL debug_dbug= "+d,dbug.rows_events_to_delay_relay_logging"; START SLAVE IO_THREAD; --source include/wait_for_slave_io_to_start.inc diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test index 9088866d28b..f3ba39fb330 100644 --- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test +++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_io_crash.test @@ -35,6 +35,7 @@ let $ignore_domain_ids_after= query_get_value(SHOW SLAVE STATUS, Replicate_Ignor --echo DO_DOMAIN_IDS (AFTER) : $do_domain_ids_after --echo IGNORE_DOMAIN_IDS (AFTER) : $ignore_domain_ids_after +SET @saved_dbug = @@GLOBAL.debug_dbug; SET @@global.debug_dbug="+d,kill_slave_io_before_commit"; connection master; @@ -379,5 +380,5 @@ connection slave; --source include/stop_slave.inc CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(); --source include/start_slave.inc - +SET @@GLOBAL.debug_dbug = @saved_dbug; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test index 3619ede2c01..6dafab192a0 100644 --- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test +++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test @@ -64,7 +64,6 @@ connection master; #--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --echo # Master has restarted successfully -set @@global.debug_dbug="-d"; save_master_pos; --connection slave diff --git a/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test b/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test index 22cf10afba3..bc28ebddf5e 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test @@ -42,7 +42,7 @@ SELECT * FROM t1 ORDER BY a; # interfere with our DBUG error injection. --source include/kill_binlog_dump_threads.inc INSERT INTO t1 VALUES (10); -SET @old_dbug= @@GLOBAL.debug_dbug; +SET @old_debug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output"; SET GLOBAL debug_dbug="+d,gtid_force_reconnect_at_10_1_100"; --save_master_pos 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 ed26e61d9b6..046a65f77db 100644 --- a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test +++ b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test @@ -5,9 +5,7 @@ --source include/master-slave.inc connection master; - set @old_master_binlog_checksum= @@global.binlog_checksum; -set @old_slave_dbug= @@global.debug_dbug; # MDEV-4475: Cannot replicate to old server when binlog contains # empty Gtid_list event @@ -16,6 +14,7 @@ set @old_slave_dbug= @@global.debug_dbug; connection slave; --source include/stop_slave.inc --echo # Test slave with no capability gets dummy event, which is ignored. +set @old_dbug= @@global.debug_dbug; SET @@global.debug_dbug='+d,simulate_slave_capability_none'; --source include/start_slave.inc @@ -52,7 +51,7 @@ let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); let $binlog_start= $relaylog_start; let $binlog_limit=0,10; --source include/show_relaylog_events.inc -set @@global.debug_dbug= @old_slave_dbug; +set @@global.debug_dbug= @old_dbug; --echo # Test dummy event is checksummed correctly. @@ -150,11 +149,10 @@ let $binlog_limit=0,5; select @@global.log_slave_updates; select @@global.replicate_annotate_row_events; -set @@global.debug_dbug= @old_slave_dbug; - --echo Clean up. connection master; set @@global.binlog_checksum = @old_master_binlog_checksum; DROP TABLE t1, t2; sync_slave_with_master; +set @@global.debug_dbug= @old_dbug; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test index eef11be1f1b..ebf6eff2cc4 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test @@ -325,7 +325,7 @@ INSERT INTO t2 VALUES (1,1), (2,1), (3,1), (4,1), (5,1); --connection server_2 --source include/sync_with_master_gtid.inc --source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; +SET @old_debug= @@GLOBAL.debug_dbug; SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; --connection server_1 diff --git a/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test b/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test index 00df8e9d385..caaae06a8e9 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test +++ b/mysql-test/suite/rpl/t/rpl_stm_lcase_tblnames.test @@ -3,10 +3,10 @@ # For details look into extra/rpl_tests/rpl_lower_case_table_names.test # +-- source include/have_binlog_format_mixed_or_statement.inc -- source include/master-slave.inc -- source include/have_innodb.inc -- source include/not_windows.inc --- source include/have_binlog_format_mixed_or_statement.inc -- let $engine=InnoDB -- source extra/rpl_tests/rpl_lower_case_table_names.test diff --git a/mysql-test/suite/sys_vars/r/debug_dbug_func.result b/mysql-test/suite/sys_vars/r/debug_dbug_func.result index 64b9c1a759b..d0c002cf111 100644 --- a/mysql-test/suite/sys_vars/r/debug_dbug_func.result +++ b/mysql-test/suite/sys_vars/r/debug_dbug_func.result @@ -1,55 +1,55 @@ -SET @old_debug = @@GLOBAL.debug; +SET @old_debug = @@GLOBAL.debug_dbug; SET debug_dbug= 'T'; -select @@debug; -@@debug +select @@debug_dbug; +@@debug_dbug T SET debug_dbug= '+P'; -select @@debug; -@@debug +select @@debug_dbug; +@@debug_dbug P:T SET debug_dbug= '-P'; -select @@debug; -@@debug +select @@debug_dbug; +@@debug_dbug T -SELECT @@session.debug, @@global.debug; -@@session.debug @@global.debug +SELECT @@session.debug_dbug, @@global.debug_dbug; +@@session.debug_dbug @@global.debug_dbug T SET SESSION debug_dbug= ''; -SELECT @@session.debug, @@global.debug; -@@session.debug @@global.debug +SELECT @@session.debug_dbug, @@global.debug_dbug; +@@session.debug_dbug @@global.debug_dbug # # Bug #52629: memory leak from sys_var_thd_dbug in # binlog.binlog_write_error # SET GLOBAL debug_dbug='d,injecting_fault_writing'; -SELECT @@global.debug; -@@global.debug +SELECT @@global.debug_dbug; +@@global.debug_dbug d,injecting_fault_writing SET GLOBAL debug_dbug=''; -SELECT @@global.debug; -@@global.debug +SELECT @@global.debug_dbug; +@@global.debug_dbug SET GLOBAL debug_dbug=@old_debug; # # Bug #56709: Memory leaks at running the 5.1 test suite # -SET @old_local_debug = @@debug; +SET @old_local_debug = @@debug_dbug; SET @@debug_dbug='d,foo'; -SELECT @@debug; -@@debug +SELECT @@debug_dbug; +@@debug_dbug d,foo SET @@debug_dbug=''; -SELECT @@debug; -@@debug +SELECT @@debug_dbug; +@@debug_dbug SET @@debug_dbug= @old_local_debug; End of 5.1 tests # # Bug#46165 server crash in dbug # -SET @old_globaldebug = @@global.debug; -SET @old_sessiondebug= @@session.debug; +SET @old_globaldebug = @@global.debug_dbug; +SET @old_sessiondebug= @@session.debug_dbug; # Test 1 - Bug test case, single connection SET GLOBAL debug_dbug= '+O,MYSQL_TMP_DIR/bug46165.1.trace'; SET SESSION debug_dbug= '-d:-t:-i'; diff --git a/mysql-test/suite/sys_vars/t/debug_dbug_func.test b/mysql-test/suite/sys_vars/t/debug_dbug_func.test index 136a4c5504d..a72636131ee 100644 --- a/mysql-test/suite/sys_vars/t/debug_dbug_func.test +++ b/mysql-test/suite/sys_vars/t/debug_dbug_func.test @@ -1,27 +1,27 @@ --source include/have_debug.inc -SET @old_debug = @@GLOBAL.debug; +SET @old_debug = @@GLOBAL.debug_dbug; # -# Bug#34678 @@debug variable's incremental mode +# Bug#34678 @@debug_dbug variable's incremental mode # SET debug_dbug= 'T'; -select @@debug; +select @@debug_dbug; SET debug_dbug= '+P'; -select @@debug; +select @@debug_dbug; SET debug_dbug= '-P'; -select @@debug; +select @@debug_dbug; # -# Bug#38054: "SET SESSION debug" modifies @@global.debug variable +# Bug#38054: "SET SESSION debug" modifies @@global.debug_dbug variable # -SELECT @@session.debug, @@global.debug; +SELECT @@session.debug_dbug, @@global.debug_dbug; SET SESSION debug_dbug= ''; -SELECT @@session.debug, @@global.debug; +SELECT @@session.debug_dbug, @@global.debug_dbug; --echo # --echo # Bug #52629: memory leak from sys_var_thd_dbug in @@ -29,9 +29,9 @@ SELECT @@session.debug, @@global.debug; --echo # SET GLOBAL debug_dbug='d,injecting_fault_writing'; -SELECT @@global.debug; +SELECT @@global.debug_dbug; SET GLOBAL debug_dbug=''; -SELECT @@global.debug; +SELECT @@global.debug_dbug; SET GLOBAL debug_dbug=@old_debug; @@ -39,12 +39,12 @@ SET GLOBAL debug_dbug=@old_debug; --echo # Bug #56709: Memory leaks at running the 5.1 test suite --echo # -SET @old_local_debug = @@debug; +SET @old_local_debug = @@debug_dbug; SET @@debug_dbug='d,foo'; -SELECT @@debug; +SELECT @@debug_dbug; SET @@debug_dbug=''; -SELECT @@debug; +SELECT @@debug_dbug; SET @@debug_dbug= @old_local_debug; @@ -55,8 +55,8 @@ SET @@debug_dbug= @old_local_debug; --echo # Bug#46165 server crash in dbug --echo # -SET @old_globaldebug = @@global.debug; -SET @old_sessiondebug= @@session.debug; +SET @old_globaldebug = @@global.debug_dbug; +SET @old_sessiondebug= @@session.debug_dbug; --echo # Test 1 - Bug test case, single connection --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR From 90e7e6783b8a667012146e16f4d804a0c8b9ee8a Mon Sep 17 00:00:00 2001 From: Alice Sherepa Date: Mon, 20 Jan 2020 13:56:43 +0100 Subject: [PATCH 06/16] MDEV-21360 save/restore debud_dbug instead of total reset at the end of the test --- mysql-test/extra/rpl_tests/rpl_corruption.inc | 1 - mysql-test/extra/rpl_tests/rpl_parallel.inc | 1 + mysql-test/suite/binlog_encryption/rpl_parallel.result | 1 + mysql-test/suite/rpl/r/rpl_parallel.result | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mysql-test/extra/rpl_tests/rpl_corruption.inc b/mysql-test/extra/rpl_tests/rpl_corruption.inc index c97b3b35766..4106bb45eef 100644 --- a/mysql-test/extra/rpl_tests/rpl_corruption.inc +++ b/mysql-test/extra/rpl_tests/rpl_corruption.inc @@ -74,7 +74,6 @@ while ($i) { # Emulate corruption in binlog file when SHOW BINLOG EVENTS is executing --echo # 2. Corruption in master binlog and SHOW BINLOG EVENTS set @saved_dbug = @@global.debug_dbug; - SET GLOBAL debug_dbug="+d,corrupt_read_log_event_char"; --echo SHOW BINLOG EVENTS; --disable_query_log diff --git a/mysql-test/extra/rpl_tests/rpl_parallel.inc b/mysql-test/extra/rpl_tests/rpl_parallel.inc index e2dbb7c3f18..b88d2126d4d 100644 --- a/mysql-test/extra/rpl_tests/rpl_parallel.inc +++ b/mysql-test/extra/rpl_tests/rpl_parallel.inc @@ -1651,6 +1651,7 @@ SELECT * FROM t2 WHERE a >= 40 ORDER BY a; --sync_with_master SELECT * FROM t2 WHERE a >= 40 ORDER BY a; --source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; SET DEBUG_SYNC= 'RESET'; SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=10; diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel.result b/mysql-test/suite/binlog_encryption/rpl_parallel.result index 20d7687ec3f..12e5455c6c1 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel.result +++ b/mysql-test/suite/binlog_encryption/rpl_parallel.result @@ -1227,6 +1227,7 @@ a 45 46 include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; SET DEBUG_SYNC= 'RESET'; SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=10; diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result index e1dbc15d3b9..657b3ba7448 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel.result +++ b/mysql-test/suite/rpl/r/rpl_parallel.result @@ -1226,6 +1226,7 @@ a 45 46 include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; SET DEBUG_SYNC= 'RESET'; SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=10; From 4e7f3fb8332c42c3beb2376ee0d90f559f1e7470 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Mon, 20 Jan 2020 22:56:01 +0300 Subject: [PATCH 07/16] MDEV-14183: aria_pack segfaults in compress_maria_file Column definition order in st_maria_share::columndef can differ from order of fields in record(see also st_maria_share::column_nr, st_maria_columndef::column_nr, _ma_column_nr_write(), _ma_column_nr_read()). This was not taken into account in aria_pack tool. The fix is to initialize elements of HUFF_COUNTS array in the correct order. --- .../suite/maria/aria_pack_mdev14183.result | 22 +++++++++++++++++++ .../suite/maria/aria_pack_mdev14183.test | 22 +++++++++++++++++++ storage/maria/maria_pack.c | 16 ++++++++------ 3 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 mysql-test/suite/maria/aria_pack_mdev14183.result create mode 100644 mysql-test/suite/maria/aria_pack_mdev14183.test diff --git a/mysql-test/suite/maria/aria_pack_mdev14183.result b/mysql-test/suite/maria/aria_pack_mdev14183.result new file mode 100644 index 00000000000..cd1decdef75 --- /dev/null +++ b/mysql-test/suite/maria/aria_pack_mdev14183.result @@ -0,0 +1,22 @@ +CREATE TABLE `t` ( +`col_1` varchar(255) NOT NULL DEFAULT '', +`col_2` varchar(255) NOT NULL, +`col_3` int(11) NOT NULL DEFAULT '0', +`col_4` int(11) NOT NULL DEFAULT '0' +) ENGINE=Aria; +insert into t values +('foobar','qux',0,0),('abcdef','qux',0,0); +Compressing test/t.MAD: (2 records) +- Calculating statistics + +normal: 0 empty-space: 0 empty-zero: 0 empty-fill: 0 +pre-space: 0 end-space: 0 intervall-fields: 0 zero: 2 +Original trees: 4 After join: 1 +- Compressing file +Min record length: 5 Max length: 5 Mean total length: 35 +99.57% +SELECT * FROM t; +col_1 col_2 col_3 col_4 +foobar qux 0 0 +abcdef qux 0 0 +DROP TABLE t; diff --git a/mysql-test/suite/maria/aria_pack_mdev14183.test b/mysql-test/suite/maria/aria_pack_mdev14183.test new file mode 100644 index 00000000000..ab0589dc780 --- /dev/null +++ b/mysql-test/suite/maria/aria_pack_mdev14183.test @@ -0,0 +1,22 @@ +--source include/have_aria.inc +--source include/have_debug.inc + +CREATE TABLE `t` ( + `col_1` varchar(255) NOT NULL DEFAULT '', + `col_2` varchar(255) NOT NULL, + `col_3` int(11) NOT NULL DEFAULT '0', + `col_4` int(11) NOT NULL DEFAULT '0' +) ENGINE=Aria; + +insert into t values + ('foobar','qux',0,0),('abcdef','qux',0,0); + +--let $datadir= `SELECT @@datadir` +--source include/shutdown_mysqld.inc +# maria_pack crashes by assert() if the bug is not fixed +--exec cd $datadir && $MARIA_PACK -t test/t + +--source include/start_mysqld.inc +SELECT * FROM t; + +DROP TABLE t; diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c index 5166ae63758..6f2d9fe8a5d 100644 --- a/storage/maria/maria_pack.c +++ b/storage/maria/maria_pack.c @@ -782,27 +782,29 @@ static HUFF_COUNTS *init_huff_count(MARIA_HA *info,my_off_t records) for (i=0 ; i < info->s->base.fields ; i++) { enum en_fieldtype type; - count[i].field_length=info->s->columndef[i].length; - type= count[i].field_type= (enum en_fieldtype) info->s->columndef[i].type; + uint col_nr = info->s->columndef[i].column_nr; + count[col_nr].field_length=info->s->columndef[i].length; + type= count[col_nr].field_type= + (enum en_fieldtype) info->s->columndef[i].type; if (type == FIELD_INTERVALL || type == FIELD_CONSTANT || type == FIELD_ZERO) type = FIELD_NORMAL; - if (count[i].field_length <= 8 && + if (count[col_nr].field_length <= 8 && (type == FIELD_NORMAL || type == FIELD_SKIP_ZERO)) - count[i].max_zero_fill= count[i].field_length; + count[col_nr].max_zero_fill= count[col_nr].field_length; /* For every column initialize a tree, which is used to detect distinct column values. 'int_tree' works together with 'tree_buff' and 'tree_pos'. It's keys are implemented by pointers into 'tree_buff'. This is accomplished by '-1' as the element size. */ - init_tree(&count[i].int_tree,0,0,-1,(qsort_cmp2) compare_tree, NULL, + init_tree(&count[col_nr].int_tree,0,0,-1,(qsort_cmp2) compare_tree, NULL, NULL, MYF(0)); if (records && type != FIELD_BLOB && type != FIELD_VARCHAR) - count[i].tree_pos=count[i].tree_buff = - my_malloc(count[i].field_length > 1 ? tree_buff_length : 2, + count[col_nr].tree_pos=count[col_nr].tree_buff = + my_malloc(count[col_nr].field_length > 1 ? tree_buff_length : 2, MYF(MY_WME)); } } From 8eec2d61fcb1d4ce4fcd56989c6fe13cd012ecad Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 21 Jan 2020 15:17:43 +0100 Subject: [PATCH 08/16] MDEV-21249 MariaDB 10.3.10 When referring to bigint to generate timestamp data in the virtual generated column, the value of the generated column does not change when the time zone changes FROM_UNIXTIME() depends on @@time_zone, so it's VCOL_SESSION_FUNC --- mysql-test/r/default_session.result | 28 ++++++++++++++++++++++++++++ mysql-test/t/default_session.test | 24 ++++++++++++++++++++++++ sql/item_timefunc.h | 4 ++++ 3 files changed, 56 insertions(+) diff --git a/mysql-test/r/default_session.result b/mysql-test/r/default_session.result index 6c0bcad0cb3..1b0c5f3f67a 100644 --- a/mysql-test/r/default_session.result +++ b/mysql-test/r/default_session.result @@ -92,3 +92,31 @@ a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI drop table t1; +set time_zone='+00:00'; +create table t1 (a int, b datetime default from_unixtime(a), c datetime); +insert t1 (a, c) values (1569495327, from_unixtime(1569495327)); +set time_zone='+01:00'; +insert t1 (a, c) values (1569495327, from_unixtime(1569495327)); +flush tables; +insert t1 (a, c) values (1569495327, from_unixtime(1569495327)); +select * from t1; +a b c +1569495327 2019-09-26 10:55:27 2019-09-26 10:55:27 +1569495327 2019-09-26 11:55:27 2019-09-26 11:55:27 +1569495327 2019-09-26 11:55:27 2019-09-26 11:55:27 +drop table t1; +set time_zone = "+00:00"; +create table t1 (a int, b timestamp as (from_unixtime(a)) virtual); +insert into t1 (a) value (1569495327); +select a, b, from_unixtime(a) from t1; +a b from_unixtime(a) +1569495327 2019-09-26 10:55:27 2019-09-26 10:55:27 +set time_zone = "+01:00"; +select a, b, from_unixtime(a) from t1; +a b from_unixtime(a) +1569495327 2019-09-26 11:55:27 2019-09-26 11:55:27 +flush tables; +select a, b, from_unixtime(a) from t1; +a b from_unixtime(a) +1569495327 2019-09-26 11:55:27 2019-09-26 11:55:27 +drop table t1; diff --git a/mysql-test/t/default_session.test b/mysql-test/t/default_session.test index 7796354ffd4..5e582bd5ca1 100644 --- a/mysql-test/t/default_session.test +++ b/mysql-test/t/default_session.test @@ -80,3 +80,27 @@ insert t1 () values (); set sql_mode=default; select * from t1; drop table t1; + +# +# MDEV-21249 MariaDB 10.3.10 When referring to bigint to generate timestamp data in the virtual generated column, the value of the generated column does not change when the time zone changes +# +set time_zone='+00:00'; +create table t1 (a int, b datetime default from_unixtime(a), c datetime); +insert t1 (a, c) values (1569495327, from_unixtime(1569495327)); +set time_zone='+01:00'; +insert t1 (a, c) values (1569495327, from_unixtime(1569495327)); +flush tables; +insert t1 (a, c) values (1569495327, from_unixtime(1569495327)); +select * from t1; +drop table t1; + +# same with vcols +set time_zone = "+00:00"; +create table t1 (a int, b timestamp as (from_unixtime(a)) virtual); +insert into t1 (a) value (1569495327); +select a, b, from_unixtime(a) from t1; +set time_zone = "+01:00"; +select a, b, from_unixtime(a) from t1; +flush tables; +select a, b, from_unixtime(a) from t1; +drop table t1; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index c89b6921796..f25fe3a551f 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -867,6 +867,10 @@ class Item_func_from_unixtime :public Item_datetimefunc const char *func_name() const { return "from_unixtime"; } bool fix_length_and_dec(); bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); + bool check_vcol_func_processor(void *arg) + { + return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); + } Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy(thd, mem_root, this); } }; From 1f9a0437da22c621d890d4eb0369bf1fc8797ba3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 22 Jan 2020 18:18:22 +0100 Subject: [PATCH 09/16] new C/C and --ssl-verify-server-cert tests tests for --ssl-verify-server-cert with system CA and with incorrect hostname --- libmariadb | 2 +- mysql-test/r/ssl_system_ca,bad.result | 1 + mysql-test/r/ssl_system_ca.result | 2 ++ mysql-test/t/ssl_system_ca.combinations | 11 +++++++++++ mysql-test/t/ssl_system_ca.test | 20 ++++++++++++++++++++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 mysql-test/r/ssl_system_ca,bad.result create mode 100644 mysql-test/r/ssl_system_ca.result create mode 100644 mysql-test/t/ssl_system_ca.combinations create mode 100644 mysql-test/t/ssl_system_ca.test diff --git a/libmariadb b/libmariadb index a1283d0b10a..8e9c3116105 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit a1283d0b10a3b675bede48d9fe2d082865a24a6c +Subproject commit 8e9c3116105d9a998a60991b7f4ba910d454d4b1 diff --git a/mysql-test/r/ssl_system_ca,bad.result b/mysql-test/r/ssl_system_ca,bad.result new file mode 100644 index 00000000000..b9c6d3e29d8 --- /dev/null +++ b/mysql-test/r/ssl_system_ca,bad.result @@ -0,0 +1 @@ +ERROR 2026 (HY000): SSL connection error: Validation of SSL server certificate failed diff --git a/mysql-test/r/ssl_system_ca.result b/mysql-test/r/ssl_system_ca.result new file mode 100644 index 00000000000..78f8bf805dd --- /dev/null +++ b/mysql-test/r/ssl_system_ca.result @@ -0,0 +1,2 @@ +*************************** 1. row *************************** +have_ssl: 1 diff --git a/mysql-test/t/ssl_system_ca.combinations b/mysql-test/t/ssl_system_ca.combinations new file mode 100644 index 00000000000..6e3576ada15 --- /dev/null +++ b/mysql-test/t/ssl_system_ca.combinations @@ -0,0 +1,11 @@ +[good] +# +# hostname on the certificate is localhost +# + +[bad] +# +# hostname on the certificate is server8k +# +loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem +loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem diff --git a/mysql-test/t/ssl_system_ca.test b/mysql-test/t/ssl_system_ca.test new file mode 100644 index 00000000000..0bedb6e4af6 --- /dev/null +++ b/mysql-test/t/ssl_system_ca.test @@ -0,0 +1,20 @@ +# +# Tests here don't use --ssl-ca but expect the certificate to be +# signed by a CA in a system CA store +# +# They only work for openssl, because the following line works only there: +let SSL_CERT_DIR=$MYSQL_TMP_DIR; + +if (`select @@version_ssl_library not like 'OpenSSL%'`) { + skip Needs OpenSSL; +} + +# See `openssl x509 -in cacert.pem -noout -issuer_hash` +copy_file $MYSQL_TEST_DIR/std_data/cacert.pem $MYSQL_TMP_DIR/ed1f42db.0; + +# +# test --ssl-verify-server-cert +# + +disable_abort_on_error; +exec $MYSQL --ssl-verify-server-cert -Ee "select (variable_value <> '') as have_ssl from information_schema.session_status where variable_name='ssl_cipher'" 2>&1; From 7c166e68aaf51bd9c1b3152ba9674fcc261f3d84 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Wed, 22 Jan 2020 21:13:14 +0300 Subject: [PATCH 10/16] MDEV-14183: aria_pack segfaults in compress_maria_file Post-push fix. aria_pack_mdev14183 test is unstable. The fix is the following: 1. Disable the test for embedded server. 2. Create non-"transactional" Aria table in the test, as aria_pack does not support "transactional" Aria tables. --- mysql-test/suite/maria/aria_pack_mdev14183.result | 2 +- mysql-test/suite/maria/aria_pack_mdev14183.test | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/maria/aria_pack_mdev14183.result b/mysql-test/suite/maria/aria_pack_mdev14183.result index cd1decdef75..b20f60c5b8a 100644 --- a/mysql-test/suite/maria/aria_pack_mdev14183.result +++ b/mysql-test/suite/maria/aria_pack_mdev14183.result @@ -3,7 +3,7 @@ CREATE TABLE `t` ( `col_2` varchar(255) NOT NULL, `col_3` int(11) NOT NULL DEFAULT '0', `col_4` int(11) NOT NULL DEFAULT '0' -) ENGINE=Aria; +) ENGINE=Aria TRANSACTIONAL=0 PAGE_CHECKSUM=0; insert into t values ('foobar','qux',0,0),('abcdef','qux',0,0); Compressing test/t.MAD: (2 records) diff --git a/mysql-test/suite/maria/aria_pack_mdev14183.test b/mysql-test/suite/maria/aria_pack_mdev14183.test index ab0589dc780..5386ae774a0 100644 --- a/mysql-test/suite/maria/aria_pack_mdev14183.test +++ b/mysql-test/suite/maria/aria_pack_mdev14183.test @@ -1,12 +1,13 @@ --source include/have_aria.inc --source include/have_debug.inc +--source include/not_embedded.inc CREATE TABLE `t` ( `col_1` varchar(255) NOT NULL DEFAULT '', `col_2` varchar(255) NOT NULL, `col_3` int(11) NOT NULL DEFAULT '0', `col_4` int(11) NOT NULL DEFAULT '0' -) ENGINE=Aria; +) ENGINE=Aria TRANSACTIONAL=0 PAGE_CHECKSUM=0; insert into t values ('foobar','qux',0,0),('abcdef','qux',0,0); From 1d12bff42c7dd73b2a0158d6780267467b9e0871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 23 Jan 2020 16:14:28 +0200 Subject: [PATCH 11/16] MDEV-20775: page_zip_validate() failure due to AUTO_INCREMENT cmake -DWITH_INNODB_EXTRA_DEBUG:BOOL=ON was broken ever since commit 8777458a6eb73ac1d7d864ebac390ea7039e21c1 (MDEV-6076 Persistent AUTO_INCREMENT for InnoDB). There is a race condition between page reads that call page_zip_validate() (while holding clustered index root page S-latch) and writes that update PAGE_ROOT_AUTO_INC (with buf_block_t::lock SX-latch, compatible with S-latch). page_zip_validate_low(): Skip the PAGE_ROOT_AUTO_INC field on clustered index root pages in order to avoid false positives. --- storage/innobase/page/page0zip.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 1c0c8f75f78..7a017913dfe 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -2,7 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2019, MariaDB Corporation. +Copyright (c) 2014, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -3336,7 +3336,19 @@ page_zip_validate_low( FIL_PAGE_LSN - FIL_PAGE_PREV) || memcmp(page_zip->data + FIL_PAGE_TYPE, page + FIL_PAGE_TYPE, 2) || memcmp(page_zip->data + FIL_PAGE_DATA, page + FIL_PAGE_DATA, - PAGE_DATA - FIL_PAGE_DATA)) { + PAGE_ROOT_AUTO_INC) + /* The PAGE_ROOT_AUTO_INC can be updated while holding an SX-latch + on the clustered index root page (page number 3 in .ibd files). + That allows concurrent readers (holding buf_block_t::lock S-latch). + Because we do not know what type of a latch our caller is holding, + we will ignore the field on clustered index root pages in order + to avoid false positives. */ + || (page_get_page_no(page) != 3/* clustered index root page */ + && memcmp(&page_zip->data[FIL_PAGE_DATA + PAGE_ROOT_AUTO_INC], + &page[FIL_PAGE_DATA + PAGE_ROOT_AUTO_INC], 8)) + || memcmp(&page_zip->data[FIL_PAGE_DATA + PAGE_HEADER_PRIV_END], + &page[FIL_PAGE_DATA + PAGE_HEADER_PRIV_END], + PAGE_DATA - FIL_PAGE_DATA - PAGE_HEADER_PRIV_END)) { page_zip_fail(("page_zip_validate: page header\n")); page_zip_hexdump(page_zip, sizeof *page_zip); page_zip_hexdump(page_zip->data, page_zip_get_size(page_zip)); From 7aa443ca7dc58f301a8c6051e2623498d894d44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 23 Jan 2020 16:29:52 +0200 Subject: [PATCH 12/16] Remove an unused tokuvalgrind script This is the only symlink in the repository. Symlinks can cause trouble when using file systems or operating systems that do not support them. Also remove the unused file DartConfig.cmake that refers to the script. --- storage/tokudb/PerconaFT/DartConfig.cmake | 10 ---------- storage/tokudb/PerconaFT/scripts/tokuvalgrind | 1 - 2 files changed, 11 deletions(-) delete mode 100644 storage/tokudb/PerconaFT/DartConfig.cmake delete mode 120000 storage/tokudb/PerconaFT/scripts/tokuvalgrind diff --git a/storage/tokudb/PerconaFT/DartConfig.cmake b/storage/tokudb/PerconaFT/DartConfig.cmake deleted file mode 100644 index 9ad189869c6..00000000000 --- a/storage/tokudb/PerconaFT/DartConfig.cmake +++ /dev/null @@ -1,10 +0,0 @@ -if(BUILD_TESTING) - if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) - # Valgrind on OSX 10.8 generally works but outputs some warning junk - # that is hard to parse out, so we'll just let it run alone - set(MEMORYCHECK_COMMAND "${TokuDB_SOURCE_DIR}/scripts/tokuvalgrind") - endif () - set(MEMORYCHECK_COMMAND_OPTIONS "--gen-suppressions=no --soname-synonyms=somalloc=*tokuportability* --quiet --num-callers=20 --leak-check=full --show-reachable=yes --trace-children=yes --trace-children-skip=sh,*/sh,basename,*/basename,dirname,*/dirname,rm,*/rm,cp,*/cp,mv,*/mv,cat,*/cat,diff,*/diff,grep,*/grep,date,*/date,test,*/tokudb_dump,*/tdb-recover --trace-children-skip-by-arg=--only_create,--test,--no-shutdown,novalgrind" CACHE INTERNAL "options for valgrind") - set(MEMORYCHECK_SUPPRESSIONS_FILE "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" CACHE INTERNAL "suppressions file for valgrind") - set(UPDATE_COMMAND "svn") -endif() diff --git a/storage/tokudb/PerconaFT/scripts/tokuvalgrind b/storage/tokudb/PerconaFT/scripts/tokuvalgrind deleted file mode 120000 index 74517aa2975..00000000000 --- a/storage/tokudb/PerconaFT/scripts/tokuvalgrind +++ /dev/null @@ -1 +0,0 @@ -tokugrind \ No newline at end of file From 683a49889c312e0c39fc34d61577efcb11560d29 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Fri, 24 Jan 2020 00:29:06 +0400 Subject: [PATCH 13/16] MENT-464 ASAN MTR quick test - some failures to be investigated. PCRE reports small frame size working with ASAN, so the test has to be ready for the minimlas possible size. --- mysql-test/r/func_regexp_pcre.result | 18 +++++++++--------- mysql-test/t/func_regexp_pcre.test | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result index e030df99756..494fe917dc6 100644 --- a/mysql-test/r/func_regexp_pcre.result +++ b/mysql-test/r/func_regexp_pcre.result @@ -888,33 +888,33 @@ Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp SELECT CONCAT(REPEAT('100,',60),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; CONCAT(REPEAT('100,',60),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$' 1 -SELECT CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; -CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$' +SELECT CONCAT(REPEAT('100,',400),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; +CONCAT(REPEAT('100,',400),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$' 0 Warnings: Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); REGEXP_INSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$') 1 -SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); -REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$') +SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); +REGEXP_INSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$') 0 Warnings: Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')) 243 -SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); -LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')) +SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); +LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')) 0 Warnings: Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')) 0 -SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); -LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')) -803 +SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); +LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')) +1603 Warnings: Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp SELECT REGEXP_INSTR('a_kollision', 'oll'); diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test index 21600390bb2..de0fe94b7c1 100644 --- a/mysql-test/t/func_regexp_pcre.test +++ b/mysql-test/t/func_regexp_pcre.test @@ -438,19 +438,19 @@ SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral, # SELECT CONCAT(REPEAT('100,',60),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; --replace_regex /[0-9]+ exceeded/NUM exceeded/ -SELECT CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; +SELECT CONCAT(REPEAT('100,',400),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'; SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); --replace_regex /[0-9]+ exceeded/NUM exceeded/ -SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); +SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'); SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); --replace_regex /[0-9]+ exceeded/NUM exceeded/ -SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); +SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')); SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); --replace_regex /[0-9]+ exceeded/NUM exceeded/ -SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); +SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',400),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', '')); # # MDEV-12942 REGEXP_INSTR returns 1 when using brackets From 26a46444b4e5f7c459eab3cd949a269f4ccf4137 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 23 Jan 2020 23:26:01 +0100 Subject: [PATCH 14/16] don't run main.ssl_system_ca in --embedded this test needs a *server* and tries to connect with $MYSQL to it --- mysql-test/t/ssl_system_ca.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/t/ssl_system_ca.test b/mysql-test/t/ssl_system_ca.test index 0bedb6e4af6..920e391090f 100644 --- a/mysql-test/t/ssl_system_ca.test +++ b/mysql-test/t/ssl_system_ca.test @@ -5,6 +5,8 @@ # They only work for openssl, because the following line works only there: let SSL_CERT_DIR=$MYSQL_TMP_DIR; +source include/not_embedded.inc; + if (`select @@version_ssl_library not like 'OpenSSL%'`) { skip Needs OpenSSL; } From 599a06098b967db3d636c1053bdbdd0011cba606 Mon Sep 17 00:00:00 2001 From: Sujatha Date: Fri, 24 Jan 2020 13:35:03 +0530 Subject: [PATCH 15/16] MDEV-21490: binlog tests fail with valgrind: Conditional jump or move depends on uninitialised value in sql_ex_info::init Problem: ======= P1) Conditional jump or move depends on uninitialised value(s) sql_ex_info::init(char const*, char const*, bool) (log_event.cc:3083) code: All the following variables are not initialized. ---- return ((cached_new_format != -1) ? cached_new_format : (cached_new_format=(field_term_len > 1 || enclosed_len > 1 || line_term_len > 1 || line_start_len > 1 || escaped_len > 1))); P2) Conditional jump or move depends on uninitialised value(s) Rows_log_event::Rows_log_event(char const*, unsigned int, Format_description_log_event const*) (log_event.cc:9571) Code: Uninitialized values is reported for 'var_header_len' variable. ---- if (var_header_len < 2 || event_len < static_cast(var_header_len + (post_start - buf))) P3) Conditional jump or move depends on uninitialised value(s) Table_map_log_event::pack_info(Protocol*) (log_event.cc:11553) code:'m_table_id' is uninitialized. ---- void Table_map_log_event::pack_info(Protocol *protocol) ... size_t bytes= my_snprintf(buf, sizeof(buf), "table_id: %lu (%s.%s)", m_table_id, m_dbnam, m_tblnam); Fix: === P1 - Fix) Initialize cached_new_format,field_term_len, enclosed_len, line_term_len, line_start_len, escaped_len members in default constructor. P2 - Fix) "var_header_len" is initialized by reading the event buffer. In case of an invalid event the buffer will contain invalid data. Hence added a check to validate the event data. If event_len is smaller than valid header length return immediately. P3 - Fix) 'm_table_id' within Table_map_log_event is initialized by reading data from the event buffer. Use 'VALIDATE_BYTES_READ' macro to validate the current state of the buffer. If it is invalid return immediately. --- sql/log_event.cc | 9 ++++++++- sql/log_event.h | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index e8881c77f2b..d731c39d9c5 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -5902,7 +5902,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len, { DBUG_ENTER("Load_log_event::copy_log_event"); uint data_len; - if ((int) event_len < body_offset) + if ((int) event_len <= body_offset) DBUG_RETURN(1); char* buf_end = (char*)buf + event_len; /* this is the beginning of the post-header */ @@ -9535,6 +9535,12 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, uint8 const post_header_len= description_event->post_header_len[event_type-1]; + if (event_len < (uint)(common_header_len + post_header_len)) + { + m_cols.bitmap= 0; + DBUG_VOID_RETURN; + } + DBUG_PRINT("enter",("event_len: %u common_header_len: %d " "post_header_len: %d", event_len, common_header_len, @@ -11043,6 +11049,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, const char *post_start= buf + common_header_len; post_start+= TM_MAPID_OFFSET; + VALIDATE_BYTES_READ(post_start, buf, event_len); if (post_header_len == 6) { /* Master is of an intermediate source tree before 5.1.4. Id is 4 bytes */ diff --git a/sql/log_event.h b/sql/log_event.h index 2c8dc3d7353..1337e9a7d69 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -2057,7 +2057,15 @@ public: /* !!! Public in this patch to allow old usage */ ****************************************************************************/ struct sql_ex_info { - sql_ex_info() {} /* Remove gcc warning */ + sql_ex_info(): + cached_new_format(-1), + field_term_len(0), + enclosed_len(0), + line_term_len(0), + line_start_len(0), + escaped_len(0), + empty_flags(0) + {} /* Remove gcc warning */ const char* field_term; const char* enclosed; const char* line_term; From ac3e3e12adad505b9f09bd068ddd6819ac084a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 24 Jan 2020 14:43:19 +0200 Subject: [PATCH 16/16] MDEV-21509: Work around occasional lost DEBUG_SYNC --- mysql-test/suite/innodb/r/innodb_bug30113362.result | 4 ++-- mysql-test/suite/innodb/t/innodb_bug30113362.test | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_bug30113362.result b/mysql-test/suite/innodb/r/innodb_bug30113362.result index 64f20650a6b..57dff622211 100644 --- a/mysql-test/suite/innodb/r/innodb_bug30113362.result +++ b/mysql-test/suite/innodb/r/innodb_bug30113362.result @@ -63,11 +63,11 @@ SET DEBUG_SYNC = 'now WAIT_FOR roll1_wait'; COMMIT; SET DEBUG_SYNC = 'now SIGNAL roll2'; connect con1,localhost,root,,; -SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting'; +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1'; SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; SELECT a00 FROM t1 WHERE a00 = 'bii'; connection default; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; SET DEBUG_SYNC = 'now SIGNAL resume'; connection con1; a00 diff --git a/mysql-test/suite/innodb/t/innodb_bug30113362.test b/mysql-test/suite/innodb/t/innodb_bug30113362.test index 7c3888aaec5..2291574f9ec 100644 --- a/mysql-test/suite/innodb/t/innodb_bug30113362.test +++ b/mysql-test/suite/innodb/t/innodb_bug30113362.test @@ -106,12 +106,18 @@ COMMIT; SET DEBUG_SYNC = 'now SIGNAL roll2'; connect (con1,localhost,root,,); -SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting'; +# FIXME: This occasionally times out! +--disable_warnings +SET DEBUG_SYNC = 'now WAIT_FOR rollback_waiting TIMEOUT 1'; +--enable_warnings SET DEBUG_SYNC = 'rw_s_lock_waiting SIGNAL lockwait1'; send SELECT a00 FROM t1 WHERE a00 = 'bii'; connection default; -SET DEBUG_SYNC = 'now WAIT_FOR lockwait1'; +# FIXME: This occasionally times out! +--disable_warnings +SET DEBUG_SYNC = 'now WAIT_FOR lockwait1 TIMEOUT 1'; +--enable_warnings # bug#30113362 caused deadlock SET DEBUG_SYNC = 'now SIGNAL resume';