From 7f99381288a280c27f74edb3d4ed6bbad4f172b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 1 Sep 2017 15:29:34 +0300 Subject: [PATCH 01/18] Fix compiler warnings metadata_lock_info_duration[]: Remove the unused variable. Add some comments /* fall through */ to silence -Wimplicit-fallthrough --- pcre/pcre_compile.c | 5 ++++- pcre/pcre_exec.c | 2 ++ plugin/metadata_lock_info/metadata_lock_info.cc | 6 ------ sql/ha_partition.cc | 2 +- storage/innobase/row/row0sel.cc | 5 +++++ storage/ndb/include/util/ndb_opts.h | 1 + storage/xtradb/row/row0sel.cc | 5 +++++ 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/pcre/pcre_compile.c b/pcre/pcre_compile.c index 42f204cdfff..1a916693e69 100644 --- a/pcre/pcre_compile.c +++ b/pcre/pcre_compile.c @@ -1249,6 +1249,7 @@ else if ((c = *ptr) >= CHAR_8) break; + /* fall through */ /* Fall through with a digit less than 8 */ /* \0 always starts an octal number, but we may drop through to here with a @@ -5097,6 +5098,8 @@ for (;; ptr++) either not match or match, depending on whether the class is or is not negated. */ + /* fall through */ + default: if (local_negate && (xclass || tempptr[2] != CHAR_RIGHT_SQUARE_BRACKET)) @@ -7165,7 +7168,7 @@ for (;; ptr++) goto FAILED; } /* Fall through to handle (?P< as (?< is handled */ - + /* fall through */ /* ------------------------------------------------------------ */ DEFINE_NAME: /* Come here from (?< handling */ diff --git a/pcre/pcre_exec.c b/pcre/pcre_exec.c index 1a9bdd546ee..70ac2fea381 100644 --- a/pcre/pcre_exec.c +++ b/pcre/pcre_exec.c @@ -1053,6 +1053,8 @@ for (;;) group. At this point, the return is converted into MATCH_NOMATCH so that previous backup points can be taken. */ + /* fall through */ + case OP_ONCE: case OP_BRA: case OP_SBRA: diff --git a/plugin/metadata_lock_info/metadata_lock_info.cc b/plugin/metadata_lock_info/metadata_lock_info.cc index d434ed9a693..48001a9e527 100644 --- a/plugin/metadata_lock_info/metadata_lock_info.cc +++ b/plugin/metadata_lock_info/metadata_lock_info.cc @@ -44,12 +44,6 @@ static const LEX_STRING metadata_lock_info_lock_mode[] = { { C_STRING_WITH_LEN("MDL_EXCLUSIVE") }, }; -static const LEX_STRING metadata_lock_info_duration[] = { - { C_STRING_WITH_LEN("MDL_STATEMENT") }, - { C_STRING_WITH_LEN("MDL_TRANSACTION") }, - { C_STRING_WITH_LEN("MDL_EXPLICIT") }, -}; - static ST_FIELD_INFO i_s_metadata_lock_info_fields_info[] = { {"THREAD_ID", 20, MYSQL_TYPE_LONGLONG, 0, diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 0824fc9b76b..e0bca209d81 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -7899,7 +7899,7 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array) case MYSQL_TYPE_BLOB: case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_GEOMETRY: - /* fall through. */ + /* fall through */ default: DBUG_ASSERT(0); // New type? /* Fall through for default hashing (5.5). */ diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 5978a1e3491..bdee3863797 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -1537,6 +1537,7 @@ rec_loop: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -1595,6 +1596,7 @@ skip_lock: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4203,6 +4205,7 @@ wait_table_again: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4273,6 +4276,7 @@ rec_loop: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4550,6 +4554,7 @@ no_gap_lock: prebuilt->new_rec_locks = 1; } err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; case DB_LOCK_WAIT: diff --git a/storage/ndb/include/util/ndb_opts.h b/storage/ndb/include/util/ndb_opts.h index d47a0243247..b753a63cd0f 100644 --- a/storage/ndb/include/util/ndb_opts.h +++ b/storage/ndb/include/util/ndb_opts.h @@ -165,6 +165,7 @@ ndb_std_get_one_option(int optid, /* fall through to add the connectstring to the end * and set opt_ndbcluster_connectstring */ + /* fall through */ case OPT_NDB_CONNECTSTRING: if (opt_ndb_connectstring && opt_ndb_connectstring[0]) my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len, diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc index b0c6565ab2e..3a25cca8a28 100644 --- a/storage/xtradb/row/row0sel.cc +++ b/storage/xtradb/row/row0sel.cc @@ -1543,6 +1543,7 @@ rec_loop: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -1601,6 +1602,7 @@ skip_lock: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4172,6 +4174,7 @@ wait_table_again: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4248,6 +4251,7 @@ rec_loop: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4534,6 +4538,7 @@ no_gap_lock: prebuilt->new_rec_locks = 1; } err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; case DB_LOCK_WAIT: From 720928782faee2f5ca576a2a3bc2bead001c6369 Mon Sep 17 00:00:00 2001 From: Julien Del-Piccolo Date: Sun, 3 Sep 2017 09:33:27 +0200 Subject: [PATCH 02/18] Fix bash expansion issue in wsrep_sst_rsync (#443) * Fix bash expansion issue in wsrep_sst_rsync. https://github.com/docker-library/mariadb/issues/126 * Fix permissions --- scripts/wsrep_sst_rsync.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 23ee3df5d40..7acdf87b660 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -357,18 +357,18 @@ EOF readonly RSYNC_PORT=${WSREP_SST_OPT_PORT:-4444} # If the IP is local listen only in it - if is_local_ip $RSYNC_ADDR + if is_local_ip "$RSYNC_ADDR" then - rsync --daemon --no-detach --address $RSYNC_ADDR --port $RSYNC_PORT --config "$RSYNC_CONF" & + rsync --daemon --no-detach --address "$RSYNC_ADDR" --port "$RSYNC_PORT" --config "$RSYNC_CONF" & else # Not local, possibly a NAT, listen in all interface - rsync --daemon --no-detach --port $RSYNC_PORT --config "$RSYNC_CONF" & + rsync --daemon --no-detach --port "$RSYNC_PORT" --config "$RSYNC_CONF" & # Overwrite address with all RSYNC_ADDR="*" fi RSYNC_REAL_PID=$! - until check_pid_and_port $RSYNC_PID $RSYNC_REAL_PID $RSYNC_ADDR $RSYNC_PORT + until check_pid_and_port "$RSYNC_PID" "$RSYNC_REAL_PID" "$RSYNC_ADDR" "$RSYNC_PORT" do sleep 0.2 done From 05008999047c055780bb6df072ba4366c29dd0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 4 Sep 2017 09:46:47 +0300 Subject: [PATCH 03/18] MDEV-13705 10.0.32 does not compile on architectures without 64-bit atomics This is a backport of the following: MDEV-13009 10.1.24 does not compile on architectures without 64-bit atomics Add a missing #include "sync0types.h" that was removed in MDEV-12674. --- storage/innobase/include/srv0mon.h | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index 09af5d4159b..7dccf1b3f4d 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -616,6 +616,7 @@ Use MONITOR_DEC if appropriate mutex protection exists. # define srv_mon_create() ((void) 0) # define srv_mon_free() ((void) 0) #else /* HAVE_ATOMIC_BUILTINS_64 */ +# include "sync0types.h" /** Mutex protecting atomic operations on platforms that lack built-in operations for atomic memory access */ extern ib_mutex_t monitor_mutex; From 17589989eec9cf4e9f7084505710a42929efe115 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Tue, 17 Jan 2017 13:09:04 +0100 Subject: [PATCH 04/18] MDEV-10972: Insert from select / view / union -- repeatable crash in 10.1, 10.2 Linux/Mac/Windows save thd->select_number between parsing and executions (in case it was not complete executed due to errors (for example epsent table)) --- mysql-test/r/sp.result | 28 ++++++++++++++++++++++++++++ mysql-test/t/sp.test | 31 +++++++++++++++++++++++++++++++ sql/sp.cc | 1 + sql/sp_head.cc | 20 +++++++++++++++++++- sql/sp_head.h | 3 +++ 5 files changed, 82 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index d9b5dfd5a1f..c6867d46489 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -8079,4 +8079,32 @@ CALL sp1(); CALL sp1(); drop user 'foo'@'%'; drop procedure sp1; +# +# MDEV-10972: Insert from select / view / union -- +# repeatable crash in 10.1, 10.2 Linux/Mac/Windows +# +create table t (id int auto_increment primary key); +insert into t values (9494),(9495),(9496),(9497),(9498),(9499),(9500),(9501),(9502),(9503); +create VIEW v AS +select id from t +union +select id from t +; +drop procedure if exists p; +Warnings: +Note 1305 PROCEDURE test.p does not exist +create procedure p() +insert into tmp_t select t.id from ( +select id from v +union +select id from v +) sq +inner join t on (sq.id = t.id); +CALL p(); +ERROR 42S02: Table 'test.tmp_t' doesn't exist +create table tmp_t (id int null); +CALL p(); +drop procedure p; +drop view v; +drop table t, tmp_t; #End of 10.1 tests diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 6eba2522089..99020eb951f 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9556,5 +9556,36 @@ CALL sp1(); drop user 'foo'@'%'; drop procedure sp1; +--echo # +--echo # MDEV-10972: Insert from select / view / union -- +--echo # repeatable crash in 10.1, 10.2 Linux/Mac/Windows +--echo # + +create table t (id int auto_increment primary key); +insert into t values (9494),(9495),(9496),(9497),(9498),(9499),(9500),(9501),(9502),(9503); + +create VIEW v AS +select id from t +union +select id from t +; + +drop procedure if exists p; +create procedure p() +insert into tmp_t select t.id from ( + select id from v + union + select id from v +) sq +inner join t on (sq.id = t.id); + +--error ER_NO_SUCH_TABLE +CALL p(); +create table tmp_t (id int null); +CALL p(); + +drop procedure p; +drop view v; +drop table t, tmp_t; --echo #End of 10.1 tests diff --git a/sql/sp.cc b/sql/sp.cc index 2e268e483e7..5a64c28865e 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -760,6 +760,7 @@ static sp_head *sp_compile(THD *thd, String *defstr, ulonglong sql_mode, else { sp= thd->lex->sphead; + sp->set_select_number(thd->select_number); } thd->pop_internal_handler(); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index bf25d45ffaf..ae274ee8714 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -598,7 +598,7 @@ sp_head::sp_head() m_flags(0), m_sp_cache_version(0), m_creation_ctx(0), - unsafe_flags(0), + unsafe_flags(0), m_select_number(1), m_recursion_level(0), m_next_cached_sp(0), m_cont_level(0) @@ -2100,8 +2100,26 @@ sp_head::execute_procedure(THD *thd, List *args) if (!err_status) { + /* + Normally the counter is not reset between parsing and first execution, + but it is possible in case of error to have parsing on one CALL and + first execution (where VIEW will be parsed and added). So we store the + counter after parsing and restore it before execution just to avoid + repeating SELECT numbers. + */ + thd->select_number= m_select_number; + err_status= execute(thd, TRUE); DBUG_PRINT("info", ("execute returned %d", (int) err_status)); + /* + This execution of the SP was aborted with an error (e.g. "Table not + found"). However it might still have consumed some numbers from the + thd->select_number counter. The next sp->exec() call must not use the + consumed numbers, so we remember the first free number (We know that + nobody will use it as this execution has stopped with an error). + */ + if (err_status) + set_select_number(thd->select_number); } if (save_log_general) diff --git a/sql/sp_head.h b/sql/sp_head.h index 604190079cb..5d3697daa16 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -232,6 +232,7 @@ private: */ uint32 unsafe_flags; + uint m_select_number; public: inline Stored_program_creation_ctx *get_creation_ctx() { @@ -521,6 +522,8 @@ public: sp_pcontext *get_parse_context() { return m_pcont; } + void set_select_number(uint num) { m_select_number= num; } + private: MEM_ROOT *m_thd_root; ///< Temp. store for thd's mem_root From 641baa5d03131ba528d5e6a36da3514f5c9b8ab2 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Thu, 31 Aug 2017 14:22:05 +0300 Subject: [PATCH 05/18] Post-push for MDEV-13437 A new $MYSQLD_LAST_CMD evaluation was too late in case --manual-gdb. Now it is done before the server restart type branches which is safe and the args value has been fully computed by the new point of evaluation. --- mysql-test/mysql-test-run.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 1848b74eb0f..ed010cdf818 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5477,6 +5477,11 @@ sub mysqld_start ($$) { } } + # "Dynamic" version of MYSQLD_CMD is reevaluated with each mysqld_start. + # Use it to restart the server at testing a failing server start (e.g + # due to incompatible options). + $ENV{'MYSQLD_LAST_CMD'}= "$exe @$args"; + if ( $opt_gdb || $opt_manual_gdb ) { gdb_arguments(\$args, \$exe, $mysqld->name()); @@ -5573,11 +5578,6 @@ sub mysqld_start ($$) { # Remember options used when starting $mysqld->{'started_opts'}= $extra_opts; - # "Dynamic" version of MYSQLD_CMD is reevaluated with each mysqld_start. - # Use it to restart the server at testing a failing server start (e.g - # due to incompatible options). - $ENV{'MYSQLD_LAST_CMD'}= "$exe @$args"; - return; } From 8592ff9e8d477ccea322fb952266cb0f18e6c3b7 Mon Sep 17 00:00:00 2001 From: andrelkin Date: Thu, 6 Jul 2017 14:03:23 +0300 Subject: [PATCH 06/18] MDEV-12731 Was reported as 'rpl.rpl_gtid_stop_start fails with Valgrind in buildbot and outside'. The 'Conditional jump or move depends on uninitialized value' valgrind complaint is valid and means THD::m_current_stage_key that is not initialized indeed by constructor. Fixed with its initialization added to the initializer list of THD::THD. Double checked with mysql to have found a similar fixes for the very same issue which was discovered after P_S merge to Maria (60589aeee where the member is introduced) had been done. --- sql/sql_class.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 003a4019017..9aedba3c426 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -698,6 +698,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) /* statement id */ 0), rli_fake(0), rgi_fake(0), rgi_slave(NULL), protocol_text(this), protocol_binary(this), + m_current_stage_key(0), in_sub_stmt(0), log_all_errors(0), binlog_unsafe_warning_flags(0), binlog_table_maps(0), From 4ae200a97a62ece765e940d8acb01cf1ada9de24 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 5 Sep 2017 18:28:05 +0300 Subject: [PATCH 07/18] Update test results for rocksdb.bulk_load_rev_cf_and_data --- .../mysql-test/rocksdb/r/bulk_load_rev_cf_and_data.result | 3 +++ 1 file changed, 3 insertions(+) diff --git a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf_and_data.result b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf_and_data.result index 4d259b5ea2f..6c38e030afb 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf_and_data.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/bulk_load_rev_cf_and_data.result @@ -21,6 +21,7 @@ b CHAR(30), PRIMARY KEY(pk) COMMENT "rev:cf1", KEY(a) ) COLLATE 'latin1_bin' PARTITION BY KEY() PARTITIONS 4; +connect other,localhost,root,,; set session transaction isolation level repeatable read; select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS'; STAT_TYPE VALUE @@ -29,6 +30,7 @@ start transaction with consistent snapshot; select * from information_schema.rocksdb_dbstats where stat_type='DB_NUM_SNAPSHOTS'; STAT_TYPE VALUE DB_NUM_SNAPSHOTS 1 +connection default; set rocksdb_bulk_load=1; set rocksdb_bulk_load_size=100000; LOAD DATA INFILE INTO TABLE t1; @@ -79,4 +81,5 @@ count(b) 5000000 longfilenamethatvalidatesthatthiswillgetdeleted.bulk_load.tmp test.bulk_load.tmp +disconnect other; DROP TABLE t1, t2, t3; From 80c90887fe952016df86abb6afd9aae02cfcaead Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Tue, 5 Sep 2017 23:00:59 +0530 Subject: [PATCH 08/18] MDEV-13585: RocksDB plugin fails to build on macOS because of unknown type `timer_t` etc. Rdb_io_watchdog can not be built on OS X. Disable it. --- storage/rocksdb/CMakeLists.txt | 9 +++++++-- storage/rocksdb/ha_rocksdb.cc | 10 +++++----- storage/rocksdb/rdb_io_watchdog.cc | 2 +- storage/rocksdb/rdb_io_watchdog.h | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index 5db6d888bb6..6db82119b45 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -146,7 +146,10 @@ ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib ADD_DEPENDENCIES(rocksdb_aux_lib GenError) # MARIAROCKS-TODO: how to properly depend on -lrt ? -TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY} -lrt) +TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY}) +if (UNIX AND NOT APPLE) + TARGET_LINK_LIBRARIES(rocksdb_aux_lib -lrt) +endif() TARGET_LINK_LIBRARIES(rocksdb rocksdb_aux_lib) @@ -182,7 +185,9 @@ ENDIF() # ADD_SUBDIRECTORY(unittest) #ENDIF() -SET(rocksdb_static_libs ${rocksdb_static_libs} "-lrt") +if (UNIX AND NOT APPLE) + SET(rocksdb_static_libs ${rocksdb_static_libs} "-lrt") +endif() ADD_LIBRARY(rocksdb_tools STATIC rocksdb/tools/ldb_tool.cc diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 293d995126a..9868bbc926d 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -173,7 +173,7 @@ Rdb_ddl_manager ddl_manager; const char *m_mysql_gtid; Rdb_binlog_manager binlog_manager; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__APPLE__) Rdb_io_watchdog *io_watchdog = nullptr; #endif /** @@ -554,7 +554,7 @@ static void rocksdb_set_io_write_timeout( void *const var_ptr MY_ATTRIBUTE((__unused__)), const void *const save) { DBUG_ASSERT(save != nullptr); DBUG_ASSERT(rdb != nullptr); -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__APPLE__) DBUG_ASSERT(io_watchdog != nullptr); #endif @@ -563,7 +563,7 @@ static void rocksdb_set_io_write_timeout( const uint32_t new_val = *static_cast(save); rocksdb_io_write_timeout_secs = new_val; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__APPLE__) io_watchdog->reset_timeout(rocksdb_io_write_timeout_secs); #endif RDB_MUTEX_UNLOCK_CHECK(rdb_sysvars_mutex); @@ -3984,7 +3984,7 @@ static int rocksdb_init_func(void *const p) { directories.push_back(myrocks::rocksdb_wal_dir); } -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__APPLE__) io_watchdog = new Rdb_io_watchdog(directories); io_watchdog->reset_timeout(rocksdb_io_write_timeout_secs); #endif @@ -4076,7 +4076,7 @@ static int rocksdb_done_func(void *const p) { delete commit_latency_stats; commit_latency_stats = nullptr; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__APPLE__) delete io_watchdog; io_watchdog = nullptr; #endif diff --git a/storage/rocksdb/rdb_io_watchdog.cc b/storage/rocksdb/rdb_io_watchdog.cc index a599ba58aec..b41e9248d52 100644 --- a/storage/rocksdb/rdb_io_watchdog.cc +++ b/storage/rocksdb/rdb_io_watchdog.cc @@ -22,7 +22,7 @@ #include /* Rdb_io_watchdog doesn't work on Windows [yet] */ -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__APPLE__) namespace myrocks { diff --git a/storage/rocksdb/rdb_io_watchdog.h b/storage/rocksdb/rdb_io_watchdog.h index de8c1b9500e..c50547745df 100644 --- a/storage/rocksdb/rdb_io_watchdog.h +++ b/storage/rocksdb/rdb_io_watchdog.h @@ -35,7 +35,7 @@ namespace myrocks { // Rdb_io_watchdog does not support Windows ATM. -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__APPLE__) class Rdb_io_watchdog { const int RDB_IO_WRITE_BUFFER_SIZE = 4096; From 6b45355e6bd70e77fcd4dd4d0ef74608bafc9b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 6 Sep 2017 14:01:15 +0300 Subject: [PATCH 09/18] MDEV-13103 Assertion `flags & BUF_PAGE_PRINT_NO_CRASH' failed in buf_page_print buf_page_print(): Remove the parameter 'flags', and when a server abort is intended, perform that in the caller. In this way, page corruption reports due to different reasons can be distinguished better. This is non-functional code refactoring that does not fix any page corruption issues. The change is only made to avoid falsely grouping together unrelated causes of page corruption. --- storage/innobase/btr/btr0btr.cc | 86 +++++++++------------------ storage/innobase/btr/btr0sea.cc | 4 +- storage/innobase/buf/buf0buf.cc | 34 ++++------- storage/innobase/buf/buf0dblwr.cc | 10 +--- storage/innobase/ibuf/ibuf0ibuf.cc | 8 +-- storage/innobase/include/btr0btr.ic | 2 +- storage/innobase/include/buf0buf.h | 20 ++----- storage/innobase/include/page0page.ic | 2 +- storage/innobase/lock/lock0lock.cc | 2 +- storage/innobase/page/page0cur.cc | 2 +- storage/innobase/page/page0page.cc | 17 +++--- storage/innobase/row/row0sel.cc | 3 +- storage/xtradb/btr/btr0btr.cc | 86 +++++++++------------------ storage/xtradb/btr/btr0sea.cc | 4 +- storage/xtradb/buf/buf0buf.cc | 34 ++++------- storage/xtradb/buf/buf0dblwr.cc | 10 +--- storage/xtradb/ibuf/ibuf0ibuf.cc | 8 +-- storage/xtradb/include/btr0btr.ic | 2 +- storage/xtradb/include/buf0buf.h | 23 ++----- storage/xtradb/include/page0page.ic | 2 +- storage/xtradb/lock/lock0lock.cc | 2 +- storage/xtradb/page/page0cur.cc | 2 +- storage/xtradb/page/page0page.cc | 17 +++--- storage/xtradb/row/row0sel.cc | 3 +- 24 files changed, 132 insertions(+), 251 deletions(-) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 2c5e9a175e2..e75f116d458 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -75,10 +75,9 @@ btr_corruption_report( index->name, index->table_name); if (block->page.zip.data) { buf_page_print(block->page.zip.data, - buf_block_get_zip_size(block), - BUF_PAGE_PRINT_NO_CRASH); + buf_block_get_zip_size(block)); } - buf_page_print(buf_block_get_frame(block), 0, 0); + buf_page_print(buf_block_get_frame(block), 0); } #ifndef UNIV_HOTBACKUP @@ -1431,11 +1430,9 @@ btr_page_get_father_node_ptr_func( if (btr_node_ptr_get_child_page_no(node_ptr, offsets) != page_no) { rec_t* print_rec; fputs("InnoDB: Dump of the child page:\n", stderr); - buf_page_print(page_align(user_rec), 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page_align(user_rec), 0); fputs("InnoDB: Dump of the parent page:\n", stderr); - buf_page_print(page_align(node_ptr), 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page_align(node_ptr), 0); fputs("InnoDB: Corruption of an index tree: table ", stderr); ut_print_name(stderr, NULL, TRUE, index->table_name); @@ -1890,8 +1887,8 @@ btr_page_reorganize_low( max_ins_size2 = page_get_max_insert_size_after_reorganize(page, 1); if (data_size1 != data_size2 || max_ins_size1 != max_ins_size2) { - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(temp_page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); + buf_page_print(temp_page, 0); fprintf(stderr, "InnoDB: Error: page old data size %lu" @@ -4414,7 +4411,7 @@ btr_index_rec_validate( (ulong) rec_get_n_fields_old(rec), (ulong) n); if (dump_on_error) { - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); fputs("InnoDB: corrupt record ", stderr); rec_print_old(stderr, rec); @@ -4452,8 +4449,7 @@ btr_index_rec_validate( (ulong) i, (ulong) len, (ulong) fixed_size); if (dump_on_error) { - buf_page_print(page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); fputs("InnoDB: corrupt record ", stderr); rec_print_new(stderr, rec, offsets); @@ -4730,8 +4726,8 @@ loop: btr_validate_report2(index, level, block, right_block); fputs("InnoDB: broken FIL_PAGE_NEXT" " or FIL_PAGE_PREV links\n", stderr); - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); + buf_page_print(right_page, 0); ret = false; } @@ -4739,8 +4735,8 @@ loop: if (page_is_comp(right_page) != page_is_comp(page)) { btr_validate_report2(index, level, block, right_block); fputs("InnoDB: 'compact' flag mismatch\n", stderr); - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); + buf_page_print(right_page, 0); ret = false; @@ -4762,8 +4758,8 @@ loop: fputs("InnoDB: records in wrong order" " on adjacent pages\n", stderr); - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); + buf_page_print(right_page, 0); fputs("InnoDB: record ", stderr); rec = page_rec_get_prev(page_get_supremum_rec(page)); @@ -4811,8 +4807,8 @@ loop: fputs("InnoDB: node pointer to the page is wrong\n", stderr); - buf_page_print(father_page, 0, BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(father_page, 0); + buf_page_print(page, 0); fputs("InnoDB: node ptr ", stderr); rec_print(stderr, node_ptr, index); @@ -4844,10 +4840,8 @@ loop: btr_validate_report1(index, level, block); - buf_page_print(father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(father_page, 0); + buf_page_print(page, 0); fputs("InnoDB: Error: node ptrs differ" " on levels > 0\n" @@ -4892,15 +4886,9 @@ loop: btr_validate_report1(index, level, block); - buf_page_print( - father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - right_page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(father_page, 0); + buf_page_print(page, 0); + buf_page_print(right_page, 0); } } else { page_t* right_father_page @@ -4918,18 +4906,10 @@ loop: btr_validate_report1(index, level, block); - buf_page_print( - father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - right_father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - right_page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(father_page, 0); + buf_page_print(right_father_page, 0); + buf_page_print(page, 0); + buf_page_print(right_page, 0); } if (page_get_page_no(right_father_page) @@ -4943,18 +4923,10 @@ loop: btr_validate_report1(index, level, block); - buf_page_print( - father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - right_father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - right_page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(father_page, 0); + buf_page_print(right_father_page, 0); + buf_page_print(page, 0); + buf_page_print(right_page, 0); } } } diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 70f2cbc10e2..e36e6d6194c 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -1982,9 +1982,7 @@ btr_search_validate(void) (ulong) block->curr_left_side); if (n_page_dumps < 20) { - buf_page_print( - page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); n_page_dumps++; } } diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 39cf089c350..518d5ad323d 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -776,19 +776,12 @@ buf_page_is_corrupted( return(FALSE); } -/********************************************************************//** -Prints a page to stderr. */ +/** Dump a page to stderr. +@param[in] read_buf database page +@param[in] zip_size compressed page size, or 0 for uncompressed */ UNIV_INTERN void -buf_page_print( -/*===========*/ - const byte* read_buf, /*!< in: a database page */ - ulint zip_size, /*!< in: compressed page size, or - 0 for uncompressed pages */ - ulint flags) /*!< in: 0 or - BUF_PAGE_PRINT_NO_CRASH or - BUF_PAGE_PRINT_NO_FULL */ - +buf_page_print(const byte* read_buf, ulint zip_size) { #ifndef UNIV_HOTBACKUP dict_index_t* index; @@ -799,14 +792,12 @@ buf_page_print( size = UNIV_PAGE_SIZE; } - if (!(flags & BUF_PAGE_PRINT_NO_FULL)) { - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Page dump in ascii and hex (%lu bytes):\n", - size); - ut_print_buf(stderr, read_buf, size); - fputs("\nInnoDB: End of page dump\n", stderr); - } + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Page dump in ascii and hex (%lu bytes):\n", + size); + ut_print_buf(stderr, read_buf, size); + fputs("\nInnoDB: End of page dump\n", stderr); if (zip_size) { /* Print compressed page. */ @@ -956,8 +947,6 @@ buf_page_print( stderr); break; } - - ut_ad(flags & BUF_PAGE_PRINT_NO_CRASH); } #ifndef UNIV_HOTBACKUP @@ -4244,8 +4233,7 @@ corrupt: "InnoDB: You may have to recover" " from a backup.\n", bpage->offset); - buf_page_print(frame, buf_page_get_zip_size(bpage), - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(frame, buf_page_get_zip_size(bpage)); fprintf(stderr, "InnoDB: Database page corruption on disk" " or a failed\n" diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index a752c3dfda5..7c78bf99379 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -533,16 +533,12 @@ buf_dblwr_process() page, zip_size)) { fprintf(stderr, "InnoDB: Dump of the page:\n"); - buf_page_print( - read_buf, zip_size, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(read_buf, zip_size); fprintf(stderr, "InnoDB: Dump of" " corresponding page" " in doublewrite buffer:\n"); - buf_page_print( - page, zip_size, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, zip_size); fprintf(stderr, "InnoDB: Also the page in the" @@ -726,7 +722,7 @@ buf_dblwr_assert_on_corrupt_block( /*==============================*/ const buf_block_t* block) /*!< in: block to check */ { - buf_page_print(block->frame, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(block->frame, 0); ut_print_timestamp(stderr); fprintf(stderr, diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 99be552c967..4b772eedd8a 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -4034,7 +4034,7 @@ ibuf_insert_to_index_page( "InnoDB: but the number of fields does not match!\n", stderr); dump: - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); dtuple_print(stderr, entry); ut_ad(0); @@ -4644,14 +4644,12 @@ ibuf_merge_or_delete_for_page( bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, &mtr); - buf_page_print(bitmap_page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(bitmap_page, 0); ibuf_mtr_commit(&mtr); fputs("\nInnoDB: Dump of the page:\n", stderr); - buf_page_print(block->frame, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(block->frame, 0); fprintf(stderr, "InnoDB: Error: corruption in the tablespace." diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic index 2ad01259924..3f765a56d9d 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -265,7 +265,7 @@ btr_node_ptr_get_child_page_no( "InnoDB: a nonsensical page number 0" " in a node ptr record at offset %lu\n", (ulong) page_offset(rec)); - buf_page_print(page_align(rec), 0, 0); + buf_page_print(page_align(rec), 0); ut_ad(0); } diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 78e961d91b7..cddab05f84d 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -722,25 +722,13 @@ buf_print(void); /*============*/ #endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */ #endif /* !UNIV_HOTBACKUP */ -enum buf_page_print_flags { - /** Do not crash at the end of buf_page_print(). */ - BUF_PAGE_PRINT_NO_CRASH = 1, - /** Do not print the full page dump. */ - BUF_PAGE_PRINT_NO_FULL = 2 -}; -/********************************************************************//** -Prints a page to stderr. */ +/** Dump a page to stderr. +@param[in] read_buf database page +@param[in] zip_size compressed page size, or 0 for uncompressed */ UNIV_INTERN void -buf_page_print( -/*===========*/ - const byte* read_buf, /*!< in: a database page */ - ulint zip_size, /*!< in: compressed page size, or - 0 for uncompressed pages */ - ulint flags) /*!< in: 0 or - BUF_PAGE_PRINT_NO_CRASH or - BUF_PAGE_PRINT_NO_FULL */ +buf_page_print(const byte* read_buf, ulint zip_size) UNIV_COLD MY_ATTRIBUTE((nonnull)); /********************************************************************//** Decompress a block. diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index a4d3bd40426..feb50b6a475 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -783,7 +783,7 @@ page_rec_get_next_low( (void*) rec, (ulong) page_get_space_id(page), (ulong) page_get_page_no(page)); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); ut_error; } else if (offs == 0) { diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 869de0be182..a72db9e8e83 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -1711,7 +1711,7 @@ lock_sec_rec_some_has_impl( } else if (!lock_check_trx_id_sanity(max_trx_id, rec, index, offsets)) { - buf_page_print(page, 0, 0); + buf_page_print(page, 0); /* The page is corrupt: try to avoid a crash by returning 0 */ trx_id = 0; diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index 28368182b3e..05d84fd8985 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -903,7 +903,7 @@ page_cur_parse_insert_rec( ut_print_buf(stderr, ptr2, 300); putc('\n', stderr); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); ut_error; } diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index 090848a4525..cbd46d13b51 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -149,7 +149,7 @@ page_dir_find_owner_slot( fputs("\n" "InnoDB: on that page!\n", stderr); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); ut_error; } @@ -613,10 +613,8 @@ page_copy_rec_list_end_no_locks( /* Track an assertion failure reported on the mailing list on June 18th, 2003 */ - buf_page_print(new_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(page_align(rec), 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(new_page, 0); + buf_page_print(page_align(rec), 0); ut_print_timestamp(stderr); fprintf(stderr, @@ -1940,7 +1938,8 @@ page_check_dir( fprintf(stderr, "InnoDB: Page directory corruption:" " infimum not pointed to\n"); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); + ut_ad(0); } if (UNIV_UNLIKELY(!page_rec_is_supremum_low(supremum_offs))) { @@ -1948,7 +1947,8 @@ page_check_dir( fprintf(stderr, "InnoDB: Page directory corruption:" " supremum not pointed to\n"); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); + ut_ad(0); } } #endif /* !UNIV_HOTBACKUP */ @@ -2666,7 +2666,8 @@ func_exit2: (ulong) page_get_space_id(page), (ulong) page_get_page_no(page), index->name); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); + ut_ad(0); } return(ret); diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index bdee3863797..aea0556c364 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -4312,8 +4312,7 @@ rec_loop: wrong_offs: if (srv_force_recovery == 0 || moves_up == FALSE) { ut_print_timestamp(stderr); - buf_page_print(page_align(rec), 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page_align(rec), 0); fprintf(stderr, "\nInnoDB: rec address %p," " buf block fix count %lu\n", diff --git a/storage/xtradb/btr/btr0btr.cc b/storage/xtradb/btr/btr0btr.cc index 6bf8823124c..47a2fa9b2cb 100644 --- a/storage/xtradb/btr/btr0btr.cc +++ b/storage/xtradb/btr/btr0btr.cc @@ -75,10 +75,9 @@ btr_corruption_report( index->name, index->table_name); if (block->page.zip.data) { buf_page_print(block->page.zip.data, - buf_block_get_zip_size(block), - BUF_PAGE_PRINT_NO_CRASH); + buf_block_get_zip_size(block)); } - buf_page_print(buf_nonnull_block_get_frame(block), 0, 0); + buf_page_print(buf_nonnull_block_get_frame(block), 0); } #ifndef UNIV_HOTBACKUP @@ -1459,11 +1458,9 @@ btr_page_get_father_node_ptr_func( if (btr_node_ptr_get_child_page_no(node_ptr, offsets) != page_no) { rec_t* print_rec; fputs("InnoDB: Dump of the child page:\n", stderr); - buf_page_print(page_align(user_rec), 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page_align(user_rec), 0); fputs("InnoDB: Dump of the parent page:\n", stderr); - buf_page_print(page_align(node_ptr), 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page_align(node_ptr), 0); fputs("InnoDB: Corruption of an index tree: table ", stderr); ut_print_name(stderr, NULL, TRUE, index->table_name); @@ -1934,8 +1931,8 @@ btr_page_reorganize_low( max_ins_size2 = page_get_max_insert_size_after_reorganize(page, 1); if (data_size1 != data_size2 || max_ins_size1 != max_ins_size2) { - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(temp_page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); + buf_page_print(temp_page, 0); fprintf(stderr, "InnoDB: Error: page old data size %lu" @@ -4458,7 +4455,7 @@ btr_index_rec_validate( (ulong) rec_get_n_fields_old(rec), (ulong) n); if (dump_on_error) { - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); fputs("InnoDB: corrupt record ", stderr); rec_print_old(stderr, rec); @@ -4496,8 +4493,7 @@ btr_index_rec_validate( (ulong) i, (ulong) len, (ulong) fixed_size); if (dump_on_error) { - buf_page_print(page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); fputs("InnoDB: corrupt record ", stderr); rec_print_new(stderr, rec, offsets); @@ -4774,8 +4770,8 @@ loop: btr_validate_report2(index, level, block, right_block); fputs("InnoDB: broken FIL_PAGE_NEXT" " or FIL_PAGE_PREV links\n", stderr); - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); + buf_page_print(right_page, 0); ret = false; } @@ -4783,8 +4779,8 @@ loop: if (page_is_comp(right_page) != page_is_comp(page)) { btr_validate_report2(index, level, block, right_block); fputs("InnoDB: 'compact' flag mismatch\n", stderr); - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); + buf_page_print(right_page, 0); ret = false; @@ -4806,8 +4802,8 @@ loop: fputs("InnoDB: records in wrong order" " on adjacent pages\n", stderr); - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); + buf_page_print(right_page, 0); fputs("InnoDB: record ", stderr); rec = page_rec_get_prev(page_get_supremum_rec(page)); @@ -4855,8 +4851,8 @@ loop: fputs("InnoDB: node pointer to the page is wrong\n", stderr); - buf_page_print(father_page, 0, BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(father_page, 0); + buf_page_print(page, 0); fputs("InnoDB: node ptr ", stderr); rec_print(stderr, node_ptr, index); @@ -4888,10 +4884,8 @@ loop: btr_validate_report1(index, level, block); - buf_page_print(father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(father_page, 0); + buf_page_print(page, 0); fputs("InnoDB: Error: node ptrs differ" " on levels > 0\n" @@ -4936,15 +4930,9 @@ loop: btr_validate_report1(index, level, block); - buf_page_print( - father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - right_page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(father_page, 0); + buf_page_print(page, 0); + buf_page_print(right_page, 0); } } else { page_t* right_father_page @@ -4962,18 +4950,10 @@ loop: btr_validate_report1(index, level, block); - buf_page_print( - father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - right_father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - right_page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(father_page, 0); + buf_page_print(right_father_page, 0); + buf_page_print(page, 0); + buf_page_print(right_page, 0); } if (page_get_page_no(right_father_page) @@ -4987,18 +4967,10 @@ loop: btr_validate_report1(index, level, block); - buf_page_print( - father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - right_father_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print( - right_page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(father_page, 0); + buf_page_print(right_father_page, 0); + buf_page_print(page, 0); + buf_page_print(right_page, 0); } } } diff --git a/storage/xtradb/btr/btr0sea.cc b/storage/xtradb/btr/btr0sea.cc index 2ed383b0dcb..12c99246f16 100644 --- a/storage/xtradb/btr/btr0sea.cc +++ b/storage/xtradb/btr/btr0sea.cc @@ -2034,9 +2034,7 @@ btr_search_validate_one_table( (ulong) block->curr_left_side); if (n_page_dumps < 20) { - buf_page_print( - page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); n_page_dumps++; } } diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index 1b031f5eabc..d211bf382cf 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -845,19 +845,12 @@ buf_page_is_corrupted( return(FALSE); } -/********************************************************************//** -Prints a page to stderr. */ +/** Dump a page to stderr. +@param[in] read_buf database page +@param[in] zip_size compressed page size, or 0 for uncompressed */ UNIV_INTERN void -buf_page_print( -/*===========*/ - const byte* read_buf, /*!< in: a database page */ - ulint zip_size, /*!< in: compressed page size, or - 0 for uncompressed pages */ - ulint flags) /*!< in: 0 or - BUF_PAGE_PRINT_NO_CRASH or - BUF_PAGE_PRINT_NO_FULL */ - +buf_page_print(const byte* read_buf, ulint zip_size) { #ifndef UNIV_HOTBACKUP dict_index_t* index; @@ -875,14 +868,12 @@ buf_page_print( size = UNIV_PAGE_SIZE; } - if (!(flags & BUF_PAGE_PRINT_NO_FULL)) { - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Page dump in ascii and hex (%lu bytes):\n", - size); - ut_print_buf(stderr, read_buf, size); - fputs("\nInnoDB: End of page dump\n", stderr); - } + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Page dump in ascii and hex (%lu bytes):\n", + size); + ut_print_buf(stderr, read_buf, size); + fputs("\nInnoDB: End of page dump\n", stderr); if (zip_size) { /* Print compressed page. */ @@ -1032,8 +1023,6 @@ buf_page_print( stderr); break; } - - ut_ad(flags & BUF_PAGE_PRINT_NO_CRASH); } #ifndef UNIV_HOTBACKUP @@ -4449,8 +4438,7 @@ corrupt: "InnoDB: You may have to recover" " from a backup.\n", bpage->offset); - buf_page_print(frame, buf_page_get_zip_size(bpage), - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(frame, buf_page_get_zip_size(bpage)); fprintf(stderr, "InnoDB: Database page corruption on disk" " or a failed\n" diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc index 46296814bb6..60f062e7cd4 100644 --- a/storage/xtradb/buf/buf0dblwr.cc +++ b/storage/xtradb/buf/buf0dblwr.cc @@ -533,16 +533,12 @@ buf_dblwr_process() page, zip_size)) { fprintf(stderr, "InnoDB: Dump of the page:\n"); - buf_page_print( - read_buf, zip_size, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(read_buf, zip_size); fprintf(stderr, "InnoDB: Dump of" " corresponding page" " in doublewrite buffer:\n"); - buf_page_print( - page, zip_size, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, zip_size); fprintf(stderr, "InnoDB: Also the page in the" @@ -726,7 +722,7 @@ buf_dblwr_assert_on_corrupt_block( /*==============================*/ const buf_block_t* block) /*!< in: block to check */ { - buf_page_print(block->frame, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(block->frame, 0); ut_print_timestamp(stderr); fprintf(stderr, diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc index d542e488dba..fd17f531a16 100644 --- a/storage/xtradb/ibuf/ibuf0ibuf.cc +++ b/storage/xtradb/ibuf/ibuf0ibuf.cc @@ -4076,7 +4076,7 @@ ibuf_insert_to_index_page( "InnoDB: but the number of fields does not match!\n", stderr); dump: - buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page, 0); dtuple_print(stderr, entry); ut_ad(0); @@ -4686,14 +4686,12 @@ ibuf_merge_or_delete_for_page( bitmap_page = ibuf_bitmap_get_map_page(space, page_no, zip_size, &mtr); - buf_page_print(bitmap_page, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(bitmap_page, 0); ibuf_mtr_commit(&mtr); fputs("\nInnoDB: Dump of the page:\n", stderr); - buf_page_print(block->frame, 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(block->frame, 0); fprintf(stderr, "InnoDB: Error: corruption in the tablespace." diff --git a/storage/xtradb/include/btr0btr.ic b/storage/xtradb/include/btr0btr.ic index 0227cfdb5af..a1675419e81 100644 --- a/storage/xtradb/include/btr0btr.ic +++ b/storage/xtradb/include/btr0btr.ic @@ -267,7 +267,7 @@ btr_node_ptr_get_child_page_no( "InnoDB: a nonsensical page number 0" " in a node ptr record at offset %lu\n", (ulong) page_offset(rec)); - buf_page_print(page_align(rec), 0, 0); + buf_page_print(page_align(rec), 0); ut_ad(0); } diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h index 18c1cb4ff9d..3c0b125b412 100644 --- a/storage/xtradb/include/buf0buf.h +++ b/storage/xtradb/include/buf0buf.h @@ -718,26 +718,15 @@ buf_print(void); /*============*/ #endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */ #endif /* !UNIV_HOTBACKUP */ -enum buf_page_print_flags { - /** Do not crash at the end of buf_page_print(). */ - BUF_PAGE_PRINT_NO_CRASH = 1, - /** Do not print the full page dump. */ - BUF_PAGE_PRINT_NO_FULL = 2 -}; -/********************************************************************//** -Prints a page to stderr. */ +/** Dump a page to stderr. +@param[in] read_buf database page +@param[in] zip_size compressed page size, or 0 for uncompressed */ UNIV_INTERN void -buf_page_print( -/*===========*/ - const byte* read_buf, /*!< in: a database page */ - ulint zip_size, /*!< in: compressed page size, or - 0 for uncompressed pages */ - ulint flags) /*!< in: 0 or - BUF_PAGE_PRINT_NO_CRASH or - BUF_PAGE_PRINT_NO_FULL */ - UNIV_COLD; +buf_page_print(const byte* read_buf, ulint zip_size) + UNIV_COLD MY_ATTRIBUTE((nonnull)); + /********************************************************************//** Decompress a block. @return TRUE if successful */ diff --git a/storage/xtradb/include/page0page.ic b/storage/xtradb/include/page0page.ic index 80939bbb828..a2daf8adb32 100644 --- a/storage/xtradb/include/page0page.ic +++ b/storage/xtradb/include/page0page.ic @@ -772,7 +772,7 @@ page_rec_get_next_low( (void*) rec, (ulong) page_get_space_id(page), (ulong) page_get_page_no(page)); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); ut_error; } else if (offs == 0) { diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index e570f7ed494..4f4fc37c645 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -1721,7 +1721,7 @@ lock_sec_rec_some_has_impl( } else if (!lock_check_trx_id_sanity(max_trx_id, rec, index, offsets)) { - buf_page_print(page, 0, 0); + buf_page_print(page, 0); /* The page is corrupt: try to avoid a crash by returning 0 */ trx_id = 0; diff --git a/storage/xtradb/page/page0cur.cc b/storage/xtradb/page/page0cur.cc index 28368182b3e..05d84fd8985 100644 --- a/storage/xtradb/page/page0cur.cc +++ b/storage/xtradb/page/page0cur.cc @@ -903,7 +903,7 @@ page_cur_parse_insert_rec( ut_print_buf(stderr, ptr2, 300); putc('\n', stderr); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); ut_error; } diff --git a/storage/xtradb/page/page0page.cc b/storage/xtradb/page/page0page.cc index 1a8271de1e4..ab488c1bf77 100644 --- a/storage/xtradb/page/page0page.cc +++ b/storage/xtradb/page/page0page.cc @@ -154,7 +154,7 @@ page_dir_find_owner_slot( fputs("\n" "InnoDB: on that page!\n", stderr); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); ut_error; } @@ -618,10 +618,8 @@ page_copy_rec_list_end_no_locks( /* Track an assertion failure reported on the mailing list on June 18th, 2003 */ - buf_page_print(new_page, 0, - BUF_PAGE_PRINT_NO_CRASH); - buf_page_print(page_align(rec), 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(new_page, 0); + buf_page_print(page_align(rec), 0); ut_print_timestamp(stderr); fprintf(stderr, @@ -1945,7 +1943,8 @@ page_check_dir( fprintf(stderr, "InnoDB: Page directory corruption:" " infimum not pointed to\n"); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); + ut_ad(0); } if (UNIV_UNLIKELY(!page_rec_is_supremum_low(supremum_offs))) { @@ -1953,7 +1952,8 @@ page_check_dir( fprintf(stderr, "InnoDB: Page directory corruption:" " supremum not pointed to\n"); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); + ut_ad(0); } } #endif /* !UNIV_HOTBACKUP */ @@ -2671,7 +2671,8 @@ func_exit2: (ulong) page_get_space_id(page), (ulong) page_get_page_no(page), index->name); - buf_page_print(page, 0, 0); + buf_page_print(page, 0); + ut_ad(0); } return(ret); diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc index 3a25cca8a28..5b5a8b858e1 100644 --- a/storage/xtradb/row/row0sel.cc +++ b/storage/xtradb/row/row0sel.cc @@ -4294,8 +4294,7 @@ wrong_offs: if ((srv_force_recovery == 0 || moves_up == FALSE) && srv_pass_corrupt_table <= 1) { ut_print_timestamp(stderr); - buf_page_print(page_align(rec), 0, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(page_align(rec), 0); fprintf(stderr, "\nInnoDB: rec address %p," " buf block fix count %lu\n", From a793b7fd8bc2075d216b94150a62d289352c6abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 6 Sep 2017 15:57:42 +0300 Subject: [PATCH 10/18] Follow-up to MDEV-13227: Do not run unnecessary test combinations The bug only affected innodb_page_size=64k. There is no point running the test with smaller page sizes. --- mysql-test/suite/innodb/t/innodb-enlarge-blob.opt | 3 +-- mysql-test/suite/innodb/t/innodb-enlarge-blob.test | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/mysql-test/suite/innodb/t/innodb-enlarge-blob.opt b/mysql-test/suite/innodb/t/innodb-enlarge-blob.opt index 4c2cd9b3e3c..7cc886cb9e5 100644 --- a/mysql-test/suite/innodb/t/innodb-enlarge-blob.opt +++ b/mysql-test/suite/innodb/t/innodb-enlarge-blob.opt @@ -1,6 +1,5 @@ --innodb-file-per-table --innodb-file-format='Barracuda' --innodb-buffer-pool-size=32M ---innodb-log-file-size=32M +--innodb-page-size=64k --innodb-strict-mode=OFF - diff --git a/mysql-test/suite/innodb/t/innodb-enlarge-blob.test b/mysql-test/suite/innodb/t/innodb-enlarge-blob.test index 84c23465a5c..9fc6403db49 100644 --- a/mysql-test/suite/innodb/t/innodb-enlarge-blob.test +++ b/mysql-test/suite/innodb/t/innodb-enlarge-blob.test @@ -1,5 +1,4 @@ --source include/have_innodb.inc ---source include/innodb_page_size.inc # # MDEV-13227: Assertion failure len < 16384 in file rem0rec.cc line 1285 From 7008d4616421fdf73d109ed297def27fa4679da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 6 Sep 2017 16:13:20 +0300 Subject: [PATCH 11/18] Follow-up to MDEV-13227: Shorten the test The bug only affects ROW_FORMAT=DYNAMIC tables. It is reproducible already with 2 records in the table. Keep testing with ROW_FORMAT=REDUNDANT just in case. --- .../suite/innodb/r/innodb-enlarge-blob.result | 32 ++++--------------- .../suite/innodb/t/innodb-enlarge-blob.test | 32 ++++--------------- 2 files changed, 12 insertions(+), 52 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-enlarge-blob.result b/mysql-test/suite/innodb/r/innodb-enlarge-blob.result index e74e954e360..8c8e9cf5007 100644 --- a/mysql-test/suite/innodb/r/innodb-enlarge-blob.result +++ b/mysql-test/suite/innodb/r/innodb-enlarge-blob.result @@ -1,37 +1,17 @@ -CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB DEFAULT CHARSET=UTF8 ROW_FORMAT=DYNAMIC; +CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB ROW_FORMAT=REDUNDANT; SHOW WARNINGS; Level Code Message -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B'); -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -UPDATE t1 SET a=CONCAT(a, RAND(), a); +INSERT INTO t1 SET a=CONCAT('A', SPACE(8000), 'B'); +INSERT INTO t1 SELECT a FROM t1; UPDATE t1 SET a=CONCAT(a, RAND(), a); UPDATE t1 SET a=CONCAT(a, RAND(), a); SELECT * from t1; DROP TABLE t1; -CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB DEFAULT CHARSET=UTF8 ROW_FORMAT=REDUNDANT; +CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB ROW_FORMAT=DYNAMIC; SHOW WARNINGS; Level Code Message -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B'); -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -UPDATE t1 SET a=CONCAT(a, RAND(), a); +INSERT INTO t1 SET a=CONCAT('A', SPACE(8000), 'B'); +INSERT INTO t1 SELECT a FROM t1; UPDATE t1 SET a=CONCAT(a, RAND(), a); UPDATE t1 SET a=CONCAT(a, RAND(), a); SELECT * from t1; diff --git a/mysql-test/suite/innodb/t/innodb-enlarge-blob.test b/mysql-test/suite/innodb/t/innodb-enlarge-blob.test index 9fc6403db49..65a64d299be 100644 --- a/mysql-test/suite/innodb/t/innodb-enlarge-blob.test +++ b/mysql-test/suite/innodb/t/innodb-enlarge-blob.test @@ -4,20 +4,10 @@ # MDEV-13227: Assertion failure len < 16384 in file rem0rec.cc line 1285 # Crashes with innodb_page_size=64K. Does not crash at <= 32K. # -CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB DEFAULT CHARSET=UTF8 ROW_FORMAT=DYNAMIC; +CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB ROW_FORMAT=REDUNDANT; SHOW WARNINGS; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B'); -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -UPDATE t1 SET a=CONCAT(a, RAND(), a); +INSERT INTO t1 SET a=CONCAT('A', SPACE(8000), 'B'); +INSERT INTO t1 SELECT a FROM t1; UPDATE t1 SET a=CONCAT(a, RAND(), a); UPDATE t1 SET a=CONCAT(a, RAND(), a); # random data no output we are only interested if fails @@ -26,20 +16,10 @@ SELECT * from t1; --enable_result_log DROP TABLE t1; -CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB DEFAULT CHARSET=UTF8 ROW_FORMAT=REDUNDANT; +CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB ROW_FORMAT=DYNAMIC; SHOW WARNINGS; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B'); -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1; -UPDATE t1 SET a=CONCAT(a, RAND(), a); +INSERT INTO t1 SET a=CONCAT('A', SPACE(8000), 'B'); +INSERT INTO t1 SELECT a FROM t1; UPDATE t1 SET a=CONCAT(a, RAND(), a); UPDATE t1 SET a=CONCAT(a, RAND(), a); # random data no output we are only interested if fails From 2b387855df7be57a3017a5c211543574fa4364d4 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 6 Sep 2017 17:20:31 +0200 Subject: [PATCH 12/18] MDEV-13523: Group By in a View, called within a Stored Routine causes Error Code 1356 when a non-root user runs the routine for a second time it is actually test suite for second code chunk fix in MDEV-13439 --- mysql-test/r/view.result | 35 +++++++++++++++++++++++++++++++++++ mysql-test/t/view.test | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 81cc41e5ab3..d0b2675ebb2 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -6589,5 +6589,40 @@ use test; drop database test_db; drop user foo@localhost; # +# MDEV-13523: Group By in a View, called within a Stored Routine +# causes Error Code 1356 when a non-root user runs the routine for +# a second time +# +CREATE DATABASE bugTest; +USE bugTest; +CREATE TABLE `procViewTable` (`id` int(10), `someText` varchar(50) NOT NULL); +insert into `procViewTable` values (1,'Test'), (2,'Test 2'); +CREATE USER 'procView'@'%'; +GRANT ALL PRIVILEGES ON `bugTest`.* TO 'procView'@'%'; +CREATE DEFINER=`procView`@`%` VIEW `procViewSimple` AS ( +select * from ( +select `id` from `bugTest`.`procViewTable` + ) `innerQuery` + group by `innerQuery`.`id` +); +connect con1,localhost,procView,,; +use bugTest; +prepare stmt from "SELECT * FROM procViewSimple"; +execute stmt; +id +1 +2 +execute stmt; +id +1 +2 +disconnect con1; +connection default; +drop user procView; +drop view procViewSimple; +drop table procViewTable; +use test; +drop database bugTest; +# # End of 10.2 tests # diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index de7edd158e5..e2164e438dc 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -6306,6 +6306,44 @@ use test; drop database test_db; drop user foo@localhost; +--echo # +--echo # MDEV-13523: Group By in a View, called within a Stored Routine +--echo # causes Error Code 1356 when a non-root user runs the routine for +--echo # a second time +--echo # + +CREATE DATABASE bugTest; +USE bugTest; + +CREATE TABLE `procViewTable` (`id` int(10), `someText` varchar(50) NOT NULL); +insert into `procViewTable` values (1,'Test'), (2,'Test 2'); + +CREATE USER 'procView'@'%'; +GRANT ALL PRIVILEGES ON `bugTest`.* TO 'procView'@'%'; + +CREATE DEFINER=`procView`@`%` VIEW `procViewSimple` AS ( + select * from ( + select `id` from `bugTest`.`procViewTable` + ) `innerQuery` + group by `innerQuery`.`id` +); + +--connect (con1,localhost,procView,,) +use bugTest; + +prepare stmt from "SELECT * FROM procViewSimple"; +execute stmt; +execute stmt; + +# Cleanup +--disconnect con1 +--connection default +drop user procView; +drop view procViewSimple; +drop table procViewTable; +use test; +drop database bugTest; + --echo # --echo # End of 10.2 tests --echo # From b429e8cada73033611159ef9f02b54ad7afd888a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 6 Sep 2017 16:29:58 +0300 Subject: [PATCH 13/18] Mariabackup: Detach the threads at exit --- extra/mariabackup/backup_copy.cc | 2 +- extra/mariabackup/backup_mysql.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 7431d6c08eb..fb84153bdee 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -1938,7 +1938,7 @@ cleanup: ctxt->ret = ret; - os_thread_exit(NULL); + os_thread_exit(); OS_THREAD_DUMMY_RETURN; } diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 8fe2e186919..edd369e6ea9 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -840,7 +840,7 @@ stop_thread: os_event_set(kill_query_thread_stopped); - os_thread_exit(NULL); + os_thread_exit(); OS_THREAD_DUMMY_RETURN; } From c59a52b7bad473a162a51000f2a24507c83b5fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 6 Sep 2017 19:08:55 +0300 Subject: [PATCH 14/18] Fix nondeterministic failure of innodb.table_flags The files ibtmp1 and ib_buffer_pool are sometimes created, sometimes not. Remove them if they exist. --- mysql-test/suite/innodb/r/table_flags.result | 1 - mysql-test/suite/innodb/t/table_flags.test | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb/r/table_flags.result b/mysql-test/suite/innodb/r/table_flags.result index 5cf163ba4ae..435fe8fc45e 100644 --- a/mysql-test/suite/innodb/r/table_flags.result +++ b/mysql-test/suite/innodb/r/table_flags.result @@ -174,7 +174,6 @@ a SELECT * FROM tp; a DROP TABLE tr,tc,td,tz,tp; -ib_buffer_pool ib_logfile0 ib_logfile1 ibdata1 diff --git a/mysql-test/suite/innodb/t/table_flags.test b/mysql-test/suite/innodb/t/table_flags.test index d3dafa22318..b8ccc4ce4b6 100644 --- a/mysql-test/suite/innodb/t/table_flags.test +++ b/mysql-test/suite/innodb/t/table_flags.test @@ -194,6 +194,11 @@ DROP TABLE tr,tc,td,tz,tp; --let $restart_parameters= --source include/restart_mysqld.inc +--error 0,1 +--remove_file $bugdir/ibtmp1 +--error 0,1 +--remove_file $bugdir/ib_buffer_pool + --list_files $bugdir --remove_files_wildcard $bugdir --rmdir $bugdir From 3c45aa58950ef5a1906540ed339ba375d640e66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 6 Sep 2017 19:32:56 +0300 Subject: [PATCH 15/18] Fix a typo to silence -Wimplicit-fallthrough --- sql/sql_table.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0d539758b68..f838d59f1d1 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3021,10 +3021,9 @@ int prepare_create_field(Column_definition *sql_field, */ if (decimals >= FLOATING_POINT_DECIMALS) decimals= FLOATING_POINT_DECIMALS; - /* fall-trough */ + /* fall through */ case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_TIMESTAMP2: - /* fall-through */ default: sql_field->pack_flag=(FIELDFLAG_NUMBER | (sql_field->flags & UNSIGNED_FLAG ? 0 : From 3ec8268b4a328dd755414adce5cf14ebdac5677e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 7 Sep 2017 11:58:21 +0300 Subject: [PATCH 16/18] Follow-up to MDEV-13103: Do not add __attribute__((nonnull)) In XtraDB, buf_block_get_frame() can return NULL, and this value can be passed to buf_page_print(). Do not declare the parameter as nonnull. --- storage/xtradb/include/buf0buf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h index 3c0b125b412..5e656f1c585 100644 --- a/storage/xtradb/include/buf0buf.h +++ b/storage/xtradb/include/buf0buf.h @@ -725,7 +725,7 @@ buf_print(void); UNIV_INTERN void buf_page_print(const byte* read_buf, ulint zip_size) - UNIV_COLD MY_ATTRIBUTE((nonnull)); + UNIV_COLD; /********************************************************************//** Decompress a block. From ee844f6c346ffa009dda2fcb0588ae430479c71d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 7 Sep 2017 11:59:26 +0300 Subject: [PATCH 17/18] Make the SEARCH_ABORT logic actually work The SEARCH_ABORT logic was not working as intended (tests were not being aborted). --- mysql-test/include/search_pattern_in_file++.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/include/search_pattern_in_file++.inc b/mysql-test/include/search_pattern_in_file++.inc index 3c5529989bb..21192b55efb 100644 --- a/mysql-test/include/search_pattern_in_file++.inc +++ b/mysql-test/include/search_pattern_in_file++.inc @@ -76,5 +76,6 @@ perl; my $res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND"; $ENV{SEARCH_FILE} =~ s{^.*?([^/\\]+)$}{$1}; print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n"; - exit $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/; + die "$ENV{SEARCH_ABORT}\n" + if $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/; EOF From d861822c4f5c05dc7a0baa470212c823fc36fe4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 7 Sep 2017 12:01:07 +0300 Subject: [PATCH 18/18] MDEV-13253 After rebuilding redo logs, InnoDB can leak data from redo log buffer recv_reset_logs(): Initialize the redo log buffer, so that no data from the old redo log can be written to the new redo log. This bug has very little impact before MariaDB 10.2. The innodb_log_encrypt option that was introduced in MariaDB 10.1 increases the impact. If the redo log used to be encrypted, and it is being resized and encryption disabled, then previously encrypted data could end up being written to the new redo log in clear text. This resulted in encryption.innodb_encrypt_log test failures in MariaDB 10.2. --- storage/innobase/log/log0recv.cc | 1 + storage/xtradb/log/log0recv.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 5180f8b19c0..b99bd582b9a 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3472,6 +3472,7 @@ recv_reset_logs( log_sys->archived_lsn = log_sys->lsn; #endif /* UNIV_LOG_ARCHIVE */ + memset(log_sys->buf, 0, log_sys->buf_size); log_block_init(log_sys->buf, log_sys->lsn); log_block_set_first_rec_group(log_sys->buf, LOG_BLOCK_HDR_SIZE); diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc index 0872d231612..2316c35be71 100644 --- a/storage/xtradb/log/log0recv.cc +++ b/storage/xtradb/log/log0recv.cc @@ -3574,6 +3574,7 @@ recv_reset_logs( log_sys->tracked_lsn = log_sys->lsn; + memset(log_sys->buf, 0, log_sys->buf_size); log_block_init(log_sys->buf, log_sys->lsn); log_block_set_first_rec_group(log_sys->buf, LOG_BLOCK_HDR_SIZE);