From a794db9ade4d6e2d7802c84b05dcc25bb40ed681 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 22 Mar 2019 13:29:06 +0100 Subject: [PATCH 01/23] cmake: remove unused variable --- cmake/build_configurations/mysql_release.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 65ae04fcab1..657fa7eefed 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -96,18 +96,15 @@ ELSEIF(RPM) SET(WITH_ZLIB system CACHE STRING "") SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "") SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "") - SET(WITH_LIBARCHIVE ON CACHE STRING "") ELSEIF(DEB) SET(WITH_SSL system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "") SET(WITH_LIBWRAP ON) SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON) - SET(WITH_LIBARCHIVE ON CACHE STRING "") ELSE() SET(WITH_SSL bundled CACHE STRING "") SET(WITH_ZLIB bundled CACHE STRING "") SET(WITH_JEMALLOC static CACHE STRING "") - SET(WITH_LIBARCHIVE STATIC CACHE STRING "") ENDIF() IF(NOT COMPILATION_COMMENT) From 07c3e902100a92351977fc6fe08c3233ef92218c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 17 Mar 2019 17:18:46 +0100 Subject: [PATCH 02/23] MDEV-18954 numa dynamic dependency don't link with libnuma in release builds --- cmake/build_configurations/mysql_release.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 657fa7eefed..7753366add3 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -87,6 +87,7 @@ IF(FEATURE_SET) ENDIF() SET(WITH_INNODB_SNAPPY OFF CACHE STRING "") +SET(WITH_NUMA 0 CACHE BOOL "") IF(WIN32) SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "") SET(INSTALL_SQLBENCHDIR "" CACHE STRING "") From a523444eda55f587d7b7255cc821196accd0663d Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Mon, 28 May 2018 18:39:27 +0300 Subject: [PATCH 03/23] remove dead code --- sql/sql_lex.cc | 1 - sql/sql_lex.h | 16 +--------------- sql/sql_parse.cc | 4 +--- sql/sql_view.cc | 1 - 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index e75433eb417..c52005e7683 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -698,7 +698,6 @@ void LEX::start(THD *thd_arg) describe= 0; analyze_stmt= 0; explain_json= false; - subqueries= FALSE; context_analysis_only= 0; derived_tables= 0; safe_to_cache_query= 1; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 926b09ed3a7..84d156a4843 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -3034,7 +3034,7 @@ public: enum enum_yes_no_unknown tx_chain, tx_release; bool safe_to_cache_query; - bool subqueries, ignore; + bool ignore; st_parsing_options parsing_options; Alter_info alter_info; /* @@ -3053,7 +3053,6 @@ public: sp_name *spname; bool sp_lex_in_use; // Keep track on lex usage in SPs for error handling bool all_privileges; - bool proxy_priv; sp_pcontext *spcont; @@ -4140,18 +4139,6 @@ public: */ }; -/** - Input parameters to the parser. -*/ -struct Parser_input -{ - bool m_compute_digest; - - Parser_input() - : m_compute_digest(false) - {} -}; - /** Internal state of the parser. The complete state consist of: @@ -4179,7 +4166,6 @@ public: ~Parser_state() {} - Parser_input m_input; Lex_input_stream m_lip; Yacc_state m_yacc; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b8ed887b52d..7cc950f7d51 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7733,7 +7733,6 @@ mysql_new_select(LEX *lex, bool move_down, SELECT_LEX *select_lex) if (move_down) { SELECT_LEX_UNIT *unit; - lex->subqueries= TRUE; /* first select_lex of subselect or derived table */ if (!(unit= new (thd->mem_root) SELECT_LEX_UNIT())) DBUG_RETURN(1); @@ -10079,8 +10078,7 @@ bool parse_sql(THD *thd, Parser_state *parser_state, /* Start Digest */ parser_state->m_digest_psi= MYSQL_DIGEST_START(thd->m_statement_psi); - if (parser_state->m_input.m_compute_digest || - (parser_state->m_digest_psi != NULL)) + if (parser_state->m_digest_psi != NULL) { /* If either: diff --git a/sql/sql_view.cc b/sql/sql_view.cc index c2cb5902371..50416940960 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -1712,7 +1712,6 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, view_select->linkage= DERIVED_TABLE_TYPE; table->updatable= 0; table->effective_with_check= VIEW_CHECK_NONE; - old_lex->subqueries= TRUE; table->derived= &lex->unit; } From a97ca9fe5b30304ea28c1886758abbfa7c9cf5c1 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Tue, 29 May 2018 17:47:46 +0300 Subject: [PATCH 04/23] remove dead code --- sql/sql_derived.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/sql/sql_derived.h b/sql/sql_derived.h index 621a6e9ec24..abfdb007072 100644 --- a/sql/sql_derived.h +++ b/sql/sql_derived.h @@ -24,20 +24,6 @@ bool mysql_handle_derived(LEX *lex, uint phases); bool mysql_handle_single_derived(LEX *lex, TABLE_LIST *derived, uint phases); bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived); -/** - Cleans up the SELECT_LEX_UNIT for the derived table (if any). - - @param thd Thread handler - @param lex LEX for this thread - @param derived TABLE_LIST for the derived table - - @retval false Success - @retval true Failure -*/ -bool mysql_derived_cleanup(THD *thd, LEX *lex, TABLE_LIST *derived); - -Item *delete_not_needed_parts(THD *thd, Item *cond); - bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived); #endif /* SQL_DERIVED_INCLUDED */ From 53216091dd27f9bfc3cf4a47f0b883f878e7331d Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Tue, 29 May 2018 19:06:15 +0300 Subject: [PATCH 05/23] remove dead code --- sql/sql_lex.h | 5 ----- sql/vers_string.h | 4 ---- 2 files changed, 9 deletions(-) diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 84d156a4843..72ca4ac0b43 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -729,11 +729,6 @@ public: friend bool mysql_new_select(LEX *lex, bool move_down, SELECT_LEX *sel); friend bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, bool open_view_no_parse); - friend bool mysql_derived_prepare(THD *thd, LEX *lex, - TABLE_LIST *orig_table_list); - friend bool mysql_derived_merge(THD *thd, LEX *lex, - TABLE_LIST *orig_table_list); - friend bool TABLE_LIST::init_derived(THD *thd, bool init_view); private: void fast_exclude(); }; diff --git a/sql/vers_string.h b/sql/vers_string.h index 75abd40d5fa..3709cdbf786 100644 --- a/sql/vers_string.h +++ b/sql/vers_string.h @@ -97,8 +97,4 @@ public: typedef Lex_cstring_with_compare Lex_ident; typedef Lex_cstring_with_compare Lex_table_name; -#define XSTRING_WITH_LEN(X) (X).ptr(), (X).length() -#define DB_WITH_LEN(X) (X).db.str, (X).db.length -#define TABLE_NAME_WITH_LEN(X) (X).table_name.str, (X).table_name.length - #endif // VERS_STRING_INCLUDED From a07e29a0e5661d9506bdd63f92bb83f125aeac3b Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Tue, 29 May 2018 23:55:57 +0300 Subject: [PATCH 06/23] cleanup TABLE_SHARE --- sql/sql_show.cc | 6 +----- sql/table.h | 9 --------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e5dbfeed149..d9985406323 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -7288,11 +7288,7 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table, strlen(part_elem->tablespace_name), cs); else { - char *ts= showing_table->s->tablespace; - if(ts) - table->field[24]->store(ts, strlen(ts), cs); - else - table->field[24]->set_null(); + table->field[24]->set_null(); } } return; diff --git a/sql/table.h b/sql/table.h index 72f516aebdb..b7c14e0a606 100644 --- a/sql/table.h +++ b/sql/table.h @@ -745,9 +745,6 @@ struct TABLE_SHARE /* For sequence tables, the current sequence state */ SEQUENCE *sequence; - /* Name of the tablespace used for this table */ - char *tablespace; - #ifdef WITH_PARTITION_STORAGE_ENGINE /* filled in when reading from frm */ bool auto_partitioned; @@ -847,12 +844,6 @@ struct TABLE_SHARE set_table_cache_key(key_buff, key_length); } - inline bool honor_global_locks() - { - return ((table_category == TABLE_CATEGORY_USER) - || (table_category == TABLE_CATEGORY_SYSTEM)); - } - inline bool require_write_privileges() { return (table_category == TABLE_CATEGORY_LOG); From 8e9c5d1057abe14eeaa30ff47dec03f3594f5eca Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Thu, 31 May 2018 16:08:34 +0300 Subject: [PATCH 07/23] remove dead code --- sql/filesort.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sql/filesort.cc b/sql/filesort.cc index a4be9e4acfa..98c4e3b860b 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -36,11 +36,6 @@ #include "sql_select.h" #include "debug_sync.h" -/// How to write record_ref. -#define WRITE_REF(file,from) \ -if (my_b_write((file),(uchar*) (from),param->ref_length)) \ - DBUG_RETURN(1); - /* functions defined in this file */ static uchar *read_buffpek_from_file(IO_CACHE *buffer_file, uint count, From 67b601c5037a3b2cf4969aaa7a6f39dc1fd96610 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Fri, 1 Jun 2018 21:39:38 +0300 Subject: [PATCH 08/23] remove unused argument --- sql/sql_parse.cc | 3 +-- sql/sql_update.cc | 5 ++--- sql/sql_update.h | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7cc950f7d51..e3a017a491a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4579,8 +4579,7 @@ end_with_restore_list: select_lex->order_list.elements, select_lex->order_list.first, unit->select_limit_cnt, - lex->duplicates, lex->ignore, - &found, &updated); + lex->ignore, &found, &updated); MYSQL_UPDATE_DONE(res, found, updated); /* mysql_update return 2 if we need to switch to multi-update */ if (up_result != 2) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 959747acf28..1d7dec31d56 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -279,7 +279,6 @@ static void prepare_record_for_error_message(int error, TABLE *table) order_num number of elemen in ORDER BY clause order ORDER BY clause list limit limit clause - handle_duplicates how to handle duplicates RETURN 0 - OK @@ -294,8 +293,8 @@ int mysql_update(THD *thd, List &values, COND *conds, uint order_num, ORDER *order, - ha_rows limit, - enum enum_duplicates handle_duplicates, bool ignore, + ha_rows limit, + bool ignore, ha_rows *found_return, ha_rows *updated_return) { bool using_limit= limit != HA_POS_ERROR; diff --git a/sql/sql_update.h b/sql/sql_update.h index 4c6f89d8468..8457fe8f154 100644 --- a/sql/sql_update.h +++ b/sql/sql_update.h @@ -31,8 +31,7 @@ bool check_unique_table(THD *thd, TABLE_LIST *table_list); int mysql_update(THD *thd,TABLE_LIST *tables,List &fields, List &values,COND *conds, uint order_num, ORDER *order, ha_rows limit, - enum enum_duplicates handle_duplicates, bool ignore, - ha_rows *found_return, ha_rows *updated_return); + bool ignore, ha_rows *found_return, ha_rows *updated_return); bool mysql_multi_update(THD *thd, TABLE_LIST *table_list, List *fields, List *values, COND *conds, ulonglong options, From 2327d4e430e88b6ec0c58e474edfcbe2f73fdd21 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Wed, 20 Jun 2018 15:49:33 +0300 Subject: [PATCH 09/23] remove unused method --- sql/handler.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/handler.h b/sql/handler.h index 8aaedcc69b9..f3401bdfc48 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -4613,7 +4613,6 @@ public: virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } virtual int discard_or_import_tablespace(my_bool discard) { return (my_errno=HA_ERR_WRONG_COMMAND); } - virtual void prepare_for_alter() { return; } virtual void drop_table(const char *name); virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0; From 92d1c9611e44a1c254a8ba74a654b0911832f601 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Fri, 6 Jul 2018 13:10:38 +0300 Subject: [PATCH 10/23] remove dead code --- storage/innobase/include/ha_prototypes.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index 15107a93807..608a35841d2 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -556,20 +556,6 @@ innobase_index_cond( void* file) /*!< in/out: pointer to ha_innobase */ MY_ATTRIBUTE((warn_unused_result)); -/******************************************************************//** -Gets information on the durability property requested by thread. -Used when writing either a prepare or commit record to the log -buffer. -@return the durability property. */ - -#include - -enum durability_properties -thd_requested_durability( -/*=====================*/ - const THD* thd) /*!< in: thread handle */ - MY_ATTRIBUTE((warn_unused_result)); - /** Update the system variable with the given value of the InnoDB buffer pool size. @param[in] buf_pool_size given value of buffer pool size.*/ From 1d77a566eae9c883d2bc1760a84d6e48865c6274 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Mon, 23 Jul 2018 22:31:31 +0300 Subject: [PATCH 11/23] remove dead code --- storage/innobase/handler/ha_innodb.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 682cc5be9a3..89fba217d85 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -147,15 +147,12 @@ void close_thread_tables(THD* thd); #include #include "wsrep_sst.h" -extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log; - static inline wsrep_ws_handle_t* wsrep_ws_handle(THD* thd, const trx_t* trx) { return wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), (wsrep_trx_id_t)trx->id); } -extern TC_LOG* tc_log; extern void wsrep_cleanup_transaction(THD *thd); static int wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd, From dcdeb39480ecf048f3ce7886e498fb0eec646d60 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Wed, 1 Aug 2018 21:00:03 +0300 Subject: [PATCH 12/23] remove dead code found by @marko --- sql/structs.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/sql/structs.h b/sql/structs.h index 5cc392c33b7..1aa26eec4eb 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -148,9 +148,6 @@ typedef struct st_key { */ Index_statistics *collected_stats; - union { - int bdb_return_if_eq; - } handler; TABLE *table; LEX_CSTRING comment; /** reference to the list of options or NULL */ From 2d6e627a9f5f5d901dc02161d4cca8a6e72c0116 Mon Sep 17 00:00:00 2001 From: Chris Calender Date: Thu, 7 Feb 2019 01:23:28 -0500 Subject: [PATCH 13/23] Fix for MDEV-18276, typo in error message + all other occurrences of refering --- mysql-test/r/default.result | 16 ++++++++-------- .../gcol/r/gcol_column_def_options_innodb.result | 6 +++--- .../gcol/r/gcol_column_def_options_myisam.result | 6 +++--- mysql-test/suite/vcol/r/vcol_misc.result | 2 +- sql/item.cc | 2 +- sql/share/errmsg-utf8.txt | 2 +- sql/table.cc | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result index 8fa88066f7c..c2de5a578f1 100644 --- a/mysql-test/r/default.result +++ b/mysql-test/r/default.result @@ -434,7 +434,7 @@ drop table t1; # create table t1 (a int); create or replace table t1 (a int default b, b int default a); -ERROR 01000: Expression for field `a` is refering to uninitialized field `b` +ERROR 01000: Expression for field `a` is referring to uninitialized field `b` show create table t1; ERROR 42S02: Table 'test.t1' doesn't exist # @@ -451,16 +451,16 @@ create or replace table t1 (a varchar(128) default @@version); create or replace table t1 (a int not null, b int as (a)); create or replace table t1 (a int not null, b int default (a+1)); create or replace table t1 (a int default a); -ERROR 01000: Expression for field `a` is refering to uninitialized field `a` +ERROR 01000: Expression for field `a` is referring to uninitialized field `a` create or replace table t1 (a int default b, b int default (1+1)); create or replace table t1 (a int default 1, b int as (c), c int as (a+1)); -ERROR 01000: Expression for field `b` is refering to uninitialized field `c` +ERROR 01000: Expression for field `b` is referring to uninitialized field `c` CREATE TABLE t1 (a INT DEFAULT (DEFAULT(a))); -ERROR 01000: Expression for field `a` is refering to uninitialized field `a` +ERROR 01000: Expression for field `a` is referring to uninitialized field `a` CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT(DEFAULT(a))); -ERROR 01000: Expression for field `a` is refering to uninitialized field `b` +ERROR 01000: Expression for field `a` is referring to uninitialized field `b` CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)) NOT NULL, b INT DEFAULT(DEFAULT(a)) NOT NULL); -ERROR 01000: Expression for field `a` is refering to uninitialized field `b` +ERROR 01000: Expression for field `a` is referring to uninitialized field `b` # # Allow defaults to refer to not default fields # @@ -519,7 +519,7 @@ Got one of the listed errors CREATE TABLE t1 (a INT DEFAULT(?)); Got one of the listed errors CREATE TABLE t1 (a INT DEFAULT (b), b INT DEFAULT(a)); -ERROR 01000: Expression for field `a` is refering to uninitialized field `b` +ERROR 01000: Expression for field `a` is referring to uninitialized field `b` CREATE TABLE t1 (a INT DEFAULT(NAME_CONST('xxx', 'yyy')); ERROR HY000: Function or expression 'name_const()' cannot be used in the DEFAULT clause of `a` CREATE TABLE t1 (a INT DEFAULT COUNT(*)); @@ -3378,7 +3378,7 @@ a b t 4 5 5 the value of the DEFAULT(a), that is b drop table t1; create table t1 (col1 int default(-(default(col1)))); -ERROR 01000: Expression for field `col1` is refering to uninitialized field `col1` +ERROR 01000: Expression for field `col1` is referring to uninitialized field `col1` create table t1 (col int default (yearweek((exp(710))))); ERROR 22003: DOUBLE value is out of range in 'exp(710)' # diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result index e93d3bf025a..3bc5348b20a 100644 --- a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result @@ -255,9 +255,9 @@ a b c 4 -4 -3 drop table t1; create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual); -ERROR 01000: Expression for field `b` is refering to uninitialized field `b` +ERROR 01000: Expression for field `b` is referring to uninitialized field `b` create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual); -ERROR 01000: Expression for field `b` is refering to uninitialized field `c` +ERROR 01000: Expression for field `b` is referring to uninitialized field `c` create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int); ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk` # Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE @@ -277,7 +277,7 @@ drop table t1,tt; # THD->CHANGE_LIST.IS_EMPTY() # CREATE TABLE t1(a bigint AS (a between 1 and 1)); -ERROR 01000: Expression for field `a` is refering to uninitialized field `a` +ERROR 01000: Expression for field `a` is referring to uninitialized field `a` # Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES # IN FIND_FIELD_IN_TABLE # diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result index 563883adce0..56d048f1d7a 100644 --- a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result @@ -255,9 +255,9 @@ a b c 4 -4 -3 drop table t1; create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual); -ERROR 01000: Expression for field `b` is refering to uninitialized field `b` +ERROR 01000: Expression for field `b` is referring to uninitialized field `b` create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual); -ERROR 01000: Expression for field `b` is refering to uninitialized field `c` +ERROR 01000: Expression for field `b` is referring to uninitialized field `c` create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int); ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk` # Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE @@ -277,7 +277,7 @@ drop table t1,tt; # THD->CHANGE_LIST.IS_EMPTY() # CREATE TABLE t1(a bigint AS (a between 1 and 1)); -ERROR 01000: Expression for field `a` is refering to uninitialized field `a` +ERROR 01000: Expression for field `a` is referring to uninitialized field `a` # Bug#20757211: GENERATED COLUMNS: ALTER TABLE CRASHES # IN FIND_FIELD_IN_TABLE # diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index 62ae344365c..1de5fe8a0c1 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -316,7 +316,7 @@ drop table t1; # MDEV-5611: self-referencing virtual column # create table t1 (a int, b int as (b is null) virtual); -ERROR 01000: Expression for field `b` is refering to uninitialized field `b` +ERROR 01000: Expression for field `b` is referring to uninitialized field `b` create table t1 (a int as (1+1), b int as (a is null) virtual); drop table t1; # end of 5.3 tests diff --git a/sql/item.cc b/sql/item.cc index 6c605dba776..f7092eb6c86 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1006,7 +1006,7 @@ bool Item_field::register_field_in_write_map(void *arg) } /** - Check that we are not refering to any not yet initialized fields + Check that we are not referring to any not yet initialized fields Fields are initialized in this order: - All fields that have default value as a constant are initialized first. diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 8e54fa10ac5..333d7ee93ac 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7623,7 +7623,7 @@ ER_ERROR_EVALUATING_EXPRESSION ER_CALCULATING_DEFAULT_VALUE eng "Got an error when calculating default value for %`s" ER_EXPRESSION_REFERS_TO_UNINIT_FIELD 01000 - eng "Expression for field %`-.64s is refering to uninitialized field %`s" + eng "Expression for field %`-.64s is referring to uninitialized field %`s" ER_PARTITION_DEFAULT_ERROR eng "Only one DEFAULT partition allowed" ukr "Припустимо мати тільки один DEFAULT розділ" diff --git a/sql/table.cc b/sql/table.cc index 7c5410aed84..2cf21c889e2 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1129,7 +1129,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, if (check_constraint_ptr) *check_constraint_ptr= 0; - /* Check that expressions aren't refering to not yet initialized fields */ + /* Check that expressions aren't referring to not yet initialized fields */ for (field_ptr= table->field; *field_ptr; field_ptr++) { Field *field= *field_ptr; From 0e56eba9d510a92bc6344987502ed023b55e9dbe Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 22 Mar 2019 20:46:09 +0200 Subject: [PATCH 14/23] Updated list of unstable tests for 10.2.23 --- mysql-test/unstable-tests | 117 ++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 49 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 798294d7db1..290daa54671 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,27 +23,28 @@ # ############################################################################## -# Based on 10.2 65f22b8fd44c08ea190ed473b7e12b666b1fe60d +# Based on bb-10.2-release 07c3e902100a92351977fc6fe08c3233ef92218c main.alter_table : Modified in 10.2.22 main.alter_table_errors : Modified in 10.2.22 main.alter_table_trans : MDEV-12084 - timeout +main.analyze_stmt : Modified in 10.2.23 main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result main.auth_named_pipe : MDEV-14724 - System error 2 -main.bigint : Modified in 10.2.20 main.check : Modified in 10.2.22 -main.check_constraint : Modified in 10.2.22 +main.check_constraint : Modified in 10.2.23 main.check_constraint_innodb : Modified in 10.2.22 main.connect : MDEV-17282 - Wrong result; modified in 10.2.22 main.connect2 : MDEV-13885 - Server crash main.count_distinct2 : MDEV-11768 - timeout main.create_delayed : MDEV-10605 - failed with timeout main.create_drop_event : MDEV-16271 - Wrong result -main.cte_recursive : Modified in 10.2.20 +main.create_drop_role : Modified in 10.2.23 main.ctype_ucs : MDEV-17681 - Data too long for column main.ctype_upgrade : MDEV-16945 - Error upon mysql_upgrade main.ctype_utf16 : MDEV-10675: timeout or extra warnings main.debug_sync : MDEV-10607 - internal error +main.derived_cond_pushdown : Modified in 10.2.23 main.derived_opt : MDEV-11768 - timeout main.distinct : MDEV-14194 - Crash main.drop_bad_db_type : MDEV-15676 - Wrong result @@ -52,22 +53,26 @@ main.events_2 : MDEV-13277 - Crash main.events_bugs : MDEV-12892 - Crash main.events_restart : MDEV-12236 - Server shutdown problem main.events_slowlog : MDEV-12821 - Wrong result -main.func_default : Modified in 10.2.20 main.func_group_innodb : Modified in 10.2.22 +main.func_json : Modified in 10.2.23 +main.func_math : Modified in 10.2.23 main.func_misc : Modified in 10.2.22 -main.func_time : Modified in 10.2.20 +main.func_str : Modified in 10.2.23 +main.func_time : Modified in 10.2.23 main.gis : MDEV-13411 - wrong result on P8; modified in 10.2.22 -main.grant5 : Modified in 10.2.20 +main.gis-loaddata : Added in 10.2.23 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown main.huge_frm-6224 : Modified in 10.2.22 main.index_intersect_innodb : MDEV-10643 - failed with timeout main.index_merge_innodb : MDEV-7142 - Plan mismatch -main.information_schema : Modified in 10.2.20 main.information_schema-big : Modified in 10.2.22 main.innodb_mysql_lock : MDEV-7861 - Wrong result main.kill-2 : MDEV-13257 - Wrong result main.kill_processlist-6619 : MDEV-10793 - Wrong result -main.log_slow : MDEV-13263 - Wrong result +main.loaddata : Modified in 10.2.23 +main.loadxml : Modified in 10.2.23 +main.log_slow : MDEV-13263 - Wrong result; modified in 10.2.23 +main.log_slow_debug : Added in 10.2.23 main.log_tables-big : MDEV-13408 - wrong result main.lowercase_table : Modified in 10.2.22 main.mdev-504 : MDEV-15171 - warning @@ -79,6 +84,7 @@ main.mysql_client_test_nonblock : CONC-208 - Error on Power; MDEV-15096 - exe main.mysql_upgrade_noengine : MDEV-14355 - Wrong result main.mysql_upgrade_ssl : MDEV-13492 - Unknown SSL error main.mysqlbinlog_row_minimal : Modified in 10.2.22 +main.mysqld--help : Modified in 10.2.23 main.mysqld_option_err : Modified in 10.2.22 main.mysqldump : MDEV-14800 - Stack smashing detected; modified in 10.2.22 main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug @@ -87,15 +93,13 @@ main.mysqltest : MDEV-9269 - fails on Alpha; MDEV-13887 - Wr main.openssl_1 : MDEV-13492 - Unknown SSL error; modified in 10.2.22 main.openssl_6975 : MDEV-17184 - Failures with OpenSSL 1.1.1 main.order_by_optimizer_innodb : MDEV-10683 - Wrong result -main.partition : Modified in 10.2.20 -main.partition_alter : Modified in 10.2.20 +main.partition : Modified in 10.2.23 main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock -main.partition_innodb : Modified in 10.2.20 main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings main.ps : MDEV-11017 - Wrong result -main.ps_error : Added in 10.2.20 main.range_innodb : Modified in 10.2.22 main.read_only : Modified in 10.2.22 +main.reopen_temp_table : Modified in 10.2.23 main.reset_connection : Modified in 10.2.22 main.row-checksum : Modified in 10.2.22 main.query_cache : MDEV-16180 - Wrong result @@ -104,30 +108,37 @@ main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away main.set_statement : MDEV-13183 - Wrong result main.shm : MDEV-12727 - Mismatch, ERROR 2013 main.show_explain : MDEV-10674 - Wrong result code -main.sp : MDEV-7866 - Mismatch -main.sp_notembedded : MDEV-10607 - internal error +main.show_explain_ps : Modified in 10.2.23 +main.sp : MDEV-7866 - Mismatch; modified in 10.2.23 +main.sp_notembedded : MDEV-10607 - internal error; modified in 10.2.23 main.sp-security : MDEV-10607 - sporadic "can't connect" +main.sp_trans : Modified in 10.2.23 +main.sp-ucs2 : Modified in 10.2.23 main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1; modified in 10.2.22 main.ssl_ca : MDEV-10895 - SSL connection error on Power -main.ssl_cert_verify : MDEV-13735 - Server crash; modified in 10.2.22 main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1; modified in 10.2.22 main.ssl_connect : MDEV-13492 - Unknown SSL error +main.ssl_crl : Modified in 10.2.23 +main.ssl_crl_clients : Modified in 10.2.23 main.ssl_timeout : MDEV-11244 - Crash -main.stat_tables : Modified in 10.2.20 main.stat_tables_par : MDEV-13266 - Wrong result main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding main.status : MDEV-13255 - Wrong result main.subselect2 : Modified in 10.2.22 main.subselect_innodb : MDEV-10614 - Sporadic wrong results main.subselect_mat : Modified in 10.2.22 +main.subselect_sj : Modified in 10.2.23 +main.subselect_sj_mat : Modified in 10.2.23 main.tc_heuristic_recover : MDEV-14189 - Wrong result main.type_blob : MDEV-15195 - Wrong result main.type_datetime_hires : MDEV-10687 - Timeout -main.type_newdecimal : Modified in 10.2.20 -main.udf : Modified in 10.2.20 +main.type_year : Modified in 10.2.23 main.union : Modified in 10.2.22 -main.userstat : MDEV-12904 - SSL errors -main.win : Modified in 10.2.20 +main.update : Modified in 10.2.23 +main.userstat : MDEV-12904 - SSL errors; modified in 10.2.23 +main.view : Modified in 10.2.23 +main.wait_timeout : MDEV-19023 - Lost connection to MySQL server during query +main.win : Modified in 10.2.23 main.xa : MDEV-11769 - lock wait timeout #---------------------------------------------------------------- @@ -181,17 +192,17 @@ encryption.create_or_replace : MDEV-12694 - Timeout; MDEV-16 encryption.debug_key_management : MDEV-13841 - Timeout encryption.encrypt_and_grep : MDEV-13765 - Wrong result encryption.innochecksum : MDEV-13644 - Assertion failure -encryption.innodb-checksum-algorithm : MDEV-12898 - Deadlock of threads; MDEV-16896 - Server crash; modified in 10.2.20 +encryption.innodb-checksum-algorithm : MDEV-12898 - Deadlock of threads; MDEV-16896 - Server crash encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate encryption.innodb_encrypt_log : MDEV-13725 - Wrong result encryption.innodb_encryption : MDEV-15675 - Timeout -encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout; modified in 10.2.22 +encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout; modified in 10.2.23 encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash encryption.innodb_first_page : MDEV-10689 - Crash encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition -encryption.innodb-force-corrupt : MDEV-17286 - SSL error; modified in 10.2.20 +encryption.innodb-force-corrupt : MDEV-17286 - SSL error encryption.innodb_lotoftables : MDEV-16111 - Wrong result encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart encryption.innodb-page_encryption : MDEV-10641 - mutex problem @@ -254,22 +265,25 @@ innodb.101_compatibility : MDEV-13891 - Wrong result innodb.add_constraint : Modified in 10.2.22 innodb.alter_candidate_key : Added in 10.2.22 innodb.alter_copy : MDEV-16181 - Assertion failure -innodb.alter_crash : MDEV-16944 - The process cannot access the file +innodb.alter_crash : MDEV-16944 - The process cannot access the file; modified in 10.2.23 +innodb.alter_kill : Modified in 10.2.23 innodb.alter_inplace_perfschema : Modified in 10.2.22 +innodb.alter_table : Modified in 10.2.23 innodb.alter_varchar_change : Modified in 10.2.22 innodb.autoinc_persist : MDEV-15282 - Assertion failure innodb.binlog_consistent : MDEV-10618 - Server fails to start -innodb.data_types : Modified in 10.2.20 -innodb.default_row_format_create : Modified in 10.2.20 -innodb.doublewrite : MDEV-12905 - Server crash -innodb.foreign_key : Modified in 10.2.22 +innodb.doublewrite : MDEV-12905 - Server crash; modified in 10.2.23 +innodb.foreign_key : Modified in 10.2.23 +innodb.foreign-keys : Modified in 10.2.23 innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure +innodb.ibuf_not_empty : MDEV-19021 - Wrong result innodb.innodb_28867993 : Added in 10.2.22 innodb.innodb-32k-crash : MDEV-16953 - Corrupt log record found innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup innodb.innodb-alter : Modified in 10.2.22 innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS; modified in 10.2.22 +innodb.innodb-alter-nullable : Modified in 10.2.23 innodb.innodb-alter-table : MDEV-10619 - Testcase timeout innodb.innodb-alter-tempfile : MDEV-15285 - Table already exists innodb.innodb-blob : MDEV-12053 - Client crash @@ -279,12 +293,13 @@ innodb.innodb_bug30423 : MDEV-7311 - Wrong result innodb.innodb_bug48024 : MDEV-14352 - Assertion failure innodb.innodb_bug59641 : MDEV-13830 - Assertion failure innodb.innodb_bulk_create_index_replication : MDEV-15273 - Slave failed to start +innodb.innodb-corrupted-table : Modified in 10.2.23 innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown; modified in 10.2.22 innodb.innodb-fk-warnings : Modified in 10.2.22 innodb.innodb_force_recovery : Modified in 10.2.22 innodb.innodb-get-fk : MDEV-13276 - Server crash -innodb.innodb-index : Modified in 10.2.22 +innodb.innodb-index : Modified in 10.2.23 innodb.innodb-index-online : MDEV-14809 - Cannot save statistics; modified in 10.2.22 innodb.innodb_information_schema : MDEV-8851 - Wrong result innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed @@ -304,25 +319,25 @@ innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks innodb.log_corruption : MDEV-13251 - Wrong result innodb.log_data_file_size : MDEV-14204 - Server failed to start -innodb.log_file_name : MDEV-14193 - Exception +innodb.log_file_name : MDEV-14193 - Exception; modified in 10.2.23 innodb.log_file_size : MDEV-15668 - Not found pattern innodb.monitor : MDEV-16179 - Wrong result innodb.purge_secondary : MDEV-15681 - Wrong result innodb.purge_thread_shutdown : MDEV-13792 - Wrong result innodb.read_only_recovery : MDEV-13886 - Server crash -innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile +innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile; modified in 10.2.23 +innodb.restart : Modified in 10.2.23 innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace innodb.table_definition_cache_debug : MDEV-14206 - Extra warning -innodb.table_flags : MDEV-13572 - Wrong result; modified in 10.2.20 +innodb.table_flags : MDEV-13572 - Wrong result innodb.temp_table_savepoint : MDEV-16182 - Wrong result innodb.temporary_table : MDEV-13265 - Wrong result -innodb.truncate : Modified in 10.2.20 innodb.update_time : MDEV-14804 - Wrong result innodb.undo_truncate : MDEV-17340 - Server hung -innodb.undo_truncate_recover : MDEV-17679 - MySQL server has gone away +innodb.undo_truncate_recover : MDEV-17679 - MySQL server has gone away; modified in 10.2.23 innodb.xa_recovery : MDEV-15279 - mysqld got exception -innodb_fts.create : Modified in 10.2.20 +innodb_fts.fulltext3 : Modified in 10.2.23 innodb_fts.innodb-fts-fic : MDEV-14154 - Assertion failure innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log @@ -331,15 +346,16 @@ innodb_fts.sync : MDEV-14808 - Wrong result innodb_gis.kill_server : MDEV-16941 - Checksum mismatch innodb_gis.point_basic : Modified in 10.2.22 +innodb_gis.rtree_compress2 : MDEV-13942 - ASAN use-after-poison innodb_gis.rtree_concurrent_srch : MDEV-15284 - Wrong result with embedded innodb_gis.rtree_purge : MDEV-15275 - Timeout innodb_gis.rtree_recovery : MDEV-15274 - Error on check +innodb_gis.rtree_rollback1 : MDEV-13942 - ASAN use-after-poison innodb_gis.rtree_split : MDEV-14208 - Too many arguments innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file innodb_gis.types : MDEV-15679 - Table is marked as crashed innodb_zip.cmp_per_index : MDEV-14490 - Table is marked as crashed -innodb_zip.innochecksum : Modified in 10.2.20 innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings innodb_zip.wl6470_1 : MDEV-14240 - Assertion failure innodb_zip.wl6501_1 : MDEV-10891 - Can't create UNIX socket @@ -351,26 +367,25 @@ innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error maria.insert_select : MDEV-12757 - Timeout maria.insert_select-7314 : MDEV-16492 - Timeout maria.maria : MDEV-14430 - Extra warning +maria.maria-recovery : Modified in 10.2.23 #---------------------------------------------------------------- mariabackup.absolute_ibdata_paths : MDEV-14192 - Assertion failure mariabackup.apply-log-only : MDEV-14192 - Assertion failure mariabackup.apply-log-only-incr : MDEV-14192 - Assertion failure -mariabackup.backup_grants : Added in 10.2.20 mariabackup.backup_ssl : MDEV-14192 - Assertion failure mariabackup.data_directory : MDEV-15270 - Error on exec -mariabackup.drop_table_during_backup : Modified in 10.2.22 -mariabackup.encrypted_page_compressed : Added in 10.2.20 -mariabackup.encrypted_page_corruption : Added in 10.2.20 -mariabackup.unencrypted_page_compressed : Added in 10.2.20 +mariabackup.drop_table_during_backup : MDEV-14192 - Assertion failure; modified in 10.2.22 mariabackup.full_backup : MDEV-16571 - Wrong result mariabackup.huge_lsn : MDEV-15662 - Sequence number is in the future; opt file modified in 10.2.22 mariabackup.incremental_backup : MDEV-14192 - Assertion failure mariabackup.incremental_ddl_before_backup : Added in 10.2.22 mariabackup.incremental_encrypted : MDEV-15667 - Timeout; MDEV-14192 - Assertion failure +mariabackup.incremental_rocksdb : Added in 10.2.23 mariabackup.innodb_log_optimize_ddl : MDEV-14192 - Assertion failure mariabackup.mdev-14447 : MDEV-15201 - Timeout; modified in 10.2.22 +mariabackup.page_compression_level : Added in 10.2.23 mariabackup.partial_exclude : MDEV-15270 - Error on exec mariabackup.partition_partial : Opt file added in 10.2.22 mariabackup.rename_during_backup : MDEV-14192 - Assertion failure; modified in 10.2.22 @@ -385,6 +400,7 @@ mroonga/storage.column_datetime_32bit_2038 : Wrong resul mroonga/storage.column_datetime_32bit_before_unix_epoch : Wrong result on Alpha mroonga/storage.column_datetime_32bit_max : Wrong result on Alpha mroonga/storage.column_datetime_32bit_out_of_range : Wrong result on Alpha +mroonga/storage.column_generated_stored_add_column : Modified in 10.2.23 mroonga/storage.index_multiple_column_unique_date_32bit_equal : Wrong result on Alpha mroonga/storage.index_multiple_column_unique_date_order_32bit_desc : Wrong result on Alpha mroonga/storage.index_multiple_column_unique_datetime_index_read : MDEV-8643 - Valgrind @@ -406,6 +422,7 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_ parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query parts.partition_auto_increment_archive : MDEV-16491 - Marked as crashed and should be repaired parts.partition_auto_increment_maria : MDEV-14430 - Extra warning +parts.partition_auto_increment_max : Added in 10.2.23 parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist parts.partition_exch_qa_10 : MDEV-11765 - wrong result parts.partition_innodb_status_file : MDEV-12901 - Valgrind @@ -429,7 +446,6 @@ perfschema.hostcache_ipv6_addrinfo_bad_allow : MDEV-13260 - Crash perfschema.hostcache_ipv6_ssl : MDEV-10696 - Crash perfschema.privilege_table_io : MDEV-13184 - Extra lines perfschema.rpl_gtid_func : MDEV-16897 - Wrong result -perfschema.socket_connect : Modified in 10.2.20 perfschema.socket_summary_by_event_name_func : MDEV-10622 - Wrong result perfschema.stage_mdl_global : MDEV-11803 - wrong result on slow builders perfschema.stage_mdl_procedure : MDEV-11545 - Missing row @@ -476,7 +492,6 @@ rocksdb.ttl_secondary_read_filtering : MDEV-16560 - Wrong result rocksdb.unique_check : MDEV-16576 - Wrong errno rocksdb.use_direct_reads_writes : MDEV-16646 - Server crash rocksdb.write_sync : MDEV-16965 - WRong result -rocksdb.xa : Added in 10.2.20 rocksdb_rpl.mdev12179 : MDEV-16632 - Server crash rocksdb_rpl.rpl_binlog_xid_count : MDEV-16644 - Server crash @@ -487,7 +502,6 @@ rocksdb_sys_vars.rocksdb_update_cf_options : MDEV-16955 - Bytes lost #---------------------------------------------------------------- roles.create_and_grant_role : MDEV-11772 - wrong result -roles.flush_roles-17898 : Added in 10.2.20 #---------------------------------------------------------------- @@ -605,7 +619,6 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout #---------------------------------------------------------------- -sys_vars.aria_used_for_temp_tables_basic : Modified in 10.2.20 sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x sys_vars.delayed_insert_limit_func : MDEV-17683 - Wrong result sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error @@ -613,10 +626,13 @@ sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion sys_vars.slow_query_log_func : MDEV-14273 - Wrong result -sys_vars.sysvars_aria : Modified in 10.2.20 -sys_vars.table_definition_cache_basic : Modified in 10.2.22 +sys_vars.sql_buffer_result_func : Modified in 10.2.23 +sys_vars.sysvars_server_embedded : Include file modified in 10.2.23 +sys_vars.sysvars_server_notembedded : Include file modified in 10.2.23 sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result +sys_vars.thread_stack_basic : Modified in 10.2.23 sys_vars.tmp_disk_table_size_func : Modified in 10.2.22 +sys_vars.transaction_prealloc_size_bug27322 : MDEV-19024 - Wrong result sys_vars.wait_timeout_func : MDEV-12896 - Wrong result sys_vars.wsrep_sst_method_basic : Modified in 10.2.22 @@ -666,6 +682,7 @@ rpl-tokudb.* : MDEV-14354 - Tests fail with tcmalloc #---------------------------------------------------------------- unit.conc_basic-t : MDEV-15286 - not ok 7 - test_reconnect_maxpackage +unit.conc_errors : MDEV-18634 - ASAN global-buffer-overflow unit.conc_misc : MDEV-14811 - not ok 12 - test_conc49 unit.conc_ps_bugs : MDEV-13252 - not ok 44 test_bug4236 unit.lf : MDEV-18416 - object was probably modified after being freed @@ -675,15 +692,17 @@ unit.my_atomic : MDEV-18472 - Signal 11 thrown #---------------------------------------------------------------- vcol.not_supported : MDEV-10639 - Testcase timeout -vcol.upgrade : Modified in 10.2.20 vcol.vcol_keys : Modified in 10.2.22 vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout +vcol.vcol_keys_myisam : Modified in 10.2.23 vcol.vcol_misc : MDEV-16651 - Wrong error message +vcol.wrong_arena : Modified in 10.2.23 #---------------------------------------------------------------- wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node wsrep.mdev_6832 : MDEV-14195 - Check testcase failed +wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use wsrep.variables : MDEV-14311 - Wrong result; MDEV-17585 - Deadlock wsrep.wsrep-recover-v25 : Added in 10.2.22 From 77e2aca3f0795884e8221b30973709b62119fade Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 23 Mar 2019 11:27:30 +0100 Subject: [PATCH 15/23] cmake 3.14 new location for CPackRPM.cmake --- CMakeLists.txt | 3 ++- cmake/{ => Internal/CPack}/CPackRPM.cmake | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) rename cmake/{ => Internal/CPack}/CPackRPM.cmake (94%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 93392056cf5..73263535240 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,8 @@ ENDIF() MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}") -SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/Internal/CPack) # Use a default manufacturer if no manufacturer was identified. IF(NOT DEFINED MANUFACTURER) diff --git a/cmake/CPackRPM.cmake b/cmake/Internal/CPack/CPackRPM.cmake similarity index 94% rename from cmake/CPackRPM.cmake rename to cmake/Internal/CPack/CPackRPM.cmake index 326013f06b3..2729667e319 100644 --- a/cmake/CPackRPM.cmake +++ b/cmake/Internal/CPack/CPackRPM.cmake @@ -50,7 +50,11 @@ endif() # load the original CPackRPM.cmake set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) unset(CMAKE_MODULE_PATH) -include(CPackRPM) +if (CMAKE_VERSION VERSION_GREATER "3.12.99") + include(Internal/CPack/CPackRPM) +else() + include(CPackRPM) +endif() set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) restore(LICENSE) From f03f4da66373161d604b8ecf3c23ae18d08c0461 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 25 Mar 2019 07:43:07 +0400 Subject: [PATCH 16/23] SEQUENCE tests for MDEV-18892 Regression in slow log and admin statements Adding tests to cover how SEQUENCE related statements work in combination with the slow log configuration commands. --- mysql-test/include/log_slow_debug_common.inc | 20 +++++ mysql-test/main/log_slow_debug.result | 95 ++++++++++++++++++-- mysql-test/main/log_slow_debug.test | 84 ++++++----------- 3 files changed, 135 insertions(+), 64 deletions(-) create mode 100644 mysql-test/include/log_slow_debug_common.inc diff --git a/mysql-test/include/log_slow_debug_common.inc b/mysql-test/include/log_slow_debug_common.inc new file mode 100644 index 00000000000..f8c9075e1e2 --- /dev/null +++ b/mysql-test/include/log_slow_debug_common.inc @@ -0,0 +1,20 @@ +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; + +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; diff --git a/mysql-test/main/log_slow_debug.result b/mysql-test/main/log_slow_debug.result index 6409aed8535..2da10949315 100644 --- a/mysql-test/main/log_slow_debug.result +++ b/mysql-test/main/log_slow_debug.result @@ -25,7 +25,7 @@ $$ # # Expect all admin statements in the slow log (ON,DEFAULT) # -SET @@GLOBAL.log_slow_admin_statements=ON; +SET @@SESSION.log_slow_admin_statements=ON; SET log_slow_filter=DEFAULT; TRUNCATE TABLE mysql.slow_log; CREATE TABLE t1 (a INT); @@ -41,7 +41,13 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t4; -CALL show_slow_log_exclude_ps(); +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; +CALL show_slow_log(); sql_text [slow] TRUNCATE TABLE mysql.slow_log [slow] CREATE TABLE t1 (a INT) @@ -57,10 +63,16 @@ sql_text [slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 [slow] DEALLOCATE PREPARE stmt [slow] DROP TABLE t4 +[slow] CREATE SEQUENCE s4 +[slow] ALTER SEQUENCE s4 MAXVALUE 100 +[slow] PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101' +[slow] ALTER SEQUENCE s4 MAXVALUE=101 +[slow] DEALLOCATE PREPARE stmt +[slow] DROP SEQUENCE s4 # # Expect all admin statements in the slow log (ON,admin) # -SET @@GLOBAL.log_slow_admin_statements=ON; +SET @@SESSION.log_slow_admin_statements=ON; SET log_slow_filter=admin; TRUNCATE TABLE mysql.slow_log; CREATE TABLE t1 (a INT); @@ -76,6 +88,12 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t4; +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; CALL show_slow_log(); sql_text [slow] CREATE INDEX t1a ON t1 (a) @@ -83,10 +101,12 @@ sql_text [slow] ALTER TABLE t2 RENAME t2 [slow] RENAME TABLE t2 TO t3 [slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 +[slow] ALTER SEQUENCE s4 MAXVALUE 100 +[slow] ALTER SEQUENCE s4 MAXVALUE=101 # # Expect none of admin DDL statements in the slow log (ON,filesort) # -SET @@GLOBAL.log_slow_admin_statements=ON; +SET @@SESSION.log_slow_admin_statements=ON; SET log_slow_filter=filesort; TRUNCATE TABLE mysql.slow_log; CREATE TABLE t1 (a INT); @@ -102,12 +122,18 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t4; +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; CALL show_slow_log(); sql_text # # Expect none of admin statements in the slow log (OFF,DEFAULT) # -SET @@GLOBAL.log_slow_admin_statements=OFF; +SET @@SESSION.log_slow_admin_statements=OFF; SET log_slow_filter=DEFAULT; TRUNCATE TABLE mysql.slow_log; CREATE TABLE t1 (a INT); @@ -123,7 +149,58 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t4; -CALL show_slow_log_exclude_ps(); +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; +CALL show_slow_log(); +sql_text +[slow] TRUNCATE TABLE mysql.slow_log +[slow] CREATE TABLE t1 (a INT) +[slow] DROP TABLE t1 +[slow] CREATE TABLE t2 (a INT) +[slow] DROP TABLE t3 +[slow] CREATE TABLE t4 (a INT) +[slow] PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1' +[slow] DEALLOCATE PREPARE stmt +[slow] DROP TABLE t4 +[slow] CREATE SEQUENCE s4 +[slow] PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101' +[slow] DEALLOCATE PREPARE stmt +[slow] DROP SEQUENCE s4 +# +# Expect all admin statements in the slow log (GLOBAL OFF,LOCAL ON,DEFAULT) +# In the original implementation, this combination disabled slow log for admin commands. +# However, instead of this exception in GLOBAL vs LOCAL variable behaviour, +# we should make max_system_variables.log_slow_admin_statements=0 +# prevent enabling globally suppressed logging by setting the session variable to ON. +# +SET @@GLOBAL.log_slow_admin_statements=OFF; +SET @@SESSION.log_slow_admin_statements=ON; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +CREATE TABLE t1 (a INT); +CREATE INDEX t1a ON t1 (a); +DROP INDEX t1a ON t1; +DROP TABLE t1; +CREATE TABLE t2 (a INT); +ALTER TABLE t2 RENAME t2; +RENAME TABLE t2 TO t3; +DROP TABLE t3; +CREATE TABLE t4 (a INT); +PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t4; +CREATE SEQUENCE s4; +ALTER SEQUENCE s4 MAXVALUE 100; +PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP SEQUENCE s4; +CALL show_slow_log(); sql_text [slow] TRUNCATE TABLE mysql.slow_log [slow] CREATE TABLE t1 (a INT) @@ -139,6 +216,12 @@ sql_text [slow] ALTER TABLE t4 MODIFY a INT DEFAULT 1 [slow] DEALLOCATE PREPARE stmt [slow] DROP TABLE t4 +[slow] CREATE SEQUENCE s4 +[slow] ALTER SEQUENCE s4 MAXVALUE 100 +[slow] PREPARE stmt FROM 'ALTER SEQUENCE s4 MAXVALUE=101' +[slow] ALTER SEQUENCE s4 MAXVALUE=101 +[slow] DEALLOCATE PREPARE stmt +[slow] DROP SEQUENCE s4 # # Clean up # diff --git a/mysql-test/main/log_slow_debug.test b/mysql-test/main/log_slow_debug.test index 7945328fee3..5bacda31d93 100644 --- a/mysql-test/main/log_slow_debug.test +++ b/mysql-test/main/log_slow_debug.test @@ -34,45 +34,21 @@ DELIMITER ;$$ --echo # Expect all admin statements in the slow log (ON,DEFAULT) --echo # -SET @@GLOBAL.log_slow_admin_statements=ON; +SET @@SESSION.log_slow_admin_statements=ON; SET log_slow_filter=DEFAULT; TRUNCATE TABLE mysql.slow_log; -CREATE TABLE t1 (a INT); -CREATE INDEX t1a ON t1 (a); -DROP INDEX t1a ON t1; -DROP TABLE t1; -CREATE TABLE t2 (a INT); -ALTER TABLE t2 RENAME t2; -RENAME TABLE t2 TO t3; -DROP TABLE t3; -CREATE TABLE t4 (a INT); -PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -DROP TABLE t4; -CALL show_slow_log_exclude_ps(); +--source include/log_slow_debug_common.inc +CALL show_slow_log(); --echo # --echo # Expect all admin statements in the slow log (ON,admin) --echo # -SET @@GLOBAL.log_slow_admin_statements=ON; +SET @@SESSION.log_slow_admin_statements=ON; SET log_slow_filter=admin; TRUNCATE TABLE mysql.slow_log; -CREATE TABLE t1 (a INT); -CREATE INDEX t1a ON t1 (a); -DROP INDEX t1a ON t1; -DROP TABLE t1; -CREATE TABLE t2 (a INT); -ALTER TABLE t2 RENAME t2; -RENAME TABLE t2 TO t3; -DROP TABLE t3; -CREATE TABLE t4 (a INT); -PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -DROP TABLE t4; +--source include/log_slow_debug_common.inc CALL show_slow_log(); @@ -80,22 +56,10 @@ CALL show_slow_log(); --echo # Expect none of admin DDL statements in the slow log (ON,filesort) --echo # -SET @@GLOBAL.log_slow_admin_statements=ON; +SET @@SESSION.log_slow_admin_statements=ON; SET log_slow_filter=filesort; TRUNCATE TABLE mysql.slow_log; -CREATE TABLE t1 (a INT); -CREATE INDEX t1a ON t1 (a); -DROP INDEX t1a ON t1; -DROP TABLE t1; -CREATE TABLE t2 (a INT); -ALTER TABLE t2 RENAME t2; -RENAME TABLE t2 TO t3; -DROP TABLE t3; -CREATE TABLE t4 (a INT); -PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -DROP TABLE t4; +--source include/log_slow_debug_common.inc CALL show_slow_log(); @@ -103,23 +67,27 @@ CALL show_slow_log(); --echo # Expect none of admin statements in the slow log (OFF,DEFAULT) --echo # -SET @@GLOBAL.log_slow_admin_statements=OFF; +SET @@SESSION.log_slow_admin_statements=OFF; SET log_slow_filter=DEFAULT; TRUNCATE TABLE mysql.slow_log; -CREATE TABLE t1 (a INT); -CREATE INDEX t1a ON t1 (a); -DROP INDEX t1a ON t1; -DROP TABLE t1; -CREATE TABLE t2 (a INT); -ALTER TABLE t2 RENAME t2; -RENAME TABLE t2 TO t3; -DROP TABLE t3; -CREATE TABLE t4 (a INT); -PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -DROP TABLE t4; -CALL show_slow_log_exclude_ps(); +--source include/log_slow_debug_common.inc +CALL show_slow_log(); + + +--echo # +--echo # Expect all admin statements in the slow log (GLOBAL OFF,LOCAL ON,DEFAULT) +--echo # In the original implementation, this combination disabled slow log for admin commands. +--echo # However, instead of this exception in GLOBAL vs LOCAL variable behaviour, +--echo # we should make max_system_variables.log_slow_admin_statements=0 +--echo # prevent enabling globally suppressed logging by setting the session variable to ON. +--echo # + +SET @@GLOBAL.log_slow_admin_statements=OFF; +SET @@SESSION.log_slow_admin_statements=ON; +SET log_slow_filter=DEFAULT; +TRUNCATE TABLE mysql.slow_log; +--source include/log_slow_debug_common.inc +CALL show_slow_log(); --echo # From 71c781bfe758c1296095f99fa529276442b3a1ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 25 Mar 2019 10:29:25 +0200 Subject: [PATCH 17/23] MDEV-18090 Assertion failures due to virtual columns after upgrading to 10.2 MariaDB before MDEV-5800 in version 10.2.2 did not support indexed virtual columns. Non-persistent virtual columns were hidden from storage engines. Only starting with MDEV-5800, InnoDB would create internal metadata on virtual columns. Similar to what was done in MDEV-18084 and MDEV-18960, we adjust two more code paths for the old tables. ha_innobase::build_template(): Do not invoke dict_index_contains_col_or_prefix() for virtual columns if InnoDB does not store the metadata. innobase_build_col_map(): Relax an assertion about the number of columns. ha_innobase::omits_virtual_cols(): Renamed from omits_virtual_cols(). --- storage/innobase/handler/ha_innodb.cc | 18 +++++++----------- storage/innobase/handler/ha_innodb.h | 12 ++++++++++-- storage/innobase/handler/handler0alter.cc | 3 ++- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9366b2db30b..b448f71d6d0 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -275,12 +275,6 @@ void set_my_errno(int err) errno = err; } -static uint omits_virtual_cols(const TABLE_SHARE &share) -{ - return share.frm_version < FRM_VER_EXPRESSSIONS && - share.virtual_fields; -} - /** Checks whether the file name belongs to a partition of a table. @param[in] file_name file name @return pointer to the end of the table name part of the file name, or NULL */ @@ -7475,7 +7469,8 @@ build_template_needs_field( { const Field* field = table->field[i]; - if (!field->stored_in_db() && omits_virtual_cols(*table->s)) { + if (!field->stored_in_db() + && ha_innobase::omits_virtual_cols(*table->s)) { return NULL; } @@ -7632,7 +7627,7 @@ build_template_field( &templ->rec_prefix_field_no); } } else { - ut_ad(!omits_virtual_cols(*table->s)); + DBUG_ASSERT(!ha_innobase::omits_virtual_cols(*table->s)); col = &dict_table_get_nth_v_col(index->table, v_no)->m_col; templ->clust_rec_field_no = v_no; templ->rec_prefix_field_no = ULINT_UNDEFINED; @@ -8019,7 +8014,8 @@ no_icp: contain = dict_index_contains_col_or_prefix( index, i - num_v, false); - } else if (dict_index_is_clust(index)) { + } else if (skip_virtual + || dict_index_is_clust(index)) { num_v++; continue; } else { @@ -8521,7 +8517,7 @@ calc_row_difference( trx_t* const trx = prebuilt->trx; doc_id_t doc_id = FTS_NULL_DOC_ID; ulint num_v = 0; - const bool skip_virtual = omits_virtual_cols(*table->s); + const bool skip_virtual = ha_innobase::omits_virtual_cols(*table->s); ut_ad(!srv_read_only_mode); @@ -11063,7 +11059,7 @@ create_table_info_t::create_table_def() /* Find out the number of virtual columns. */ ulint num_v = 0; - const bool omit_virtual = omits_virtual_cols(*m_form->s); + const bool omit_virtual = ha_innobase::omits_virtual_cols(*m_form->s); const ulint n_cols = omit_virtual ? m_form->s->stored_fields : m_form->s->fields; diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 76a9b08c4c6..9311056bde5 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -22,6 +22,8 @@ this program; if not, write to the Free Software Foundation, Inc., # include "../../../wsrep/wsrep_api.h" #endif /* WITH_WSREP */ +#include "table.h" + /* The InnoDB handler: the interface between MySQL and InnoDB. */ /** "GEN_CLUST_INDEX" is the name reserved for InnoDB default @@ -412,8 +414,15 @@ public: Item* idx_cond_push(uint keyno, Item* idx_cond); /* @} */ -protected: + /** Check if InnoDB is not storing virtual column metadata for a table. + @param s table definition (based on .frm file) + @return whether InnoDB will omit virtual column metadata */ + static bool omits_virtual_cols(const TABLE_SHARE& s) + { + return s.frm_version= altered_table->s->fields + DATA_N_SYS_COLS); DBUG_ASSERT(dict_table_get_n_cols(old_table) + dict_table_get_n_v_cols(old_table) - >= table->s->fields + DATA_N_SYS_COLS); + >= table->s->fields + DATA_N_SYS_COLS + || ha_innobase::omits_virtual_cols(*table->s)); DBUG_ASSERT(!!add_cols == !!(ha_alter_info->handler_flags & Alter_inplace_info::ADD_COLUMN)); DBUG_ASSERT(!add_cols || dtuple_get_n_fields(add_cols) From b59d4846962f516c3026788407a4e4c6af857dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 22 Mar 2019 19:16:45 +0200 Subject: [PATCH 18/23] MDEV-14126: Remove page_is_root() The predicate page_is_root(), which was added in MariaDB Server 10.2.2, is based on a wrong assumption. Under some circumstances, InnoDB can transform B-trees into a degenerate state where a non-leaf page has no sibling pages. Because of this, we cannot assume that a page that has no siblings is the root page. This bug will be tracked as MDEV-19022. Because of the bug that may affect many InnoDB data files, we must remove and replace the wrong predicate. Using the wrong predicate can cause corruption. A leaf page is not allowed to be empty except if it is the root page, and the entire table is empty. --- storage/innobase/btr/btr0btr.cc | 41 +++++++++++++++----------- storage/innobase/btr/btr0cur.cc | 10 ++++--- storage/innobase/btr/btr0defragment.cc | 5 ++-- storage/innobase/include/page0page.h | 21 ++++++++----- storage/innobase/include/page0page.ic | 30 ++----------------- storage/innobase/page/page0cur.cc | 5 +++- storage/innobase/page/page0page.cc | 6 ++-- storage/innobase/page/page0zip.cc | 4 +-- storage/innobase/row/row0import.cc | 6 ++-- 9 files changed, 62 insertions(+), 66 deletions(-) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index d06568535e6..5b1e7e1b853 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -378,8 +378,7 @@ btr_root_adjust_on_import( page = buf_block_get_frame(block); page_zip = buf_block_get_page_zip(block); - if (!page_is_root(page)) { - + if (!fil_page_index_page_check(page) || page_has_siblings(page)) { err = DB_CORRUPTION; } else if (dict_index_is_clust(index)) { @@ -1161,11 +1160,11 @@ btr_free_root_check( buf_block_dbg_add_level(block, SYNC_TREE_NODE); if (fil_page_index_page_check(block->frame) - && index_id == btr_page_get_index_id(block->frame)) { + && index_id == btr_page_get_index_id(block->frame)) { /* This should be a root page. It should not be possible to reassign the same index_id for some other index in the tablespace. */ - ut_ad(page_is_root(block->frame)); + ut_ad(!page_has_siblings(block->frame)); } else { block = NULL; } @@ -1358,7 +1357,8 @@ btr_free_but_not_root( ibool finished; mtr_t mtr; - ut_ad(page_is_root(block->frame)); + ut_ad(fil_page_index_page_check(block->frame)); + ut_ad(!page_has_siblings(block->frame)); leaf_loop: mtr_start(&mtr); mtr_set_log_mode(&mtr, log_mode); @@ -1430,7 +1430,6 @@ btr_free_if_exists( return; } - ut_ad(page_is_root(root->frame)); btr_free_but_not_root(root, mtr->get_log_mode()); mtr->set_named_space(page_id.space()); btr_free_root(root, mtr); @@ -1453,8 +1452,6 @@ btr_free( page_id, page_size, RW_X_LATCH, &mtr); if (block) { - ut_ad(page_is_root(block->frame)); - btr_free_but_not_root(block, MTR_LOG_NO_REDO); btr_free_root(block, &mtr); } @@ -1614,12 +1611,17 @@ btr_page_reorganize_low( ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); btr_assert_not_corrupted(block, index); + ut_ad(fil_page_index_page_check(block->frame)); + ut_ad(index->is_dummy + || block->page.id.space() == index->space); + ut_ad(index->is_dummy + || block->page.id.page_no() != index->page + || !page_has_siblings(page)); #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ data_size1 = page_get_data_size(page); max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1); - /* Turn logging off */ mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE); @@ -1677,7 +1679,7 @@ btr_page_reorganize_low( || page_get_max_trx_id(page) == 0 || (dict_index_is_sec_or_ibuf(index) ? page_is_leaf(temp_page) - : page_is_root(temp_page))); + : block->page.id.page_no() == index->page)); /* If innodb_log_compressed_pages is ON, page reorganize should log the compressed page image.*/ @@ -1894,6 +1896,8 @@ btr_page_empty( ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); ut_ad(page_zip == buf_block_get_page_zip(block)); + ut_ad(!index->is_dummy); + ut_ad(index->space == block->page.id.space()); #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ @@ -1906,7 +1910,8 @@ btr_page_empty( /* Preserve PAGE_ROOT_AUTO_INC when creating a clustered index root page. */ const ib_uint64_t autoinc - = dict_index_is_clust(index) && page_is_root(page) + = dict_index_is_clust(index) + && index->page == block->page.id.page_no() ? page_get_autoinc(page) : 0; @@ -4225,6 +4230,8 @@ btr_discard_only_page_on_level( ulint page_level = 0; trx_id_t max_trx_id; + ut_ad(!index->is_dummy); + /* Save the PAGE_MAX_TRX_ID from the leaf page. */ max_trx_id = page_get_max_trx_id(buf_block_get_frame(block)); @@ -4235,11 +4242,10 @@ btr_discard_only_page_on_level( ut_a(page_get_n_recs(page) == 1); ut_a(page_level == btr_page_get_level(page, mtr)); - ut_a(btr_page_get_prev(page, mtr) == FIL_NULL); - ut_a(btr_page_get_next(page, mtr) == FIL_NULL); - - ut_ad(mtr_is_block_fix( - mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); + ut_a(!page_has_siblings(page)); + ut_ad(fil_page_index_page_check(page)); + ut_ad(block->page.id.space() == index->space); + ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); btr_search_drop_page_hash_index(block); if (dict_index_is_spatial(index)) { @@ -4265,6 +4271,7 @@ btr_discard_only_page_on_level( /* block is the root page, which must be empty, except for the node pointer to the (now discarded) block(s). */ + ut_ad(!page_has_siblings(block->frame)); #ifdef UNIV_BTR_DEBUG if (!dict_index_is_ibuf(index)) { diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index f1ecaca3b54..37372af4b44 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3,7 +3,7 @@ Copyright (c) 1994, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2015, 2018, MariaDB Corporation. +Copyright (c) 2015, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -5113,14 +5113,14 @@ btr_cur_optimistic_delete_func( ut_ad(flags == 0 || flags == BTR_CREATE_FLAG); ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(cursor), MTR_MEMO_PAGE_X_FIX)); - ut_ad(mtr_is_block_fix(mtr, btr_cur_get_block(cursor), - MTR_MEMO_PAGE_X_FIX, cursor->index->table)); ut_ad(mtr->is_named_space(cursor->index->space)); + ut_ad(!cursor->index->is_dummy); /* This is intended only for leaf page deletions */ block = btr_cur_get_block(cursor); + ut_ad(block->page.id.space() == cursor->index->space); ut_ad(page_is_leaf(buf_block_get_frame(block))); ut_ad(!dict_index_is_online_ddl(cursor->index) || dict_index_is_clust(cursor->index) @@ -5242,8 +5242,10 @@ btr_cur_pessimistic_delete( ut_ad(mtr_memo_contains_flagged(mtr, dict_index_get_lock(index), MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); - ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); + ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr->is_named_space(index->space)); + ut_ad(!index->is_dummy); + ut_ad(block->page.id.space() == index->space); if (!has_reserved_extents) { /* First reserve enough free space for the file segments diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index 036e2ea776c..077cf8a1c73 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2013, 2014 Facebook, Inc. All Rights Reserved. -Copyright (C) 2014, 2017, MariaDB Corporation. +Copyright (C) 2014, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -181,7 +181,8 @@ btr_defragment_add_index( return NULL; } - ut_ad(page_is_root(page)); + ut_ad(fil_page_index_page_check(page)); + ut_ad(!page_has_siblings(page)); if (page_is_leaf(page)) { // Index root is a leaf page, no need to defragment. diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 832e3d2170f..18c536c05e9 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -1,6 +1,6 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -684,14 +684,19 @@ ulint page_rec_get_heap_no( /*=================*/ const rec_t* rec); /*!< in: the physical record */ -/** Determine whether a page is an index root page. + +/** Determine whether a page has any siblings. @param[in] page page frame -@return true if the page is a root page of an index */ -UNIV_INLINE -bool -page_is_root( - const page_t* page) - MY_ATTRIBUTE((warn_unused_result)); +@return true if the page has any siblings */ +inline bool page_has_siblings(const page_t* page) +{ + compile_time_assert(!(FIL_PAGE_PREV % 8)); + compile_time_assert(FIL_PAGE_NEXT == FIL_PAGE_PREV + 4); + compile_time_assert(FIL_NULL == 0xffffffff); + return *reinterpret_cast(page + FIL_PAGE_PREV) + != ~uint64_t(0); +} + /************************************************************//** Gets the pointer to the next record on the page. @return pointer to next record */ diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index 0062db56bfa..d1efca1d244 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2017, MariaDB Corporation. +Copyright (c) 2016, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -91,7 +91,8 @@ UNIV_INLINE ib_uint64_t page_get_autoinc(const page_t* page) { - ut_ad(page_is_root(page)); + ut_ad(fil_page_index_page_check(page)); + ut_ad(!page_has_siblings(page)); return(mach_read_from_8(PAGE_HEADER + PAGE_ROOT_AUTO_INC + page)); } @@ -277,31 +278,6 @@ page_rec_get_heap_no( } } -/** Determine whether a page is an index root page. -@param[in] page page frame -@return true if the page is a root page of an index */ -UNIV_INLINE -bool -page_is_root( - const page_t* page) -{ -#if FIL_PAGE_PREV % 8 -# error FIL_PAGE_PREV must be 64-bit aligned -#endif -#if FIL_PAGE_NEXT != FIL_PAGE_PREV + 4 -# error FIL_PAGE_NEXT must be adjacent to FIL_PAGE_PREV -#endif -#if FIL_NULL != 0xffffffff -# error FIL_NULL != 0xffffffff -#endif - /* Check that this is an index page and both the PREV and NEXT - pointers are FIL_NULL, because the root page does not have any - siblings. */ - return(fil_page_index_page_check(page) - && *reinterpret_cast(page + FIL_PAGE_PREV) - == IB_UINT64_MAX); -} - /** Determine whether an index page record is a user record. @param[in] rec record in an index page @return true if a user record */ diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index 2327d11f1fa..ae46d1e71ce 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2018, MariaDB Corporation. +Copyright (c) 2018, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1990,6 +1990,8 @@ page_parse_copy_rec_list_to_created_page( return(rec_end); } + ut_ad(fil_page_index_page_check(block->frame)); + while (ptr < rec_end) { ptr = page_cur_parse_insert_rec(TRUE, ptr, end_ptr, block, index, mtr); @@ -2045,6 +2047,7 @@ page_copy_rec_list_end_to_created_page( ut_ad(page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW); ut_ad(page_align(rec) != new_page); ut_ad(page_rec_is_comp(rec) == page_is_comp(new_page)); + ut_ad(fil_page_index_page_check(new_page)); if (page_rec_is_infimum(rec)) { diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index cb2a545e6e2..be426ec4927 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -526,6 +526,8 @@ page_create_empty( page_zip_des_t* page_zip= buf_block_get_page_zip(block); ut_ad(fil_page_index_page_check(page)); + ut_ad(!index->is_dummy); + ut_ad(block->page.id.space() == index->space); /* Multiple transactions cannot simultaneously operate on the same temp-table in parallel. @@ -536,7 +538,7 @@ page_create_empty( && page_is_leaf(page)) { max_trx_id = page_get_max_trx_id(page); ut_ad(max_trx_id); - } else if (page_is_root(page)) { + } else if (block->page.id.page_no() == index->page) { /* Preserve PAGE_ROOT_AUTO_INC. */ max_trx_id = page_get_max_trx_id(page); } else { diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 50e22059e7d..811b5d88947 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -2,7 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2018, MariaDB Corporation. +Copyright (c) 2014, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -4727,7 +4727,7 @@ page_zip_reorganize( clustered index root pages. */ ut_ad(page_get_max_trx_id(page) == 0 || (dict_index_is_clust(index) - ? page_is_root(temp_page) + ? !page_has_siblings(temp_page) : page_is_leaf(temp_page))); /* Restore logging. */ diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index b9c18ca6a4e..159535fba19 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -668,7 +668,7 @@ dberr_t FetchIndexRootPages::operator()(buf_block_t* block) UNIV_NOTHROW return set_current_xdes(block->page.id.page_no(), page); } else if (fil_page_index_page_check(page) && !is_free(block->page.id.page_no()) - && page_is_root(page)) { + && !page_has_siblings(page)) { index_id_t id = btr_page_get_index_id(page); @@ -1834,7 +1834,7 @@ PageConverter::update_index_page( page, m_page_zip_ptr, m_index->m_srv_index->id, 0); if (dict_index_is_clust(m_index->m_srv_index)) { - if (page_is_root(page)) { + if (block->page.id.page_no() == m_index->m_srv_index->page) { /* Preserve the PAGE_ROOT_AUTO_INC. */ } else { /* Clear PAGE_MAX_TRX_ID so that it can be @@ -1854,7 +1854,7 @@ PageConverter::update_index_page( if (page_is_empty(page)) { /* Only a root page can be empty. */ - if (!page_is_root(page)) { + if (page_has_siblings(page)) { // TODO: We should relax this and skip secondary // indexes. Mark them as corrupt because they can // always be rebuilt. From a4d0d6828bb46c1a1b0049ebfd9c5c136a7a7862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 22 Mar 2019 19:19:34 +0200 Subject: [PATCH 19/23] MDEV-14126: Improve assertions in btr_pcur_store_position() --- storage/innobase/btr/btr0pcur.cc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 2b85c764a3b..7948c0031c8 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2017, MariaDB Corporation. +Copyright (c) 2016, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -100,7 +100,6 @@ btr_pcur_store_position( buf_block_t* block; rec_t* rec; dict_index_t* index; - page_t* page; ulint offs; ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED); @@ -112,9 +111,8 @@ btr_pcur_store_position( page_cursor = btr_pcur_get_page_cur(cursor); rec = page_cur_get_rec(page_cursor); - page = page_align(rec); - offs = page_offset(rec); - + offs = rec - block->frame; + ut_ad(block->page.id.page_no() == page_get_page_no(block->frame)); ut_ad(block->page.buf_fix_count); /* For spatial index, when we do positioning on parent buffer if necessary, it might not hold latches, but the @@ -127,17 +125,16 @@ btr_pcur_store_position( mtr, dict_index_get_lock(index), MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK))); - if (page_is_empty(page)) { + cursor->old_stored = true; + + if (page_is_empty(block->frame)) { /* It must be an empty index tree; NOTE that in this case we do not store the modify_clock, but always do a search if we restore the cursor position */ - ut_a(btr_page_get_next(page, mtr) == FIL_NULL); - ut_a(btr_page_get_prev(page, mtr) == FIL_NULL); - ut_ad(page_is_leaf(page)); - ut_ad(page_get_page_no(page) == index->page); - - cursor->old_stored = true; + ut_a(!page_has_siblings(block->frame)); + ut_ad(page_is_leaf(block->frame)); + ut_ad(block->page.id.page_no() == index->page); if (page_rec_is_supremum_low(offs)) { @@ -164,7 +161,6 @@ btr_pcur_store_position( cursor->rel_pos = BTR_PCUR_ON; } - cursor->old_stored = true; cursor->old_rec = dict_index_copy_rec_order_prefix( index, rec, &cursor->old_n_fields, &cursor->old_rec_buf, &cursor->buf_size); From 72b934e3f7d5f0c717cb98b718c9529c74741b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 22 Mar 2019 19:21:07 +0200 Subject: [PATCH 20/23] MDEV-14126: Detect unexpected emptying of B-tree pages If an index page becomes empty, btr_page_empty() should be called. --- storage/innobase/include/page0page.ic | 5 +++-- storage/innobase/page/page0cur.cc | 2 ++ storage/innobase/page/page0page.cc | 1 + storage/innobase/page/page0zip.cc | 6 ++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index d1efca1d244..11d5e2d1854 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -173,8 +173,9 @@ page_header_set_field( { ut_ad(page); ut_ad(field <= PAGE_N_RECS); - ut_ad(field == PAGE_N_HEAP || val < UNIV_PAGE_SIZE); - ut_ad(field != PAGE_N_HEAP || (val & 0x7fff) < UNIV_PAGE_SIZE); + ut_ad(field != PAGE_N_RECS || val); + ut_ad(field == PAGE_N_HEAP || val < srv_page_size); + ut_ad(field != PAGE_N_HEAP || (val & 0x7fff) < srv_page_size); mach_write_to_2(page + PAGE_HEADER + field, val); if (page_zip) { diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index ae46d1e71ce..561f053710f 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -2140,6 +2140,8 @@ page_copy_rec_list_end_to_created_page( rec = page_rec_get_next(rec); } while (!page_rec_is_supremum(rec)); + ut_ad(n_recs); + if ((slot_index > 0) && (count + 1 + (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2 <= PAGE_DIR_SLOT_MAX_N_OWNED)) { diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index be426ec4927..2f3879dda08 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -1231,6 +1231,7 @@ delete_all: page_header_set_field(page, NULL, PAGE_GARBAGE, size + page_header_get_field(page, PAGE_GARBAGE)); + ut_ad(page_get_n_recs(page) > n_recs); page_header_set_field(page, NULL, PAGE_N_RECS, (ulint)(page_get_n_recs(page) - n_recs)); } diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 811b5d88947..001d33662d1 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -4448,10 +4448,12 @@ page_zip_dir_delete( slot_rec = page_zip_dir_find(page_zip, page_offset(rec)); ut_a(slot_rec); - + uint16_t n_recs = page_get_n_recs(page); + ut_ad(n_recs); + ut_ad(n_recs > 1 || page_get_page_no(page) == index->page); /* This could not be done before page_zip_dir_find(). */ page_header_set_field(page, page_zip, PAGE_N_RECS, - (ulint)(page_get_n_recs(page) - 1)); + n_recs - 1); if (UNIV_UNLIKELY(!free)) { /* Make the last slot the start of the free list. */ From 1bd98154791d77a44d2afc4bf6eb78f692fb7b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 25 Mar 2019 11:27:29 +0200 Subject: [PATCH 21/23] MDEV-14126: Fix type mismatch Backport some changes to B-tree page accessor functions from 10.3, including changing page_get_n_recs() to return uint16_t. --- storage/innobase/include/page0page.h | 22 ++++++------ storage/innobase/include/page0page.ic | 48 ++++++++++++--------------- 2 files changed, 32 insertions(+), 38 deletions(-) diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 18c536c05e9..2b869dbe8c3 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -175,7 +175,7 @@ inline page_t* page_align(const void* ptr) { - return(static_cast(ut_align_down(ptr, UNIV_PAGE_SIZE))); + return(static_cast(ut_align_down(ptr, srv_page_size))); } /** Gets the byte offset within a page frame. @@ -186,7 +186,7 @@ inline ulint page_offset(const void* ptr) { - return(ut_align_offset(ptr, UNIV_PAGE_SIZE)); + return(ut_align_offset(ptr, srv_page_size)); } /** Determine whether an index page is not in ROW_FORMAT=REDUNDANT. @@ -286,7 +286,7 @@ page_rec_is_user_rec_low(ulint offset) compile_time_assert(PAGE_NEW_SUPREMUM < PAGE_OLD_SUPREMUM_END); compile_time_assert(PAGE_OLD_SUPREMUM < PAGE_NEW_SUPREMUM_END); ut_ad(offset >= PAGE_NEW_INFIMUM); - ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START); + ut_ad(offset <= srv_page_size - PAGE_EMPTY_DIR_START); return(offset != PAGE_NEW_SUPREMUM && offset != PAGE_NEW_INFIMUM @@ -302,7 +302,7 @@ bool page_rec_is_supremum_low(ulint offset) { ut_ad(offset >= PAGE_NEW_INFIMUM); - ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START); + ut_ad(offset <= srv_page_size - PAGE_EMPTY_DIR_START); return(offset == PAGE_NEW_SUPREMUM || offset == PAGE_OLD_SUPREMUM); } @@ -314,7 +314,7 @@ bool page_rec_is_infimum_low(ulint offset) { ut_ad(offset >= PAGE_NEW_INFIMUM); - ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START); + ut_ad(offset <= srv_page_size - PAGE_EMPTY_DIR_START); return(offset == PAGE_NEW_INFIMUM || offset == PAGE_OLD_INFIMUM); } @@ -455,7 +455,7 @@ page_header_set_field( Returns the offset stored in the given header field. @return offset from the start of the page, or 0 */ UNIV_INLINE -ulint +uint16_t page_header_get_offs( /*=================*/ const page_t* page, /*!< in: page */ @@ -549,7 +549,7 @@ Gets the number of user records on page (the infimum and supremum records are not user records). @return number of user records */ UNIV_INLINE -ulint +uint16_t page_get_n_recs( /*============*/ const page_t* page); /*!< in: index page */ @@ -567,7 +567,7 @@ page_rec_get_n_recs_before( Gets the number of records in the heap. @return number of user records */ UNIV_INLINE -ulint +uint16_t page_dir_get_n_heap( /*================*/ const page_t* page); /*!< in: index page */ @@ -588,7 +588,7 @@ page_dir_set_n_heap( Gets the number of dir slots in directory. @return number of slots */ UNIV_INLINE -ulint +uint16_t page_dir_get_n_slots( /*=================*/ const page_t* page); /*!< in: index page */ @@ -614,7 +614,7 @@ page_dir_get_nth_slot( ulint n); /*!< in: position */ #else /* UNIV_DEBUG */ # define page_dir_get_nth_slot(page, n) \ - ((page) + (UNIV_PAGE_SIZE - PAGE_DIR \ + ((page) + (srv_page_size - PAGE_DIR \ - (n + 1) * PAGE_DIR_SLOT_SIZE)) #endif /* UNIV_DEBUG */ /**************************************************************//** @@ -868,7 +868,7 @@ Returns the sum of the sizes of the records in the record list excluding the infimum and supremum records. @return data in bytes */ UNIV_INLINE -ulint +uint16_t page_get_data_size( /*===============*/ const page_t* page); /*!< in: index page */ diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index 11d5e2d1854..d6fded4f178 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -188,19 +188,17 @@ page_header_set_field( Returns the offset stored in the given header field. @return offset from the start of the page, or 0 */ UNIV_INLINE -ulint +uint16_t page_header_get_offs( /*=================*/ const page_t* page, /*!< in: page */ ulint field) /*!< in: PAGE_FREE, ... */ { - ulint offs; - ut_ad((field == PAGE_FREE) || (field == PAGE_LAST_INSERT) || (field == PAGE_HEAP_TOP)); - offs = page_header_get_field(page, field); + uint16_t offs = page_header_get_field(page, field); ut_ad((field != PAGE_HEAP_TOP) || offs); @@ -400,7 +398,8 @@ page_get_middle_rec( /*================*/ page_t* page) /*!< in: page */ { - ulint middle = (page_get_n_recs(page) + PAGE_HEAP_NO_USER_LOW) / 2; + ulint middle = (ulint(page_get_n_recs(page)) + + PAGE_HEAP_NO_USER_LOW) / 2; return(page_rec_get_nth(page, middle)); } @@ -441,7 +440,7 @@ Gets the number of user records on page (infimum and supremum records are not user records). @return number of user records */ UNIV_INLINE -ulint +uint16_t page_get_n_recs( /*============*/ const page_t* page) /*!< in: index page */ @@ -454,7 +453,7 @@ page_get_n_recs( Gets the number of dir slots in directory. @return number of slots */ UNIV_INLINE -ulint +uint16_t page_dir_get_n_slots( /*=================*/ const page_t* page) /*!< in: index page */ @@ -479,7 +478,7 @@ page_dir_set_n_slots( Gets the number of records in the heap. @return number of user records */ UNIV_INLINE -ulint +uint16_t page_dir_get_n_heap( /*================*/ const page_t* page) /*!< in: index page */ @@ -524,7 +523,7 @@ page_dir_get_nth_slot( ut_ad(page_dir_get_n_slots(page) > n); return((page_dir_slot_t*) - page + UNIV_PAGE_SIZE - PAGE_DIR + page + srv_page_size - PAGE_DIR - (n + 1) * PAGE_DIR_SLOT_SIZE); } #endif /* UNIV_DEBUG */ @@ -643,7 +642,7 @@ page_rec_get_next_low( offs = rec_get_next_offs(rec, comp); - if (offs >= UNIV_PAGE_SIZE) { + if (offs >= srv_page_size) { fprintf(stderr, "InnoDB: Next record offset is nonsensical %lu" " in record at offset %lu\n" @@ -832,9 +831,8 @@ page_rec_get_base_extra_size( /*=========================*/ const rec_t* rec) /*!< in: physical record */ { -#if REC_N_NEW_EXTRA_BYTES + 1 != REC_N_OLD_EXTRA_BYTES -# error "REC_N_NEW_EXTRA_BYTES + 1 != REC_N_OLD_EXTRA_BYTES" -#endif + compile_time_assert(REC_N_NEW_EXTRA_BYTES + 1 + == REC_N_OLD_EXTRA_BYTES); return(REC_N_NEW_EXTRA_BYTES + (ulint) !page_rec_is_comp(rec)); } @@ -845,21 +843,17 @@ Returns the sum of the sizes of the records in the record list, excluding the infimum and supremum records. @return data in bytes */ UNIV_INLINE -ulint +uint16_t page_get_data_size( /*===============*/ const page_t* page) /*!< in: index page */ { - ulint ret; - - ret = (ulint)(page_header_get_field(page, PAGE_HEAP_TOP) - - (page_is_comp(page) - ? PAGE_NEW_SUPREMUM_END - : PAGE_OLD_SUPREMUM_END) - - page_header_get_field(page, PAGE_GARBAGE)); - - ut_ad(ret < UNIV_PAGE_SIZE); - + uint16_t ret = page_header_get_field(page, PAGE_HEAP_TOP) + - (page_is_comp(page) + ? PAGE_NEW_SUPREMUM_END + : PAGE_OLD_SUPREMUM_END) + - page_header_get_field(page, PAGE_GARBAGE); + ut_ad(ret < srv_page_size); return(ret); } @@ -907,13 +901,13 @@ page_get_free_space_of_empty( ulint comp) /*!< in: nonzero=compact page layout */ { if (comp) { - return((ulint)(UNIV_PAGE_SIZE + return((ulint)(srv_page_size - PAGE_NEW_SUPREMUM_END - PAGE_DIR - 2 * PAGE_DIR_SLOT_SIZE)); } - return((ulint)(UNIV_PAGE_SIZE + return((ulint)(srv_page_size - PAGE_OLD_SUPREMUM_END - PAGE_DIR - 2 * PAGE_DIR_SLOT_SIZE)); @@ -1051,7 +1045,7 @@ page_mem_free( page_zip_dir_delete(page_zip, rec, index, offsets, free); } else { page_header_set_field(page, page_zip, PAGE_N_RECS, - page_get_n_recs(page) - 1); + ulint(page_get_n_recs(page)) - 1); } } From ade0a0e9d57906e6a32c145c7201dbf216392f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 25 Mar 2019 15:55:00 +0200 Subject: [PATCH 22/23] Avoid sign mismatch in comparisons This is follow-up to commit 1bd98154791d77a44d2afc4bf6eb78f692fb7b5b. --- storage/innobase/btr/btr0sea.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index b494565b288..a4f0f9e5b88 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -80,7 +80,7 @@ btr_search_sys_t* btr_search_sys; /** If the number of records on the page divided by this parameter would have been successfully accessed using a hash index, the index is then built on the page, assuming the global limit has been reached */ -#define BTR_SEARCH_PAGE_BUILD_LIMIT 16 +#define BTR_SEARCH_PAGE_BUILD_LIMIT 16U /** The global limit for consecutive potentially successful hash searches, before hash index building is started */ @@ -570,7 +570,7 @@ btr_search_update_block_hash_info( if ((!block->index) || (block->n_hash_helps - > 2 * page_get_n_recs(block->frame)) + > 2U * page_get_n_recs(block->frame)) || (block->n_fields != block->curr_n_fields) || (block->n_bytes != block->curr_n_bytes) || (block->left_side != block->curr_left_side)) { From 525e79b057ce1256aac9f8248b89d8d507ab22c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 25 Mar 2019 16:03:24 +0200 Subject: [PATCH 23/23] MDEV-19022: InnoDB fails to cleanup useless B-tree pages The test case for reproducing MDEV-14126 demonstrates that InnoDB can end up with an index tree where a non-leaf page has only one child page. The test case innodb.innodb_bug14676111 demonstrates that such pages are sometimes unavoidable, because InnoDB does not implement any sort of B-tree rotation. But, there is no reason to allow a root page with only one child page. btr_cur_node_ptr_delete(): Replaces btr_node_ptr_delete(). btr_page_get_father(): Declare globally. btr_discard_only_page_on_level(): Declare with ATTRIBUTE_COLD. It turns out that this function is not covered by the innodb.innodb_bug14676111 test case after all. btr_discard_page(): If the root page ends up having only one child page, shrink the tree by invoking btr_lift_page_up(). --- .../suite/innodb/r/innodb_bug14676111.result | 20 ++--- storage/innobase/btr/btr0btr.cc | 74 +++++-------------- storage/innobase/btr/btr0cur.cc | 23 +++++- storage/innobase/btr/btr0defragment.cc | 8 +- storage/innobase/include/btr0btr.h | 17 ++--- storage/innobase/include/btr0cur.h | 7 +- 6 files changed, 70 insertions(+), 79 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_bug14676111.result b/mysql-test/suite/innodb/r/innodb_bug14676111.result index d1e21c92d95..49d099263de 100644 --- a/mysql-test/suite/innodb/r/innodb_bug14676111.result +++ b/mysql-test/suite/innodb/r/innodb_bug14676111.result @@ -39,7 +39,7 @@ Table Op Msg_type Msg_text test.t1 analyze status OK select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; CLUST_INDEX_SIZE -5 +4 set global innodb_limit_optimistic_insert_debug = 10000; connection con2; rollback; @@ -50,15 +50,6 @@ Table Op Msg_type Msg_text test.t1 analyze status OK select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; CLUST_INDEX_SIZE -3 -begin; -insert into t1 values (2); -rollback; -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; -CLUST_INDEX_SIZE 2 begin; insert into t1 values (2); @@ -69,5 +60,14 @@ test.t1 analyze status OK select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; CLUST_INDEX_SIZE 1 +begin; +insert into t1 values (2); +rollback; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +1 drop table t1; set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 5b1e7e1b853..a40e39624e2 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -1062,18 +1062,13 @@ btr_page_get_father_block( return(btr_page_get_father_node_ptr(offsets, heap, cursor, mtr)); } -/************************************************************//** -Seeks to the upper level node pointer to a page. -It is assumed that mtr holds an x-latch on the tree. */ -static -void -btr_page_get_father( -/*================*/ - dict_index_t* index, /*!< in: b-tree index */ - buf_block_t* block, /*!< in: child page in the index */ - mtr_t* mtr, /*!< in: mtr */ - btr_cur_t* cursor) /*!< out: cursor on node pointer record, - its page x-latched */ +/** Seek to the parent page of a B-tree page. +@param[in,out] index b-tree +@param[in] block child page +@param[in,out] mtr mini-transaction +@param[out] cursor cursor pointing to the x-latched parent page */ +void btr_page_get_father(dict_index_t* index, buf_block_t* block, mtr_t* mtr, + btr_cur_t* cursor) { mem_heap_t* heap; rec_t* rec @@ -3463,33 +3458,6 @@ btr_set_min_rec_mark( } } -/*************************************************************//** -Deletes on the upper level the node pointer to a page. */ -void -btr_node_ptr_delete( -/*================*/ - dict_index_t* index, /*!< in: index tree */ - buf_block_t* block, /*!< in: page whose node pointer is deleted */ - mtr_t* mtr) /*!< in: mtr */ -{ - btr_cur_t cursor; - ibool compressed; - dberr_t err; - - ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); - - /* Delete node pointer on father page */ - btr_page_get_father(index, block, mtr, &cursor); - - compressed = btr_cur_pessimistic_delete(&err, TRUE, &cursor, - BTR_CREATE_FLAG, false, mtr); - ut_a(err == DB_SUCCESS); - - if (!compressed) { - btr_cur_compress_if_useful(&cursor, FALSE, mtr); - } -} - /*************************************************************//** If page is the only on its level, this function moves its records to the father page, thus reducing the tree height. @@ -3939,7 +3907,7 @@ retry: lock_rec_free_all_from_discard_page(block); lock_mutex_exit(); } else { - btr_node_ptr_delete(index, block, mtr); + btr_cur_node_ptr_delete(&father_cursor, mtr); if (!dict_table_is_locking_disabled(index->table)) { lock_update_merge_left( merge_block, orig_pred, block); @@ -4217,8 +4185,9 @@ err_exit: /*************************************************************//** Discards a page that is the only page on its level. This will empty the whole B-tree, leaving just an empty root page. This function -should never be reached, because btr_compress(), which is invoked in +should almost never be reached, because btr_compress(), which is invoked in delete operations, calls btr_lift_page_up() to flatten the B-tree. */ +ATTRIBUTE_COLD static void btr_discard_only_page_on_level( @@ -4318,10 +4287,7 @@ btr_discard_page( buf_block_t* block; page_t* page; rec_t* node_ptr; -#ifdef UNIV_DEBUG btr_cur_t parent_cursor; - bool parent_is_different = false; -#endif block = btr_cur_get_block(cursor); index = btr_cur_get_index(cursor); @@ -4337,13 +4303,11 @@ btr_discard_page( MONITOR_INC(MONITOR_INDEX_DISCARD); -#ifdef UNIV_DEBUG if (dict_index_is_spatial(index)) { rtr_page_get_father(index, block, mtr, cursor, &parent_cursor); } else { btr_page_get_father(index, block, mtr, &parent_cursor); } -#endif /* Decide the page which will inherit the locks */ @@ -4351,7 +4315,7 @@ btr_discard_page( right_page_no = btr_page_get_next(buf_block_get_frame(block), mtr); const page_size_t page_size(dict_table_page_size(index->table)); - + ut_d(bool parent_is_different = false); if (left_page_no != FIL_NULL) { merge_block = btr_block_get( page_id_t(space, left_page_no), page_size, @@ -4407,15 +4371,9 @@ btr_discard_page( } if (dict_index_is_spatial(index)) { - btr_cur_t father_cursor; - - /* Since rtr_node_ptr_delete doesn't contain get father - node ptr, so, we need to get father node ptr first and then - delete it. */ - rtr_page_get_father(index, block, mtr, cursor, &father_cursor); - rtr_node_ptr_delete(index, &father_cursor, block, mtr); + rtr_node_ptr_delete(index, &parent_cursor, block, mtr); } else { - btr_node_ptr_delete(index, block, mtr); + btr_cur_node_ptr_delete(&parent_cursor, mtr); } /* Remove the page from the level list */ @@ -4453,6 +4411,12 @@ btr_discard_page( we cannot use btr_check_node_ptr() */ ut_ad(parent_is_different || btr_check_node_ptr(index, merge_block, mtr)); + + if (btr_cur_get_block(&parent_cursor)->page.id.page_no() == index->page + && !page_has_siblings(btr_cur_get_page(&parent_cursor)) + && page_get_n_recs(btr_cur_get_page(&parent_cursor)) == 1) { + btr_lift_page_up(index, merge_block, mtr); + } } #ifdef UNIV_BTR_PRINT diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 37372af4b44..8f26ac9e0e5 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -5358,8 +5358,10 @@ btr_cur_pessimistic_delete( on the page */ ulint level = btr_page_get_level(page, mtr); - btr_node_ptr_delete(index, block, mtr); - + btr_cur_t cursor; + btr_page_get_father(index, block, mtr, &cursor); + btr_cur_node_ptr_delete(&cursor, mtr); + // FIXME: reuse the node_ptr from above dtuple_t* node_ptr = dict_index_build_node_ptr( index, next_rec, block->page.id.page_no(), heap, level); @@ -5428,6 +5430,23 @@ return_after_reservations: return(ret); } +/** Delete the node pointer in a parent page. +@param[in,out] parent cursor pointing to parent record +@param[in,out] mtr mini-transaction */ +void btr_cur_node_ptr_delete(btr_cur_t* parent, mtr_t* mtr) +{ + ut_ad(mtr_memo_contains(mtr, btr_cur_get_block(parent), + MTR_MEMO_PAGE_X_FIX)); + dberr_t err; + ibool compressed = btr_cur_pessimistic_delete(&err, TRUE, parent, + BTR_CREATE_FLAG, false, + mtr); + ut_a(err == DB_SUCCESS); + if (!compressed) { + btr_cur_compress_if_useful(parent, FALSE, mtr); + } +} + /*******************************************************************//** Adds path information to the cursor for the current page, for which the binary search has been performed. */ diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index 077cf8a1c73..2bb2e84ee05 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -484,6 +484,7 @@ btr_defragment_merge_pages( ULINT_UNDEFINED); } } + btr_cur_t parent; if (n_recs_to_move == n_recs) { /* The whole page is merged with the previous page, free it. */ @@ -491,7 +492,8 @@ btr_defragment_merge_pages( from_block); btr_search_drop_page_hash_index(from_block); btr_level_list_remove(space, page_size, (page_t*)from_page, index, mtr); - btr_node_ptr_delete(index, from_block, mtr); + btr_page_get_father(index, from_block, mtr, &parent); + btr_cur_node_ptr_delete(&parent, mtr); /* btr_blob_dbg_remove(from_page, index, "btr_defragment_n_pages"); */ btr_page_free(index, from_block, mtr); @@ -509,7 +511,9 @@ btr_defragment_merge_pages( lock_update_split_and_merge(to_block, orig_pred, from_block); - btr_node_ptr_delete(index, from_block, mtr); + // FIXME: reuse the node_ptr! + btr_page_get_father(index, from_block, mtr, &parent); + btr_cur_node_ptr_delete(&parent, mtr); rec = page_rec_get_next( page_get_infimum_rec(from_page)); node_ptr = dict_index_build_node_ptr( diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 967f738f4e3..23e445e2d5f 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2018, MariaDB Corporation. +Copyright (c) 2014, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -545,14 +545,13 @@ btr_set_min_rec_mark( rec_t* rec, /*!< in/out: record */ mtr_t* mtr) /*!< in: mtr */ MY_ATTRIBUTE((nonnull)); -/*************************************************************//** -Deletes on the upper level the node pointer to a page. */ -void -btr_node_ptr_delete( -/*================*/ - dict_index_t* index, /*!< in: index tree */ - buf_block_t* block, /*!< in: page whose node pointer is deleted */ - mtr_t* mtr) /*!< in: mtr */ +/** Seek to the parent page of a B-tree page. +@param[in,out] index b-tree +@param[in] block child page +@param[in,out] mtr mini-transaction +@param[out] cursor cursor pointing to the x-latched parent page */ +void btr_page_get_father(dict_index_t* index, buf_block_t* block, mtr_t* mtr, + btr_cur_t* cursor) MY_ATTRIBUTE((nonnull)); #ifdef UNIV_DEBUG /************************************************************//** diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 0f027536525..769d9e82542 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -529,6 +529,11 @@ btr_cur_pessimistic_delete( bool rollback,/*!< in: performing rollback? */ mtr_t* mtr) /*!< in: mtr */ MY_ATTRIBUTE((nonnull)); +/** Delete the node pointer in a parent page. +@param[in,out] parent cursor pointing to parent record +@param[in,out] mtr mini-transaction */ +void btr_cur_node_ptr_delete(btr_cur_t* parent, mtr_t* mtr) + MY_ATTRIBUTE((nonnull)); /***********************************************************//** Parses a redo log record of updating a record in-place. @return end of log record or NULL */