diff options
33 files changed, 214 insertions, 239 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f3f206e29c7..d81743f3a1e 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5063,6 +5063,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()); @@ -5159,11 +5164,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; } diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 08d69e102b4..1e728bd162a 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -8087,6 +8087,34 @@ 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 # # MDEV-11081: CURSOR for query with GROUP BY 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.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..65a64d299be 100644 --- a/mysql-test/suite/innodb/t/innodb-enlarge-blob.test +++ b/mysql-test/suite/innodb/t/innodb-enlarge-blob.test @@ -1,24 +1,13 @@ --source include/have_innodb.inc ---source include/innodb_page_size.inc # # 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 @@ -27,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 diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index eacc8cb6a1a..e942059369c 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9549,6 +9549,37 @@ 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/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 f2cdb99b82b..a2e3667dbab 100644 --- a/plugin/metadata_lock_info/metadata_lock_info.cc +++ b/plugin/metadata_lock_info/metadata_lock_info.cc @@ -45,12 +45,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, @@ -129,8 +123,6 @@ static int i_s_metadata_lock_info_init( == MDL_key::NAMESPACE_END); compile_time_assert(sizeof(metadata_lock_info_lock_mode)/sizeof(LEX_STRING) == MDL_TYPE_END); - compile_time_assert(sizeof(metadata_lock_info_duration)/sizeof(LEX_STRING) - == MDL_DURATION_END); ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p; DBUG_ENTER("i_s_metadata_lock_info_init"); diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index c6ffe679c80..54c777975e0 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -7905,7 +7905,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/sql/sp.cc b/sql/sp.cc index 383eef9f5ce..a31b2a2cfc5 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -760,6 +760,7 @@ static sp_head *sp_compile(THD *thd, String *defstr, sql_mode_t 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 a31060179e4..473e1929369 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -579,7 +579,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) @@ -2110,8 +2110,26 @@ sp_head::execute_procedure(THD *thd, List<Item> *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 9f1745f2aab..ed9fef5116f 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -229,6 +229,7 @@ private: */ uint32 unsafe_flags; + uint m_select_number; public: inline Stored_program_creation_ctx *get_creation_ctx() { @@ -517,6 +518,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 diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index ad93238410e..eac8cf7c924 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1173,28 +1173,20 @@ buf_page_is_corrupted( } #ifndef UNIV_INNOCHECKSUM - -/** Prints a page to stderr. -@param[in] read_buf a database page -@param[in] page_size page size -@param[in] flags 0 or BUF_PAGE_PRINT_NO_CRASH or -BUF_PAGE_PRINT_NO_FULL */ +/** Dump a page to stderr. +@param[in] read_buf database page +@param[in] page_size page size */ +UNIV_INTERN void -buf_page_print( - const byte* read_buf, - const page_size_t& page_size, - ulint flags) +buf_page_print(const byte* read_buf, const page_size_t& page_size) { dict_index_t* index; - if (!(flags & BUF_PAGE_PRINT_NO_FULL)) { - - ib::info() << "Page dump in ascii and hex (" - << page_size.physical() << " bytes):"; + ib::info() << "Page dump in ascii and hex (" + << page_size.physical() << " bytes):"; - ut_print_buf(stderr, read_buf, page_size.physical()); - fputs("\nInnoDB: End of page dump\n", stderr); - } + ut_print_buf(stderr, read_buf, page_size.physical()); + fputs("\nInnoDB: End of page dump\n", stderr); if (page_size.is_compressed()) { /* Print compressed page. */ @@ -1359,8 +1351,6 @@ buf_page_print( stderr); break; } - - ut_ad(flags & BUF_PAGE_PRINT_NO_CRASH); } # ifdef PFS_GROUP_BUFFER_SYNC @@ -5984,8 +5974,7 @@ database_corrupted: << ". You may have to recover from " << "a backup."; - buf_page_print(frame, bpage->size, - BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(frame, bpage->size); ib::info() << "It is also possible that your" diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 17b2229f1da..2bc3630d3f5 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -827,7 +827,7 @@ buf_dblwr_assert_on_corrupt_block( /*==============================*/ const buf_block_t* block) /*!< in: block to check */ { - buf_page_print(block->frame, univ_page_size, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(block->frame, univ_page_size); ib::fatal() << "Apparent corruption of an index page " << block->page.id diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index cdf3d9bd997..5e7e5a2f21b 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -698,11 +698,12 @@ fil_space_encrypt( fprintf(stderr, "ok %d corrupted %d corrupted1 %d err %d different %d\n", ok , corrupted, corrupted1, err, different); fprintf(stderr, "src_frame\n"); - buf_page_print(src_frame, page_size, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(src_frame, page_size); fprintf(stderr, "encrypted_frame\n"); - buf_page_print(tmp, page_size, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(tmp, page_size); fprintf(stderr, "decrypted_frame\n"); - buf_page_print(tmp_mem, page_size, 0); + buf_page_print(tmp_mem, page_size); + ut_ad(0); } free(tmp_mem); diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index 0346a676a1f..58fbb4cd9ef 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -313,7 +313,8 @@ fil_compress_page( if (buf_page_is_corrupted(false, uncomp_page, univ_page_size, space)) { - buf_page_print(uncomp_page, univ_page_size, 0); + buf_page_print(uncomp_page, univ_page_size); + ut_ad(0); } ut_free(comp_page); @@ -648,6 +649,7 @@ err_exit: << " compression method: " << fil_get_compression_alg_name(compression_alg) << "."; - buf_page_print(buf, univ_page_size, 0); + buf_page_print(buf, univ_page_size); fil_space_release_for_io(space); + ut_ad(0); } diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 67de1174d25..516898066aa 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -893,24 +893,13 @@ buf_print(void); /*============*/ #endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */ -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. -@param[in] read_buf a database page -@param[in] page_size page size -@param[in] flags 0 or BUF_PAGE_PRINT_NO_CRASH or -BUF_PAGE_PRINT_NO_FULL */ +/** Dump a page to stderr. +@param[in] read_buf database page +@param[in] page_size page size */ +UNIV_INTERN void -buf_page_print( - const byte* read_buf, - const page_size_t& page_size, - ulint flags); - +buf_page_print(const byte* read_buf, const page_size_t& page_size) + ATTRIBUTE_COLD __attribute__((nonnull)); /********************************************************************//** Decompress a block. @return TRUE if successful */ diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index e4503cfdd4e..d83bb2c239a 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -1796,6 +1796,7 @@ rec_loop: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -1856,6 +1857,7 @@ skip_lock: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4597,6 +4599,7 @@ wait_table_again: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4679,6 +4682,7 @@ rec_loop: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4940,6 +4944,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/xtradb/btr/btr0btr.cc b/storage/xtradb/btr/btr0btr.cc index 85a083aaee0..29f03549899 100644 --- a/storage/xtradb/btr/btr0btr.cc +++ b/storage/xtradb/btr/btr0btr.cc @@ -77,10 +77,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 @@ -1601,11 +1600,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); @@ -2080,8 +2077,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" @@ -4609,7 +4606,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); @@ -4647,8 +4644,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); @@ -4925,8 +4921,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; } @@ -4934,8 +4930,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; @@ -4957,8 +4953,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)); @@ -5006,8 +5002,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); @@ -5039,10 +5035,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" @@ -5087,15 +5081,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 @@ -5113,18 +5101,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) @@ -5138,18 +5118,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 2f0428747d5..6891583554c 100644 --- a/storage/xtradb/btr/btr0sea.cc +++ b/storage/xtradb/btr/btr0sea.cc @@ -2022,9 +2022,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 01bec11d2ed..7eb0474091e 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -956,19 +956,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; @@ -979,14 +972,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. */ @@ -1141,8 +1132,6 @@ buf_page_print( stderr); break; } - - ut_ad(flags & BUF_PAGE_PRINT_NO_CRASH); } #ifndef UNIV_HOTBACKUP @@ -4832,8 +4821,8 @@ database_corrupted: space->name, bpage->space, 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)); ib_logf(IB_LOG_LEVEL_INFO, "It is also possible that your" diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc index 49371f9a6f1..4995df98165 100644 --- a/storage/xtradb/buf/buf0dblwr.cc +++ b/storage/xtradb/buf/buf0dblwr.cc @@ -800,7 +800,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/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index 81b1fd362af..167f9e48273 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -742,11 +742,12 @@ fil_space_encrypt( fprintf(stderr, "ok %d corrupted %d corrupted1 %d err %d different %d\n", ok , corrupted, corrupted1, err, different); fprintf(stderr, "src_frame\n"); - buf_page_print(src_frame, zip_size, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(src_frame, zip_size); fprintf(stderr, "encrypted_frame\n"); - buf_page_print(tmp, zip_size, BUF_PAGE_PRINT_NO_CRASH); + buf_page_print(tmp, zip_size); fprintf(stderr, "decrypted_frame\n"); - buf_page_print(tmp_mem, zip_size, 0); + buf_page_print(tmp_mem, zip_size); + ut_ad(0); } free(tmp_mem); diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc index 2b6ae95640f..7a61f17836b 100644 --- a/storage/xtradb/fil/fil0pagecompress.cc +++ b/storage/xtradb/fil/fil0pagecompress.cc @@ -397,7 +397,8 @@ fil_compress_page( fil_decompress_page(uncomp_page, comp_page, ulong(len), NULL); if (buf_page_is_corrupted(false, uncomp_page, 0, space)) { - buf_page_print(uncomp_page, 0, 0); + buf_page_print(uncomp_page, 0); + ut_ad(0); } ut_free(comp_page); diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc index b920c2ae594..e872198d927 100644 --- a/storage/xtradb/ibuf/ibuf0ibuf.cc +++ b/storage/xtradb/ibuf/ibuf0ibuf.cc @@ -4104,7 +4104,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); @@ -4723,15 +4723,13 @@ ibuf_merge_or_delete_for_page( fputs("InnoDB: cannot retrieve bitmap page\n", stderr); } else { - 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 0f5f025d6a3..9f13c9303ca 100644 --- a/storage/xtradb/include/btr0btr.ic +++ b/storage/xtradb/include/btr0btr.ic @@ -306,7 +306,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 1899165ace0..cdd535168e9 100644 --- a/storage/xtradb/include/buf0buf.h +++ b/storage/xtradb/include/buf0buf.h @@ -758,26 +758,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 364536b86f8..b37715b53be 100644 --- a/storage/xtradb/include/page0page.ic +++ b/storage/xtradb/include/page0page.ic @@ -771,7 +771,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 71612f66fcd..40ab9d9403c 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -1921,7 +1921,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 76e4c2aed9b..692cb393afd 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 3f8e47adafd..800f76e1532 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, @@ -1953,7 +1951,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))) { @@ -1961,7 +1960,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 */ @@ -2679,7 +2679,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 8e3ed3d1a4e..26fd7629a5d 100644 --- a/storage/xtradb/row/row0sel.cc +++ b/storage/xtradb/row/row0sel.cc @@ -1545,6 +1545,7 @@ rec_loop: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -1603,6 +1604,7 @@ skip_lock: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4186,6 +4188,7 @@ wait_table_again: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4281,6 +4284,7 @@ rec_loop: switch (err) { case DB_SUCCESS_LOCKED_REC: err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; default: @@ -4323,8 +4327,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", @@ -4569,6 +4572,7 @@ no_gap_lock: prebuilt->new_rec_locks = 1; } err = DB_SUCCESS; + /* fall through */ case DB_SUCCESS: break; case DB_LOCK_WAIT: |