diff options
-rw-r--r-- | cmake/cpack_rpm.cmake | 4 | ||||
-rw-r--r-- | cmake/plugin.cmake | 16 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/innodb-page_compression_tables.result | 8 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/innodb-page_compression_tables.test | 7 | ||||
-rw-r--r-- | plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.result | 2 | ||||
-rw-r--r-- | plugin/type_inet/plugin.cc | 2 | ||||
-rw-r--r-- | sql/CMakeLists.txt | 9 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 119 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 37 | ||||
-rw-r--r-- | sql/log.cc | 28 | ||||
-rw-r--r-- | storage/innobase/log/log0recv.cc | 14 | ||||
-rw-r--r-- | storage/innobase/mtr/mtr0mtr.cc | 1 |
12 files changed, 128 insertions, 119 deletions
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index e988f781e6b..3c34ecfa83e 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -302,9 +302,7 @@ ENDIF() IF(CMAKE_VERSION VERSION_GREATER "3.9.99") SET(CPACK_SOURCE_GENERATOR "RPM") -SETA(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS - "-DRPM=${RPM}" - ) +SETA(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS "-DRPM=${RPM}") MACRO(ADDIF var) IF(DEFINED ${var}) diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 0bd6c28bb82..9e848951f21 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -19,19 +19,21 @@ INCLUDE(CMakeParseArguments) # MYSQL_ADD_PLUGIN(plugin_name source1...sourceN # [STORAGE_ENGINE] -# [CLIENT] +# [STATIC_ONLY|MODULE_ONLY] # [MANDATORY|DEFAULT] -# [STATIC_ONLY|DYNAMIC_ONLY] +# [DISABLED] +# [NOT_EMBEDDED|RECOMPILE_FOR_EMBEDDED] +# [CLIENT] # [MODULE_OUTPUT_NAME module_name] # [STATIC_OUTPUT_NAME static_name] -# [RECOMPILE_FOR_EMBEDDED] -# [NOT_EMBEDDED] +# [COMPONENT component] +# [CONFIG cnf_file_name] # [LINK_LIBRARIES lib1...libN] # [DEPENDENCIES target1...targetN] MACRO(MYSQL_ADD_PLUGIN) CMAKE_PARSE_ARGUMENTS(ARG - "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;NOT_EMBEDDED;RECOMPILE_FOR_EMBEDDED;CLIENT;EXPORT_SYMBOLS" + "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;NOT_EMBEDDED;RECOMPILE_FOR_EMBEDDED;CLIENT" "MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG" "LINK_LIBRARIES;DEPENDENCIES" ${ARGN} @@ -140,9 +142,7 @@ MACRO(MYSQL_ADD_PLUGIN) ADD_LIBRARY(${target} STATIC ${SOURCES}) DTRACE_INSTRUMENT(${target}) ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) - IF(NOT ARG_EXPORT_SYMBOLS) - RESTRICT_SYMBOL_EXPORTS(${target}) - ENDIF() + RESTRICT_SYMBOL_EXPORTS(${target}) IF(WITH_EMBEDDED_SERVER AND (NOT ARG_NOT_EMBEDDED)) # Embedded library should contain PIC code and be linkable # to shared libraries (on systems that need PIC) diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_tables.result b/mysql-test/suite/innodb/r/innodb-page_compression_tables.result index 2aee063c1ac..693db6eb7ec 100644 --- a/mysql-test/suite/innodb/r/innodb-page_compression_tables.result +++ b/mysql-test/suite/innodb/r/innodb-page_compression_tables.result @@ -55,6 +55,14 @@ innodb_redundant CREATE TABLE `innodb_redundant` ( `b` char(200) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `page_compressed`=1 drop table innodb_redundant; +# +# MDEV-24455 Assertion `!m_freed_space' failed in mtr_t::start +# +CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED='ON'; +BEGIN; +INSERT INTO t1 VALUES(REPEAT('x',81),REPEAT('x',8034)); +ROLLBACK; +DROP TABLE t1; create procedure innodb_insert_proc (repeat_count int) begin declare current_num int; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test index 75504a53c55..312aa22edba 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test @@ -30,6 +30,13 @@ alter table innodb_redundant row_format=compact page_compressed=1; show create table innodb_redundant; drop table innodb_redundant; +--echo # +--echo # MDEV-24455 Assertion `!m_freed_space' failed in mtr_t::start +--echo # +CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED='ON'; +BEGIN; INSERT INTO t1 VALUES(REPEAT('x',81),REPEAT('x',8034)); ROLLBACK; +DROP TABLE t1; + delimiter //; create procedure innodb_insert_proc (repeat_count int) begin diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.result index 931c66fd9d2..a51d0f0dd39 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_plugin.result @@ -24,7 +24,7 @@ PLUGIN_TYPE DATA TYPE PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Data type INET6 PLUGIN_LICENSE GPL -PLUGIN_MATURITY Beta +PLUGIN_MATURITY Gamma PLUGIN_AUTH_VERSION 1.0 # # End of 10.5 tests diff --git a/plugin/type_inet/plugin.cc b/plugin/type_inet/plugin.cc index 55052df80dd..2baa98f0594 100644 --- a/plugin/type_inet/plugin.cc +++ b/plugin/type_inet/plugin.cc @@ -186,7 +186,7 @@ maria_declare_plugin(type_inet) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_BETA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index e824dcb4ad4..39307ab8183 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -36,7 +36,14 @@ IF(WITH_WSREP AND NOT EMBEDDED_LIBRARY) wsrep_plugin.cc service_wsrep.cc ) - MYSQL_ADD_PLUGIN(wsrep ${WSREP_SOURCES} MANDATORY NOT_EMBEDDED EXPORT_SYMBOLS LINK_LIBRARIES wsrep-lib wsrep_api_v26) + MYSQL_ADD_PLUGIN(wsrep ${WSREP_SOURCES} MANDATORY NOT_EMBEDDED LINK_LIBRARIES wsrep-lib wsrep_api_v26) + IF(VISIBILITY_HIDDEN_FLAG AND TARGET wsrep) + # wsrep_info plugin needs some wsrep symbols from inside mysqld + # we have to remove -fvisibility=hidden from wsrep + GET_TARGET_PROPERTY(f wsrep COMPILE_FLAGS) + STRING(REPLACE "${VISIBILITY_HIDDEN_FLAG}" "" f ${f}) + SET_TARGET_PROPERTIES(wsrep PROPERTIES COMPILE_FLAGS "${f}") + ENDIF() ELSE() ADD_LIBRARY(wsrep STATIC wsrep_dummy.cc) ADD_DEPENDENCIES(wsrep GenError) diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 47e9695e507..bfd415344ef 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -5613,61 +5613,6 @@ void Item_func_like::print(String *str, enum_query_type query_type) } -static bool fix_escape_item_now(THD *thd, Item *escape_item, String *tmp_str, - bool escape_used_in_parsing, CHARSET_INFO *cmp_cs, - int *escape) -{ - String *escape_str= escape_item->val_str(tmp_str); - if (escape_str) - { - const char *escape_str_ptr= escape_str->ptr(); - if (escape_used_in_parsing && - ((((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) && - escape_str->numchars() != 1) || - escape_str->numchars() > 1))) - { - my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE"); - return TRUE; - } - - if (cmp_cs->use_mb()) - { - CHARSET_INFO *cs= escape_str->charset(); - my_wc_t wc; - int rc= cs->mb_wc(&wc, - (const uchar*) escape_str_ptr, - (const uchar*) escape_str_ptr + - escape_str->length()); - *escape= (int) (rc > 0 ? wc : '\\'); - } - else - { - /* - In the case of 8bit character set, we pass native - code instead of Unicode code as "escape" argument. - Convert to "cs" if charset of escape differs. - */ - uint32 unused; - if (escape_str->needs_conversion(escape_str->length(), - escape_str->charset(),cmp_cs,&unused)) - { - char ch; - uint errors; - uint32 cnvlen= copy_and_convert(&ch, 1, cmp_cs, escape_str_ptr, - escape_str->length(), - escape_str->charset(), &errors); - *escape= cnvlen ? ch : '\\'; - } - else - *escape= escape_str_ptr ? *escape_str_ptr : '\\'; - } - } - else - *escape= '\\'; - return FALSE; -} - - longlong Item_func_like::val_int() { DBUG_ASSERT(fixed == 1); @@ -5686,17 +5631,6 @@ longlong Item_func_like::val_int() null_value=0; if (canDoTurboBM) return turboBM_matches(res->ptr(), res->length()) ? !negated : negated; - if (unlikely(!escape_item_evaluated)) - { - if (fix_escape_item_now(current_thd, escape_item, &cmp_value1, - escape_used_in_parsing, - cmp_collation.collation, &escape)) - { - null_value= 1; - return 0; - } - escape_item_evaluated= 1; - } return cmp_collation.collation->wildcmp( res->ptr(),res->ptr()+res->length(), res2->ptr(),res2->ptr()+res2->length(), @@ -5777,13 +5711,58 @@ bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str, if (escape_item->const_item()) { /* If we are on execution stage */ - return fix_escape_item_now(thd, escape_item, tmp_str, escape_used_in_parsing, - cmp_cs, escape); + String *escape_str= escape_item->val_str(tmp_str); + if (escape_str) + { + const char *escape_str_ptr= escape_str->ptr(); + if (escape_used_in_parsing && ( + (((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) && + escape_str->numchars() != 1) || + escape_str->numchars() > 1))) + { + my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE"); + return TRUE; + } + + if (cmp_cs->use_mb()) + { + CHARSET_INFO *cs= escape_str->charset(); + my_wc_t wc; + int rc= cs->mb_wc(&wc, + (const uchar*) escape_str_ptr, + (const uchar*) escape_str_ptr + + escape_str->length()); + *escape= (int) (rc > 0 ? wc : '\\'); + } + else + { + /* + In the case of 8bit character set, we pass native + code instead of Unicode code as "escape" argument. + Convert to "cs" if charset of escape differs. + */ + uint32 unused; + if (escape_str->needs_conversion(escape_str->length(), + escape_str->charset(),cmp_cs,&unused)) + { + char ch; + uint errors; + uint32 cnvlen= copy_and_convert(&ch, 1, cmp_cs, escape_str_ptr, + escape_str->length(), + escape_str->charset(), &errors); + *escape= cnvlen ? ch : '\\'; + } + else + *escape= escape_str_ptr ? *escape_str_ptr : '\\'; + } + } + else + *escape= '\\'; } + return FALSE; } - bool Item_func_like::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); @@ -5793,10 +5772,8 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) cmp_collation.collation, &escape)) return TRUE; - escape_item_evaluated= 0; if (escape_item->const_item()) { - escape_item_evaluated= 1; /* We could also do boyer-more for non-const items, but as we would have to recompute the tables for each row it's not worth it. diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 1808884647e..fa715badfc7 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -2672,24 +2672,14 @@ public: class Item_func_like :public Item_bool_func2 { + // Turbo Boyer-Moore data + bool canDoTurboBM; // pattern is '%abcd%' case const char* pattern; - Item *escape_item; - DTCollation cmp_collation; - String cmp_value1, cmp_value2; + int pattern_len; - // Turbo Boyer-Moore data // TurboBM buffers, *this is owner - int *bmGs; // good suffix shift table, size is pattern_len + 1 - int *bmBc; // bad character shift table, size is alphabet_size - int pattern_len; -public: - int escape; - bool negated; -private: - bool canDoTurboBM; // pattern is '%abcd%' case - bool escape_item_evaluated; - bool escape_used_in_parsing; - bool use_sampling; + int* bmGs; // good suffix shift table, size is pattern_len + 1 + int* bmBc; // bad character shift table, size is alphabet_size void turboBM_compute_suffixes(int* suff); void turboBM_compute_good_suffix_shifts(int* suff); @@ -2697,6 +2687,13 @@ private: bool turboBM_matches(const char* text, int text_len) const; enum { alphabet_size = 256 }; + Item *escape_item; + + bool escape_used_in_parsing; + bool use_sampling; + + DTCollation cmp_collation; + String cmp_value1, cmp_value2; bool with_sargable_pattern() const; protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, @@ -2709,13 +2706,13 @@ protected: KEY_PART *key_part, Item_func::Functype type, Item *value); public: + int escape; + bool negated; Item_func_like(THD *thd, Item *a, Item *b, Item *escape_arg, bool escape_used): - Item_bool_func2(thd, a, b), pattern(0), escape_item(escape_arg), - bmGs(0), bmBc(0), pattern_len(0), negated(0), canDoTurboBM(FALSE), - escape_item_evaluated(0), escape_used_in_parsing(escape_used), - use_sampling(0) - {} + Item_bool_func2(thd, a, b), canDoTurboBM(FALSE), pattern(0), pattern_len(0), + bmGs(0), bmBc(0), escape_item(escape_arg), + escape_used_in_parsing(escape_used), use_sampling(0), negated(0) {} bool get_negated() const { return negated; } // Used by ColumnStore diff --git a/sql/log.cc b/sql/log.cc index 2dd1a3a45ab..d6b47ff3aa6 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -393,12 +393,12 @@ public: In the future, we can refactor this and change it to avoid the set_binlog_info. */ - DBUG_ASSERT(saved_max_binlog_cache_size == 0 && - param_max_binlog_cache_size != 0 && - ptr_binlog_cache_use == 0 && - param_ptr_binlog_cache_use != 0 && - ptr_binlog_cache_disk_use == 0 && - param_ptr_binlog_cache_disk_use != 0); + DBUG_ASSERT(saved_max_binlog_cache_size == 0); + DBUG_ASSERT(param_max_binlog_cache_size != 0); + DBUG_ASSERT(ptr_binlog_cache_use == 0); + DBUG_ASSERT(param_ptr_binlog_cache_use != 0); + DBUG_ASSERT(ptr_binlog_cache_disk_use == 0); + DBUG_ASSERT(param_ptr_binlog_cache_disk_use != 0); saved_max_binlog_cache_size= param_max_binlog_cache_size; ptr_binlog_cache_use= param_ptr_binlog_cache_use; @@ -1814,8 +1814,8 @@ binlog_flush_cache(THD *thd, binlog_cache_mngr *cache_mngr, } cache_mngr->reset(using_stmt, using_trx); - DBUG_ASSERT((!using_stmt || cache_mngr->stmt_cache.empty()) && - (!using_trx || cache_mngr->trx_cache.empty())); + DBUG_ASSERT(!using_stmt || cache_mngr->stmt_cache.empty()); + DBUG_ASSERT(!using_trx || cache_mngr->trx_cache.empty()); DBUG_RETURN(error); } @@ -9273,7 +9273,8 @@ int TC_LOG_MMAP::log_and_order(THD *thd, my_xid xid, bool all, prev= queue; queue= next; } - DBUG_ASSERT(prev == &entry && prev->thd == thd); + DBUG_ASSERT(prev == &entry); + DBUG_ASSERT(prev->thd == thd); } else { @@ -9367,7 +9368,8 @@ int TC_LOG_MMAP::open(const char *opt_name) PAGE *pg; DBUG_ASSERT(total_ha_2pc > 1); - DBUG_ASSERT(opt_name && opt_name[0]); + DBUG_ASSERT(opt_name); + DBUG_ASSERT(opt_name[0]); tc_log_page_size= my_getpagesize(); @@ -9786,7 +9788,8 @@ int TC_LOG_MMAP::delete_entry(ulong cookie) PAGE *p=pages+(cookie/tc_log_page_size); my_xid *x=(my_xid *)(data+cookie); - DBUG_ASSERT(x >= p->start && x < p->end); + DBUG_ASSERT(x >= p->start); + DBUG_ASSERT(x < p->end); mysql_mutex_lock(&p->lock); *x=0; @@ -9931,7 +9934,8 @@ int TC_LOG_BINLOG::open(const char *opt_name) int error= 1; DBUG_ASSERT(total_ha_2pc > 1); - DBUG_ASSERT(opt_name && opt_name[0]); + DBUG_ASSERT(opt_name); + DBUG_ASSERT(opt_name[0]); if (!my_b_inited(&index_file)) { diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index c4495d4f1e4..1eb5a9ce25e 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2739,14 +2739,24 @@ next_page: buf_pool.free_block(free_block); /* Wait until all the pages have been processed */ - while (!pages.empty()) + for (;;) { + const bool empty= pages.empty(); + if (empty && !buf_pool.n_pend_reads) + break; + if (!is_corrupt_fs() && !is_corrupt_log()) { if (last_batch) { mysql_mutex_assert_not_owner(&log_sys.mutex); - mysql_cond_wait(&cond, &mutex); + if (!empty) + mysql_cond_wait(&cond, &mutex); + else + { + set_timespec_nsec(abstime, 100000ULL); /* 100ms */ + mysql_cond_timedwait(&cond, &mutex, &abstime); + } } else { diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index d218483b104..7db9494e26f 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -434,6 +434,7 @@ void mtr_t::commit() m_freed_space->clear_freed_ranges(); delete m_freed_pages; m_freed_pages= nullptr; + m_freed_space= nullptr; /* mtr_t::start() will reset m_trim_pages */ } else |