diff --git a/CMakeLists.txt b/CMakeLists.txt index 6706779a91d..ac556bd3ff4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ ENDIF() # in RPM's: #set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true") -FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0074 CMP0075 CMP0069 CMP0135) +FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0067 CMP0074 CMP0075 CMP0069 CMP0135) IF(POLICY ${p}) CMAKE_POLICY(SET ${p} NEW) ENDIF() diff --git a/client/mysql.cc b/client/mysql.cc index 11858ef52f1..2aa235577f1 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -5334,6 +5334,9 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) } if (!opt_silent || info_type == INFO_ERROR) { + report_progress_end(); + fflush(stdout); + if (!inited) { #ifdef HAVE_SETUPTERM diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 053e3b23c07..1acbbef400f 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -459,9 +459,12 @@ bool get_mysql_vars(MYSQL *connection) msg("Using server version %s", version_var); - if (!(ret= detect_mysql_capabilities_for_backup())) + if (opt_galera_info && !have_galera_enabled) { - goto out; + msg("--galera-info is specified on the command " + "line, but the server does not support Galera " + "replication. Ignoring the option."); + opt_galera_info= false; } /* make sure datadir value is the same in configuration file */ @@ -554,30 +557,6 @@ out: return (ret); } -/*********************************************************************//** -Query the server to find out what backup capabilities it supports. -@return true on success. */ -bool -detect_mysql_capabilities_for_backup() -{ - /* do some sanity checks */ - if (opt_galera_info && !have_galera_enabled) { - msg("--galera-info is specified on the command " - "line, but the server does not support Galera " - "replication. Ignoring the option."); - opt_galera_info = false; - } - - if (opt_slave_info && have_multi_threaded_slave && - !have_gtid_slave) { - msg("The --slave-info option requires GTID enabled for a " - "multi-threaded slave."); - return(false); - } - - return(true); -} - static bool select_incremental_lsn_from_history(lsn_t *incremental_lsn) diff --git a/extra/mariabackup/backup_mysql.h b/extra/mariabackup/backup_mysql.h index c87efd21c11..ce7755d17af 100644 --- a/extra/mariabackup/backup_mysql.h +++ b/extra/mariabackup/backup_mysql.h @@ -43,9 +43,6 @@ backup_cleanup(); bool get_mysql_vars(MYSQL *connection); -bool -detect_mysql_capabilities_for_backup(); - MYSQL * xb_mysql_connect(); diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 647432b15d4..ad48ad9e17c 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -186,6 +186,7 @@ xb_fil_cur_open( } #else err = fstat(cursor->file.m_file, &cursor->statinfo); + MSAN_STAT_WORKAROUND(&cursor->statinfo); #endif if (max_file_size < (ulonglong)cursor->statinfo.st_size) { cursor->statinfo.st_size = (ulonglong)max_file_size; diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 4bb691074c1..5c0f96c81b1 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -916,13 +916,15 @@ datafiles_iter_next(datafiles_iter_t *it) fil_system.space_list.begin() : std::next(it->space); - while (it->space != fil_system.space_list.end() && - (it->space->purpose != FIL_TYPE_TABLESPACE || - UT_LIST_GET_LEN(it->space->chain) == 0)) + while (it->space != fil_system.space_list.end() + && UT_LIST_GET_LEN(it->space->chain) == 0) ++it->space; if (it->space == fil_system.space_list.end()) goto end; + ut_ad(!it->space->is_temporary()); + ut_ad(!it->space->is_being_imported()); + it->node = UT_LIST_GET_FIRST(it->space->chain); end: @@ -1114,7 +1116,8 @@ static void backup_file_op(uint32_t space_id, int type, std::string space_name = filename_to_spacename(name, len); ddl_tracker.id_to_name[space_id] = space_name; ddl_tracker.delete_defer(space_id, space_name); - msg("DDL tracking : create %u \"%.*s\"", space_id, int(len), name); + msg("DDL tracking : create %" PRIu32 " \"%.*s\"", + space_id, int(len), name); } break; case FILE_MODIFY: @@ -1130,7 +1133,7 @@ static void backup_file_op(uint32_t space_id, int type, ddl_tracker.id_to_name[space_id] = new_space_name; ddl_tracker.rename_defer(space_id, old_space_name, new_space_name); - msg("DDL tracking : rename %u \"%.*s\",\"%.*s\"", + msg("DDL tracking : rename %" PRIu32 " \"%.*s\",\"%.*s\"", space_id, int(len), name, int(new_len), new_name); } break; @@ -1138,7 +1141,8 @@ static void backup_file_op(uint32_t space_id, int type, ddl_tracker.drops.insert(space_id); ddl_tracker.delete_defer( space_id, filename_to_spacename(name, len)); - msg("DDL tracking : delete %u \"%.*s\"", space_id, int(len), name); + msg("DDL tracking : delete %" PRIu32 " \"%.*s\"", + space_id, int(len), name); break; default: ut_ad(0); @@ -1189,13 +1193,14 @@ static void backup_file_op_fail(uint32_t space_id, int type, const std::string spacename{filename_to_spacename(name, len)}; switch (type) { case FILE_CREATE: - msg("DDL tracking : create %u \"%.*s\"", space_id, int(len), name); + msg("DDL tracking : create %" PRIu32 " \"%.*s\"", + space_id, int(len), name); fail = !check_if_skip_table(spacename.c_str()); break; case FILE_MODIFY: break; case FILE_RENAME: - msg("DDL tracking : rename %u \"%.*s\",\"%.*s\"", + msg("DDL tracking : rename %" PRIu32 " \"%.*s\",\"%.*s\"", space_id, int(len), name, int(new_len), new_name); fail = !check_if_skip_table(spacename.c_str()) || !check_if_skip_table( @@ -1204,7 +1209,8 @@ static void backup_file_op_fail(uint32_t space_id, int type, case FILE_DELETE: fail = !check_if_skip_table(spacename.c_str()) && !check_if_fts_table(spacename.c_str()); - msg("DDL tracking : delete %u \"%.*s\"", space_id, int(len), name); + msg("DDL tracking : delete %" PRIu32 " \"%.*s\"", + space_id, int(len), name); break; default: ut_ad(0); @@ -1225,7 +1231,7 @@ static void backup_undo_trunc(uint32_t space_id) /* Function to store the space id of page0 INIT_PAGE @param space_id space id which has page0 init page */ -static void backup_first_page_op(space_id_t space_id) +static void backup_first_page_op(uint32_t space_id) { first_page_init_ids.insert(space_id); } @@ -3955,8 +3961,8 @@ static void xb_load_single_table_tablespace(const char *dirname, if (err == DB_SUCCESS && file->space_id() != SRV_TMP_SPACE_ID) { mysql_mutex_lock(&fil_system.mutex); space = fil_space_t::create( - file->space_id(), file->flags(), - FIL_TYPE_TABLESPACE, nullptr/* TODO: crypt_data */, + uint32_t(file->space_id()), file->flags(), false, + nullptr/* TODO: crypt_data */, FIL_ENCRYPTION_DEFAULT, file->handle() != OS_FILE_CLOSED); ut_ad(space); @@ -4173,6 +4179,7 @@ next_file: return(-1); } + MSAN_STAT_WORKAROUND(&statinfo); info->size = statinfo.st_size; if (S_ISDIR(statinfo.st_mode)) { @@ -5691,8 +5698,8 @@ void CorruptedPages::backup_fix_ddl(ds_ctxt *ds_data, ds_ctxt *ds_meta) iter != ddl_tracker.tables_in_backup.end(); iter++) { - const std::string name = iter->second; uint32_t id = iter->first; + const std::string &name = iter->second; if (ddl_tracker.drops.find(id) != ddl_tracker.drops.end()) { dropped_tables.insert(name); @@ -5719,7 +5726,7 @@ void CorruptedPages::backup_fix_ddl(ds_ctxt *ds_data, ds_ctxt *ds_meta) iter++) { uint32_t id = iter->first; - std::string name = iter->second; + const std::string &name = iter->second; if (ddl_tracker.tables_in_backup.find(id) != ddl_tracker.tables_in_backup.end()) { /* already processed above */ @@ -6016,8 +6023,8 @@ exit: char tmpname[FN_REFLEN]; - snprintf(tmpname, FN_REFLEN, "%s/xtrabackup_tmp_#%u", - dbname, fil_space->id); + snprintf(tmpname, FN_REFLEN, "%s/xtrabackup_tmp_#%" + PRIu32, dbname, fil_space->id); msg("mariabackup: Renaming %s to %s.ibd", fil_space->chain.start->name, tmpname); @@ -6072,8 +6079,8 @@ exit: ut_ad(fil_space_t::physical_size(flags) == info.page_size); mysql_mutex_lock(&fil_system.mutex); - fil_space_t* space = fil_space_t::create(info.space_id, flags, - FIL_TYPE_TABLESPACE, 0, + fil_space_t* space = fil_space_t::create(uint32_t(info.space_id), + flags, false, 0, FIL_ENCRYPTION_DEFAULT, true); mysql_mutex_unlock(&fil_system.mutex); if (space) { @@ -6866,7 +6873,8 @@ error: srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct; } - if (innodb_init()) { + recv_sys.recovery_on = false; + if (innodb_init()) { goto error; } diff --git a/include/handler_ername.h b/include/handler_ername.h index e969daa7c77..32faa84b52d 100644 --- a/include/handler_ername.h +++ b/include/handler_ername.h @@ -78,5 +78,7 @@ { "HA_ERR_ABORTED_BY_USER", HA_ERR_ABORTED_BY_USER, "" }, { "HA_ERR_DISK_FULL", HA_ERR_DISK_FULL, "" }, { "HA_ERR_INCOMPATIBLE_DEFINITION", HA_ERR_INCOMPATIBLE_DEFINITION, "" }, -{ "HA_ERR_NO_ENCRYPTION", HA_ERR_NO_ENCRYPTION, "" }, { "HA_ERR_COMMIT_ERROR", HA_ERR_COMMIT_ERROR, "" }, +{ "HA_ERR_PARTITION_LIST", HA_ERR_PARTITION_LIST, ""}, +{ "HA_ERR_NO_ENCRYPTION", HA_ERR_NO_ENCRYPTION, ""}, +{ "HA_ERR_ROLLBACK", HA_ERR_ROLLBACK, "" }, diff --git a/include/heap.h b/include/heap.h index 2e0e9357a3b..3fac752abd0 100644 --- a/include/heap.h +++ b/include/heap.h @@ -105,6 +105,7 @@ typedef struct st_heap_block uint recbuffer; /* Length of one saved record */ ulong records_in_block; /* Records in one heap-block */ ulong last_allocated; /* number of records there is allocated space for */ + size_t alloc_size; /* Allocate blocks of this size */ } HP_BLOCK; struct st_heap_info; /* For reference */ diff --git a/include/my_base.h b/include/my_base.h index b214ad045f3..f7ff053ed40 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -543,7 +543,8 @@ enum ha_base_keytype { #define HA_ERR_COMMIT_ERROR 197 #define HA_ERR_PARTITION_LIST 198 #define HA_ERR_NO_ENCRYPTION 199 -#define HA_ERR_LAST 199 /* Copy of last error nr * */ +#define HA_ERR_ROLLBACK 200 /* Automatic rollback done */ +#define HA_ERR_LAST 200 /* Copy of last error nr * */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff --git a/include/my_global.h b/include/my_global.h index f58f76b46b4..4112dd9931d 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -679,10 +679,10 @@ typedef SOCKET_SIZE_TYPE size_socket; */ #define IO_SIZE 4096U /* - How much overhead does malloc have. The code often allocates + How much overhead does malloc/my_malloc have. The code often allocates something like 1024-MALLOC_OVERHEAD bytes */ -#define MALLOC_OVERHEAD 8 +#define MALLOC_OVERHEAD (8+24) /* get memory in huncs */ #define ONCE_ALLOC_INIT (uint) 4096 diff --git a/include/my_handler_errors.h b/include/my_handler_errors.h index df414888907..4e96945e134 100644 --- a/include/my_handler_errors.h +++ b/include/my_handler_errors.h @@ -110,7 +110,8 @@ static const char *handler_error_messages[]= "Sequence values are conflicting", "Error during commit", "Cannot select partitions", - "Cannot initialize encryption. Check that all encryption parameters have been set" + "Cannot initialize encryption. Check that all encryption parameters have been set", + "Transaction was aborted", }; #endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */ diff --git a/include/my_sys.h b/include/my_sys.h index b4a5b34114e..61401f7e1a3 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -257,9 +257,9 @@ extern void (*my_sigtstp_cleanup)(void), /* Executed before jump to shell */ (*my_sigtstp_restart)(void); /* Executed when coming from shell */ -extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */ -extern int my_umask_dir, - my_recived_signals, /* Signals we have got */ +extern MYSQL_PLUGIN_IMPORT mode_t my_umask; /* Default creation mask */ +extern mode_t my_umask_dir; +extern int my_recived_signals, /* Signals we have got */ my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ my_dont_interrupt; /* call remember_intr when set */ #ifdef _WIN32 @@ -635,7 +635,7 @@ extern File my_open(const char *FileName,int Flags,myf MyFlags); extern File my_register_filename(File fd, const char *FileName, enum file_type type_of_file, uint error_message_number, myf MyFlags); -extern File my_create(const char *FileName,int CreateFlags, +extern File my_create(const char *FileName, mode_t CreateFlags, int AccessFlags, myf MyFlags); extern int my_close(File Filedes,myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags); @@ -643,7 +643,7 @@ extern int my_readlink(char *to, const char *filename, myf MyFlags); extern int my_is_symlink(const char *filename); extern int my_realpath(char *to, const char *filename, myf MyFlags); extern File my_create_with_symlink(const char *linkname, const char *filename, - int createflags, int access_flags, + mode_t createflags, int access_flags, myf MyFlags); extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); extern int my_symlink(const char *content, const char *linkname, myf MyFlags); @@ -893,6 +893,7 @@ extern void my_free_lock(void *ptr); #define my_free_lock(A) my_free((A)) #endif #define alloc_root_inited(A) ((A)->min_malloc != 0) +#define DEFAULT_ROOT_BLOCK_SIZE 1024 #define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0) extern void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size, diff --git a/include/mysql/service_log_warnings.h b/include/mysql/service_log_warnings.h new file mode 100644 index 00000000000..f55df70ef8e --- /dev/null +++ b/include/mysql/service_log_warnings.h @@ -0,0 +1,52 @@ +/* Copyright (c) 2013, 2018, MariaDB + + 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#ifndef MYSQL_SERVICE_LOG_WARNINGS +#define MYSQL_SERVICE_LOG_WARNINGS + +/** + @file + This service provides access to the log warning level for the + current session. + + thd_log_warnings(thd) + @return thd->log_warnings +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct thd_log_warnings_service_st { + void *(*thd_log_warnings)(MYSQL_THD); +} *thd_log_warnings_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN +# define thd_log_warnings(THD) thd_log_warnings_service->thd_log_warnings(THD) +#else +/** + MDL_context accessor + @param thd the current session + @return pointer to thd->mdl_context +*/ +int thd_log_warnings(MYSQL_THD thd); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/mysql-test/include/innodb_rollback_on_timeout.inc b/mysql-test/include/innodb_rollback_on_timeout.inc index d41e1f1ec9f..5fbdaa1c62a 100644 --- a/mysql-test/include/innodb_rollback_on_timeout.inc +++ b/mysql-test/include/innodb_rollback_on_timeout.inc @@ -2,6 +2,10 @@ # Bug #24200: Provide backwards compatibility mode for 4.x "rollback on # transaction timeout" # +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --disable_warnings drop table if exists t1; --enable_warnings diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 308dbb77a3e..ff239d676a9 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -454,9 +454,8 @@ sub mtr_report_stats ($$$$) { # Print info about reporting the error print "The log files in var/log may give you some hint of what went wrong.\n\n", - "If you want to report this error, please read first ", - "the documentation\n", - "at http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n\n"; + "If you want to report this error, MariaDB's bug tracker is found at\n", + "https://jira.mariadb.org\n\n"; } else diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl index 8964b0f8077..6f8677110ba 100644 --- a/mysql-test/lib/v1/mtr_report.pl +++ b/mysql-test/lib/v1/mtr_report.pl @@ -198,9 +198,8 @@ sub mtr_report_stats ($) { print "The log files in var/log may give you some hint\n", "of what went wrong.\n", - "If you want to report this error, please read first ", - "the documentation at\n", - "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n"; + "If you want to report this error, MariaDB's bug tracker is found at\n", + "https://jira.mariadb.org\n" } if (!$::opt_extern) { diff --git a/mysql-test/main/bad_startup_options.result b/mysql-test/main/bad_startup_options.result index b1eed54e172..7846e629ef8 100644 --- a/mysql-test/main/bad_startup_options.result +++ b/mysql-test/main/bad_startup_options.result @@ -1,2 +1,3 @@ FOUND 1 /\[ERROR\] SSL error: Unable to get certificate/ in errorlog.err +FOUND 1 /\[ERROR\] SSL error: Failed to set ciphers to use/ in errorlog.err # restart diff --git a/mysql-test/main/bad_startup_options.test b/mysql-test/main/bad_startup_options.test index e758d786049..ba88476625d 100644 --- a/mysql-test/main/bad_startup_options.test +++ b/mysql-test/main/bad_startup_options.test @@ -19,4 +19,11 @@ --source include/search_pattern_in_file.inc --remove_file $SEARCH_FILE +# No valid cipher suites +--error 1 +--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --ssl-cipher=ECDHE-ECDSA-FAKE-CIPHER:ECDHE-RSA-INVALID --log-error=$errorlog +--let SEARCH_PATTERN=\[ERROR\] SSL error: Failed to set ciphers to use +--source include/search_pattern_in_file.inc +--remove_file $SEARCH_FILE + --source include/start_mysqld.inc diff --git a/mysql-test/main/bug39022.test b/mysql-test/main/bug39022.test index 211a40234b4..81dd6f14bed 100644 --- a/mysql-test/main/bug39022.test +++ b/mysql-test/main/bug39022.test @@ -2,6 +2,10 @@ -- source include/have_innodb.inc -- source include/not_binlog_format_row.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --echo # --echo # Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees --echo # diff --git a/mysql-test/main/count_distinct.result b/mysql-test/main/count_distinct.result index 037674aa66a..30f24127982 100644 --- a/mysql-test/main/count_distinct.result +++ b/mysql-test/main/count_distinct.result @@ -96,6 +96,8 @@ drop view v1; create table t1 (user_id char(64) character set utf8); insert t1 values(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17); set @@tmp_table_size = 1024; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1024' select count(distinct user_id) from t1; count(distinct user_id) 17 @@ -125,6 +127,8 @@ insert into t1 values ( 2 , 13 ), ( 3 , 14 ); set @@tmp_table_size=1024; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1024' select count(distinct a) from t1; count(distinct a) 10 diff --git a/mysql-test/main/derived_opt.result b/mysql-test/main/derived_opt.result index 2f3b29c5049..2e9cabeba86 100644 --- a/mysql-test/main/derived_opt.result +++ b/mysql-test/main/derived_opt.result @@ -310,7 +310,7 @@ a char(2) NOT NULL DEFAULT '', PRIMARY KEY (a) ) ENGINE=MyISAM; INSERT INTO t4 VALUES ('CD'); -set @@tmp_table_size=8192; +set @@tmp_table_size=16384; EXPLAIN SELECT * FROM t3 AS tx JOIN t2 AS ty ON (tx.pk = ty.pk) WHERE diff --git a/mysql-test/main/derived_opt.test b/mysql-test/main/derived_opt.test index dee424559ee..57c97cc4071 100644 --- a/mysql-test/main/derived_opt.test +++ b/mysql-test/main/derived_opt.test @@ -245,7 +245,7 @@ CREATE TABLE t4 ( ) ENGINE=MyISAM; INSERT INTO t4 VALUES ('CD'); -set @@tmp_table_size=8192; +set @@tmp_table_size=16384; --replace_column 9 # EXPLAIN diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result index 5ceb04cb75d..f8f5130c08f 100644 --- a/mysql-test/main/derived_view.result +++ b/mysql-test/main/derived_view.result @@ -2318,6 +2318,8 @@ INSERT INTO t3 VALUES ('Miami'); SET @save_optimizer_switch=@@optimizer_switch; SET optimizer_switch = 'derived_with_keys=on'; SET @@tmp_table_size=1024*4; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '4096' explain SELECT * FROM (SELECT t1.* FROM t1, t2) AS t JOIN t3 ON t3.a = t.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 system NULL NULL NULL NULL 1 diff --git a/mysql-test/main/distinct.result b/mysql-test/main/distinct.result index 1ed52eb866b..72968f72798 100644 --- a/mysql-test/main/distinct.result +++ b/mysql-test/main/distinct.result @@ -1009,6 +1009,8 @@ DROP TABLE t1; # SET @tmp_table_size_save= @@tmp_table_size; SET @@tmp_table_size= 1024; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1024' CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8); INSERT INTO t1 SELECT a+8 FROM t1; diff --git a/mysql-test/main/error_simulation.result b/mysql-test/main/error_simulation.result index 3b41e0bc5a4..c128ad88fa0 100644 --- a/mysql-test/main/error_simulation.result +++ b/mysql-test/main/error_simulation.result @@ -1,15 +1,12 @@ CREATE TABLE t1 ( -a varchar(32) character set utf8 collate utf8_bin NOT NULL, -b varchar(32) character set utf8 collate utf8_bin NOT NULL ) +a varchar(128) character set utf8 collate utf8_bin NOT NULL, +b varchar(128) character set utf8 collate utf8_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -INSERT INTO t1 VALUES -('AAAAAAAAAA','AAAAAAAAAA'), ('AAAAAAAAAB','AAAAAAAAAB '), -('AAAAAAAAAB','AAAAAAAAAB'), ('AAAAAAAAAC','AAAAAAAAAC'), -('AAAAAAAAAD','AAAAAAAAAD'), ('AAAAAAAAAE','AAAAAAAAAE'), -('AAAAAAAAAF','AAAAAAAAAF'), ('AAAAAAAAAG','AAAAAAAAAG'), -('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'), -('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK'); -set tmp_table_size=1024; +INSERT INTO t1 +select concat(repeat("A", 50),char(32+mod(seq,31)),char(32+mod(seq,29))), +concat(repeat("A", 50),char(32+mod(seq,31)),char(32+mod(seq,29))) +from seq_1_to_128; +set tmp_table_size=16384; SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,raise_error"; SELECT MAX(a) FROM t1 GROUP BY a,b; diff --git a/mysql-test/main/error_simulation.test b/mysql-test/main/error_simulation.test index c4e2d442727..fc5d9c537c7 100644 --- a/mysql-test/main/error_simulation.test +++ b/mysql-test/main/error_simulation.test @@ -1,23 +1,20 @@ --source include/have_debug.inc --source include/not_embedded.inc - +--source include/have_sequence.inc # # Bug #28499: crash for grouping query when tmp_table_size is too small # CREATE TABLE t1 ( - a varchar(32) character set utf8 collate utf8_bin NOT NULL, - b varchar(32) character set utf8 collate utf8_bin NOT NULL ) + a varchar(128) character set utf8 collate utf8_bin NOT NULL, + b varchar(128) character set utf8 collate utf8_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -INSERT INTO t1 VALUES - ('AAAAAAAAAA','AAAAAAAAAA'), ('AAAAAAAAAB','AAAAAAAAAB '), - ('AAAAAAAAAB','AAAAAAAAAB'), ('AAAAAAAAAC','AAAAAAAAAC'), - ('AAAAAAAAAD','AAAAAAAAAD'), ('AAAAAAAAAE','AAAAAAAAAE'), - ('AAAAAAAAAF','AAAAAAAAAF'), ('AAAAAAAAAG','AAAAAAAAAG'), - ('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'), - ('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK'); +INSERT INTO t1 +select concat(repeat("A", 50),char(32+mod(seq,31)),char(32+mod(seq,29))), + concat(repeat("A", 50),char(32+mod(seq,31)),char(32+mod(seq,29))) + from seq_1_to_128; -set tmp_table_size=1024; +set tmp_table_size=16384; # Set debug flag so an error is returned when # tmp table in query is converted from heap to myisam diff --git a/mysql-test/main/func_concat.result b/mysql-test/main/func_concat.result index 4303c97d35c..4b91fb97c6c 100644 --- a/mysql-test/main/func_concat.result +++ b/mysql-test/main/func_concat.result @@ -287,3 +287,20 @@ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub; c2 abcdefghi,abcdefghi-abcdefghi,abcdefghi DROP TABLE t1; +# Start of 10.5 tests +# +# MDEV-13120 Wrong results with MAKE_SET() and subquery +# +CREATE TABLE t1 (a DATE, b DATETIME, c VARCHAR(8)); +INSERT INTO t1 VALUES +('1996-03-06','1985-11-16 08:00:46','foo'), +('2028-08-26','1900-01-01 00:00:00','bar'), +('1973-05-04','1900-01-01 00:00:00','qux'); +SELECT CONCAT_WS(' ', a, b, PASSWORD(c)) AS f FROM t1 GROUP BY f WITH ROLLUP; +f +1973-05-04 1900-01-01 00:00:00 *6D720C5AAB5096E70AA751206B45B484E5E0121F +1996-03-06 1985-11-16 08:00:46 *F3A2A51A9B0F2BE2468926B4132313728C250DBF +2028-08-26 1900-01-01 00:00:00 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB +NULL +DROP TABLE t1; +# End of 10.5 tests diff --git a/mysql-test/main/func_concat.test b/mysql-test/main/func_concat.test index 44dea7e35b1..f93b150f88f 100644 --- a/mysql-test/main/func_concat.test +++ b/mysql-test/main/func_concat.test @@ -265,3 +265,19 @@ CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1); INSERT INTO t1 VALUES('abcdefghi'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub; DROP TABLE t1; + +--echo # Start of 10.5 tests + +--echo # +--echo # MDEV-13120 Wrong results with MAKE_SET() and subquery +--echo # + +CREATE TABLE t1 (a DATE, b DATETIME, c VARCHAR(8)); +INSERT INTO t1 VALUES +('1996-03-06','1985-11-16 08:00:46','foo'), +('2028-08-26','1900-01-01 00:00:00','bar'), +('1973-05-04','1900-01-01 00:00:00','qux'); +SELECT CONCAT_WS(' ', a, b, PASSWORD(c)) AS f FROM t1 GROUP BY f WITH ROLLUP; +DROP TABLE t1; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result index 665acfb445c..898f44301f2 100644 --- a/mysql-test/main/func_math.result +++ b/mysql-test/main/func_math.result @@ -1,4 +1,3 @@ -drop table if exists t1; select floor(5.5),floor(-5.5); floor(5.5) floor(-5.5) 5 -6 @@ -3726,5 +3725,17 @@ SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+ c1 NULL # -# End of 10.5 tests +# MDEV-35651 NO_UNSIGNED_SUBTRACTION does not work for multiple unsigned integers # +set sql_mode=no_unsigned_subtraction; +select cast(0 as unsigned) - 1; +cast(0 as unsigned) - 1 +-1 +select 2-cast(3 as unsigned); +2-cast(3 as unsigned) +-1 +select cast(1 as unsigned) - cast(2 as unsigned); +cast(1 as unsigned) - cast(2 as unsigned) +-1 +set sql_mode=default; +# End of 10.5 tests diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index 634511f54fa..363d84eab3e 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -4,10 +4,6 @@ --source include/default_charset.inc ---disable_warnings -drop table if exists t1; ---enable_warnings - select floor(5.5),floor(-5.5); explain extended select floor(5.5),floor(-5.5); select ceiling(5.5),ceiling(-5.5); @@ -1992,7 +1988,13 @@ SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) AS c1; SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1; SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1; +--echo # +--echo # MDEV-35651 NO_UNSIGNED_SUBTRACTION does not work for multiple unsigned integers +--echo # +set sql_mode=no_unsigned_subtraction; +select cast(0 as unsigned) - 1; +select 2-cast(3 as unsigned); +select cast(1 as unsigned) - cast(2 as unsigned); +set sql_mode=default; ---echo # --echo # End of 10.5 tests ---echo # diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 51a8dc94e82..bc045f08324 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -5466,4 +5466,12 @@ CREATE TABLE t (f POINT, KEY(f)); DELETE FROM t WHERE f NOT IN (NULL,'x'); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field DROP TABLE t; +# +# MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor +# +CREATE TABLE t (a INT, b POINT); +INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0)); +SELECT NTH_VALUE(a,b) OVER () FROM t; +ERROR HY000: Illegal parameter data types point and bigint for operation '-' +DROP TABLE t; # End of 10.5 tests diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 88b9a59409d..1dd713e870a 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -3472,4 +3472,14 @@ CREATE TABLE t (f POINT, KEY(f)); DELETE FROM t WHERE f NOT IN (NULL,'x'); DROP TABLE t; +--echo # +--echo # MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor +--echo # + +CREATE TABLE t (a INT, b POINT); +INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT NTH_VALUE(a,b) OVER () FROM t; +DROP TABLE t; + --echo # End of 10.5 tests diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result index 3d27707ca91..110772336be 100644 --- a/mysql-test/main/information_schema.result +++ b/mysql-test/main/information_schema.result @@ -2390,7 +2390,7 @@ drop database dummy; USE test; CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema; SELECT * FROM v LIMIT ROWS EXAMINED 9; -ERROR HY000: Sort aborted: +ERROR HY000: Sort aborted: LIMIT ROWS EXAMINED DROP VIEW v; # # MDEV-23408 Wrong result upon query from I_S and further Assertion `!alias_arg || strlen(alias_arg->str) == alias_arg->length' failed with certain connection charset diff --git a/mysql-test/main/innodb_mysql_lock.test b/mysql-test/main/innodb_mysql_lock.test index 5ee688b1d6e..e61b2fde055 100644 --- a/mysql-test/main/innodb_mysql_lock.test +++ b/mysql-test/main/innodb_mysql_lock.test @@ -1,6 +1,10 @@ --source include/have_metadata_lock_info.inc -- source include/have_innodb.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # Save the initial number of concurrent sessions. --source include/count_sessions.inc diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result index eba5d4bbf9e..07a2bd174d3 100644 --- a/mysql-test/main/insert_select.result +++ b/mysql-test/main/insert_select.result @@ -883,76 +883,6 @@ INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a; Warnings: Warning 1264 Out of range value for column 'a' at row 4 DROP TABLE t1; -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 (a) SELECT SUM(1); -INSERT INTO t1 (a, b) SELECT AVG(2), MIN(3); -INSERT INTO t1 (b) SELECT AVG('x') OVER (); -ERROR 22007: Truncated incorrect DOUBLE value: 'x' -INSERT INTO t1 SELECT MIN(7) OVER (), MAX(8) OVER(); -SELECT * FROM t1; -a b -1 NULL -2 3 -7 8 -PREPARE stmt FROM 'INSERT INTO t1 (a) SELECT AVG(?)'; -EXECUTE stmt USING 9; -EXECUTE stmt USING 10; -PREPARE stmt FROM 'INSERT INTO t1 SELECT MIN(?), MAX(?)'; -EXECUTE stmt USING 11, 12; -EXECUTE stmt USING 13, 14; -DEALLOCATE PREPARE stmt; -SELECT * FROM t1; -a b -1 NULL -2 3 -7 8 -9 NULL -10 NULL -11 12 -13 14 -CREATE PROCEDURE p1(param_a INT, param_b INT) -BEGIN -INSERT INTO t1 SELECT MIN(param_a) OVER (), MAX(param_b); -END// -CALL p1(21, 22); -CALL p1(23, 24); -SELECT * FROM t1; -a b -1 NULL -2 3 -7 8 -9 NULL -10 NULL -11 12 -13 14 -21 22 -23 24 -CREATE TABLE t2 ( -a DECIMAL UNIQUE CHECK (CASE 0 * 27302337.000000 WHEN 34 THEN -+ 'x' LIKE 'x' OR a NOT IN (-1 / TRUE ^ 2) ELSE 7105743.000000 END)); -INSERT INTO t2 VALUES (90),( -1),(31152443.000000),(-32768),(NULL),(NULL); -INSERT INTO t2 SELECT AVG('x') OVER ( -PARTITION BY ((NOT AVG(76698761.000000))) IS NOT NULL); -ERROR 22007: Truncated incorrect DOUBLE value: 'x' -INSERT IGNORE INTO t2 () VALUES (0),('x'),(3751286.000000), -('x'),((a = 'x' AND 0 AND 0)); -Warnings: -Warning 1366 Incorrect decimal value: 'x' for column `test`.`t2`.`a` at row 2 -Warning 1062 Duplicate entry '0' for key 'a' -Warning 1366 Incorrect decimal value: 'x' for column `test`.`t2`.`a` at row 4 -Warning 1062 Duplicate entry '0' for key 'a' -Warning 1062 Duplicate entry '0' for key 'a' -INSERT INTO t2 VALUES (127); -INSERT INTO t2 SELECT -2147483648 END FROM t2 AS TEXT JOIN t2 JOIN t2 TABLES; -ERROR 23000: Duplicate entry '-2147483648' for key 'a' -ALTER TABLE t2 ADD ( -b INT UNIQUE CHECK ((a = 'x' AND ((-(+(BINARY 49730460.000000)))) = 'x' -BETWEEN 'x' AND 'x'))); -ERROR 22007: Truncated incorrect DECIMAL value: 'x' -UPDATE t2 SET a = -128 WHERE a IS NULL ORDER BY 78 IN ('x','x'),a; -ERROR 23000: Duplicate entry '-128' for key 'a' -DROP TABLE t1, t2; -DROP PROCEDURE p1; # End of 10.2 test # # MDEV-28617: INSERT ... SELECT with redundant IN subquery in GROUP BY @@ -1054,3 +984,52 @@ drop table t1, t2; # # End of 10.3 test # +# +# MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT +# +CREATE TABLE t1 (a int); +INSERT INTO t1 SELECT AVG(1); +SELECT * FROM t1; +a +1 +INSERT INTO t1 SELECT MIN(2) OVER (); +SELECT * FROM t1; +a +1 +2 +CREATE VIEW v1 AS SELECT * FROM t1 ORDER BY a; +INSERT INTO v1 SELECT SUM(3); +SELECT * FROM v1; +a +1 +2 +3 +INSERT INTO v1 SELECT * FROM v1; +SELECT * FROM t1; +a +1 +1 +2 +2 +3 +3 +INSERT INTO t1 SELECT * FROM v1; +SELECT * FROM t1; +a +1 +1 +1 +1 +2 +2 +2 +2 +3 +3 +3 +3 +DROP VIEW v1; +DROP TABLE t1; +# +# End of 10.5 test +# diff --git a/mysql-test/main/insert_select.test b/mysql-test/main/insert_select.test index a3604e38f34..0e9bd05a93e 100644 --- a/mysql-test/main/insert_select.test +++ b/mysql-test/main/insert_select.test @@ -459,60 +459,6 @@ INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a; DROP TABLE t1; -# -# MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT -# -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 (a) SELECT SUM(1); -INSERT INTO t1 (a, b) SELECT AVG(2), MIN(3); - ---error ER_TRUNCATED_WRONG_VALUE -INSERT INTO t1 (b) SELECT AVG('x') OVER (); -INSERT INTO t1 SELECT MIN(7) OVER (), MAX(8) OVER(); -SELECT * FROM t1; - -PREPARE stmt FROM 'INSERT INTO t1 (a) SELECT AVG(?)'; -EXECUTE stmt USING 9; -EXECUTE stmt USING 10; - -PREPARE stmt FROM 'INSERT INTO t1 SELECT MIN(?), MAX(?)'; -EXECUTE stmt USING 11, 12; -EXECUTE stmt USING 13, 14; -DEALLOCATE PREPARE stmt; -SELECT * FROM t1; - -DELIMITER //; -CREATE PROCEDURE p1(param_a INT, param_b INT) -BEGIN -INSERT INTO t1 SELECT MIN(param_a) OVER (), MAX(param_b); -END// -DELIMITER ;// -CALL p1(21, 22); -CALL p1(23, 24); -SELECT * FROM t1; - -CREATE TABLE t2 ( - a DECIMAL UNIQUE CHECK (CASE 0 * 27302337.000000 WHEN 34 THEN - + 'x' LIKE 'x' OR a NOT IN (-1 / TRUE ^ 2) ELSE 7105743.000000 END)); -INSERT INTO t2 VALUES (90),( -1),(31152443.000000),(-32768),(NULL),(NULL); ---error ER_TRUNCATED_WRONG_VALUE -INSERT INTO t2 SELECT AVG('x') OVER ( - PARTITION BY ((NOT AVG(76698761.000000))) IS NOT NULL); -INSERT IGNORE INTO t2 () VALUES (0),('x'),(3751286.000000), - ('x'),((a = 'x' AND 0 AND 0)); -INSERT INTO t2 VALUES (127); ---error ER_DUP_ENTRY -INSERT INTO t2 SELECT -2147483648 END FROM t2 AS TEXT JOIN t2 JOIN t2 TABLES; ---error ER_TRUNCATED_WRONG_VALUE -ALTER TABLE t2 ADD ( - b INT UNIQUE CHECK ((a = 'x' AND ((-(+(BINARY 49730460.000000)))) = 'x' - BETWEEN 'x' AND 'x'))); ---error ER_DUP_ENTRY -UPDATE t2 SET a = -128 WHERE a IS NULL ORDER BY 78 IN ('x','x'),a; - -DROP TABLE t1, t2; -DROP PROCEDURE p1; - --echo # End of 10.2 test --echo # @@ -613,3 +559,38 @@ drop table t1, t2; --echo # --echo # End of 10.3 test --echo # + +--echo # +--echo # MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT +--echo # + +CREATE TABLE t1 (a int); + +INSERT INTO t1 SELECT AVG(1); +--sorted_result +SELECT * FROM t1; + +INSERT INTO t1 SELECT MIN(2) OVER (); +--sorted_result +SELECT * FROM t1; + +CREATE VIEW v1 AS SELECT * FROM t1 ORDER BY a; + +INSERT INTO v1 SELECT SUM(3); +--sorted_result +SELECT * FROM v1; + +INSERT INTO v1 SELECT * FROM v1; +--sorted_result +SELECT * FROM t1; + +INSERT INTO t1 SELECT * FROM v1; +--sorted_result +SELECT * FROM t1; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # End of 10.5 test +--echo # diff --git a/mysql-test/main/limit_rows_examined.result b/mysql-test/main/limit_rows_examined.result index 565c82c3f99..39dac6e5d22 100644 --- a/mysql-test/main/limit_rows_examined.result +++ b/mysql-test/main/limit_rows_examined.result @@ -602,7 +602,7 @@ select c1, c2 from t3 order by c2, c1 LIMIT ROWS EXAMINED 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 5 Using filesort select c1, c2 from t3 order by c2, c1 LIMIT ROWS EXAMINED 2; -ERROR HY000: Sort aborted: +ERROR HY000: Sort aborted: LIMIT ROWS EXAMINED explain select c1, c2 from t3i order by c2, c1 LIMIT ROWS EXAMINED 2; id select_type table type possible_keys key key_len ref rows Extra @@ -618,7 +618,7 @@ select c1, c2 from t3i order by c2, c1 desc LIMIT ROWS EXAMINED 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3i index NULL it3j 8 NULL 5 Using index; Using filesort select c1, c2 from t3i order by c2, c1 desc LIMIT ROWS EXAMINED 2; -ERROR HY000: Sort aborted: +ERROR HY000: Sort aborted: LIMIT ROWS EXAMINED drop table t3,t3i; ========================================================================= INSERT/DELETE/UPDATE @@ -889,3 +889,46 @@ Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c2` = `test`.`t1`.`c1` drop table t1,t2; # End of 10.4 tests +# +# MDEV-35571: Connection hangs after query on a partitioned table with UNION and LIMIT ROWS EXAMINED +# +create table t1 (a int); +insert into t1 values (1), (2); +select * from t1 UNION ALL select * from t1 LIMIT ROWS EXAMINED 1; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 1. The query result may be incomplete +select * from t1 UNION DISTINCT select * from t1 LIMIT ROWS EXAMINED 1; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 1. The query result may be incomplete +DROP TABLE t1; +create table t1 (a int); +insert into t1 values (1), (2); +(select a from t1 UNION ALL select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete +(select a from t1 UNION DISTINCT select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 SELECT seq%25 FROM seq_1_to_100; +CREATE TABLE t2 (b INT, c INT, KEY(b)) PARTITION BY HASH(c) PARTITIONS 12; +INSERT INTO t2 SELECT seq, seq FROM seq_1_to_10; +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION ALL SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; +COUNT(*) +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 100. The query result may be incomplete +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION DISTINCT SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; +COUNT(*) +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 100. The query result may be incomplete +DROP TABLE t1, t2; +# End of 10.5 tests diff --git a/mysql-test/main/limit_rows_examined.test b/mysql-test/main/limit_rows_examined.test index 791750bda07..ecc6f4d9274 100644 --- a/mysql-test/main/limit_rows_examined.test +++ b/mysql-test/main/limit_rows_examined.test @@ -617,3 +617,44 @@ select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2; drop table t1,t2; --echo # End of 10.4 tests + +--echo # +--echo # MDEV-35571: Connection hangs after query on a partitioned table with UNION and LIMIT ROWS EXAMINED +--echo # + +--source include/have_partition.inc +--source include/have_sequence.inc + +# Simplified test +create table t1 (a int); +insert into t1 values (1), (2); +select * from t1 UNION ALL select * from t1 LIMIT ROWS EXAMINED 1; +# UNION DISTINCT produces the same result here. Note that this is not +# affected by the MDEV-35571 patch +select * from t1 UNION DISTINCT select * from t1 LIMIT ROWS EXAMINED 1; +DROP TABLE t1; + +# Simplified test with order by +create table t1 (a int); +insert into t1 values (1), (2); +(select a from t1 UNION ALL select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +# UNION DISTINCT produces the same result with order by desc. Note +# that this is not affected by the MDEV-35571 patch +(select a from t1 UNION DISTINCT select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +DROP TABLE t1; + +# Original test +CREATE TABLE t1 (a INT); +INSERT INTO t1 SELECT seq%25 FROM seq_1_to_100; + +CREATE TABLE t2 (b INT, c INT, KEY(b)) PARTITION BY HASH(c) PARTITIONS 12; +INSERT INTO t2 SELECT seq, seq FROM seq_1_to_10; + +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION ALL SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; +# UNION DISTINCT produces the same result here. Note that this is not +# affected by the MDEV-35571 patch +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION DISTINCT SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; + +DROP TABLE t1, t2; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/log_slow.result b/mysql-test/main/log_slow.result index 4e4a4d71580..6c53debdf66 100644 --- a/mysql-test/main/log_slow.result +++ b/mysql-test/main/log_slow.result @@ -212,6 +212,23 @@ use `a b`; SET timestamp=1234567890; select count(*) from mysql.global_priv where length(priv)>2 +# +# MDEV-31366 Assertion `thd->start_time' failed in bool LOGGER::slow_log_print(THD*, const char*, size_t, ulonglong) +# +TRUNCATE mysql.slow_log; +SET global log_output='TABLE'; +SET timestamp=0.99; +SET long_query_time=0.00001; +SELECT SLEEP(0.1); +SLEEP(0.1) +0 +SELECT COUNT(*)>0 AS c1 FROM mysql.slow_log; +c1 +1 +SET global log_output=default; +SET timestamp=default; +SET long_query_time=default; +TRUNCATE mysql.slow_log; # End of 10.5 tests # # MDEV-34251 Conditional jump or move depends on uninitialised value in diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test index 3b1281bb8ed..73a3369f826 100644 --- a/mysql-test/main/log_slow.test +++ b/mysql-test/main/log_slow.test @@ -225,6 +225,21 @@ let SEARCH_PATTERN= use \`a\n.*2; let SEARCH_OUTPUT=matches; source include/search_pattern_in_file.inc; +--echo # +--echo # MDEV-31366 Assertion `thd->start_time' failed in bool LOGGER::slow_log_print(THD*, const char*, size_t, ulonglong) +--echo # + +TRUNCATE mysql.slow_log; +SET global log_output='TABLE'; +SET timestamp=0.99; +SET long_query_time=0.00001; +SELECT SLEEP(0.1); +SELECT COUNT(*)>0 AS c1 FROM mysql.slow_log; +SET global log_output=default; +SET timestamp=default; +SET long_query_time=default; +TRUNCATE mysql.slow_log; + --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/log_state.result b/mysql-test/main/log_state.result index 18c8da708a9..72d4f1c6195 100644 --- a/mysql-test/main/log_state.result +++ b/mysql-test/main/log_state.result @@ -275,6 +275,42 @@ SELECT @@general_log_file = @my_glf; @@general_log_file = @my_glf 1 SET GLOBAL general_log_file = @old_general_log_file; +# +# MDEV-35720 Add query_time to statistics +# +connect con2,localhost,root,,; +set @s1=(select variable_value from information_schema.session_status where +variable_name='query_time'); +select sleep(3) into @a; +set @s2=(select variable_value from information_schema.session_status where +variable_name='query_time'); +set @s3=(select variable_value from information_schema.global_status where +variable_name='query_time'); +select @s1 >= 0.00 and @s1 <= 2.00 as "should be true"; +should be true +1 +select @s2 >= 2.00 and @s2 < 10.00 as "should be true"; +should be true +1 +select @s3 >= 3.00 as "should be true"; +should be true +1 +disconnect con2; +connection default; +create procedure p1() +begin +select sleep(1) into @a; +select sleep(2) into @a; +end| +connect con2,localhost,root,,; +call p1(); +set @s1=(select variable_value from information_schema.session_status where +variable_name='query_time'); +select @s1 > 2.00 and @s1 < 10.00 as "should be true"; +should be true +1 +disconnect con2; +connection default; disconnect con1; connection default; SET GLOBAL long_query_time = @save_long_query_time; diff --git a/mysql-test/main/log_state.test b/mysql-test/main/log_state.test index 44a844a67b0..93e35854355 100644 --- a/mysql-test/main/log_state.test +++ b/mysql-test/main/log_state.test @@ -321,6 +321,45 @@ SET GLOBAL general_log_file = @old_general_log_file; --enable_ps_protocol +--echo # +--echo # MDEV-35720 Add query_time to statistics +--echo # + +connect (con2,localhost,root,,); +set @s1=(select variable_value from information_schema.session_status where +variable_name='query_time'); +select sleep(3) into @a; +set @s2=(select variable_value from information_schema.session_status where +variable_name='query_time'); +set @s3=(select variable_value from information_schema.global_status where +variable_name='query_time'); + +select @s1 >= 0.00 and @s1 <= 2.00 as "should be true"; +select @s2 >= 2.00 and @s2 < 10.00 as "should be true"; +select @s3 >= 3.00 as "should be true"; + +# select @s1,@s2,@s3; +disconnect con2; +connection default; + +delimiter |; +create procedure p1() +begin +select sleep(1) into @a; +select sleep(2) into @a; +end| +delimiter ;| + +connect (con2,localhost,root,,); +call p1(); +set @s1=(select variable_value from information_schema.session_status where +variable_name='query_time'); +select @s1 > 2.00 and @s1 < 10.00 as "should be true"; + +# select @s1; +disconnect con2; +connection default; + # # Cleanup # diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 973b8ff72a9..bf6ff598cd0 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -2,6 +2,10 @@ --source include/have_partition.inc --source include/have_sequence.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --echo # --echo # MDEV-18707 Server crash in my_hash_sort_bin, ASAN heap-use-after-free in Field::is_null, server hang, corrupted double-linked list --echo # diff --git a/mysql-test/main/long_unique_debug.result b/mysql-test/main/long_unique_debug.result index fb56a9d024b..01df77fc58b 100644 --- a/mysql-test/main/long_unique_debug.result +++ b/mysql-test/main/long_unique_debug.result @@ -90,13 +90,11 @@ table->field[0]->offset = 1 table->field[0]->field_length = 10 table->field[0]->null_pos wrt to record 0 = 0 table->field[0]->null_bit_pos = 1 - table->field[1]->field_name DB_ROW_HASH_1 table->field[1]->offset = 11 table->field[1]->field_length = 8 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 2 - SET debug_dbug=""; drop table t1; SET debug_dbug="d,print_long_unique_internal_state"; @@ -182,37 +180,31 @@ table->field[0]->offset = 1 table->field[0]->field_length = 10 table->field[0]->null_pos wrt to record 0 = 0 table->field[0]->null_bit_pos = 1 - table->field[1]->field_name b table->field[1]->offset = 11 table->field[1]->field_length = 10 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 2 - table->field[2]->field_name c table->field[2]->offset = 21 table->field[2]->field_length = 10 table->field[2]->null_pos wrt to record 0 = 0 table->field[2]->null_bit_pos = 4 - table->field[3]->field_name DB_ROW_HASH_1 table->field[3]->offset = 31 table->field[3]->field_length = 8 table->field[3]->null_pos wrt to record 0 = 0 table->field[3]->null_bit_pos = 8 - table->field[4]->field_name DB_ROW_HASH_2 table->field[4]->offset = 39 table->field[4]->field_length = 8 table->field[4]->null_pos wrt to record 0 = 0 table->field[4]->null_bit_pos = 16 - table->field[5]->field_name DB_ROW_HASH_3 table->field[5]->offset = 47 table->field[5]->field_length = 8 table->field[5]->null_pos wrt to record 0 = 0 table->field[5]->null_bit_pos = 32 - SET debug_dbug=""; drop table t1; SET debug_dbug="d,print_long_unique_internal_state"; @@ -290,37 +282,31 @@ table->field[0]->offset = 1 table->field[0]->field_length = 10 table->field[0]->null_pos wrt to record 0 = 0 table->field[0]->null_bit_pos = 1 - table->field[1]->field_name b table->field[1]->offset = 11 table->field[1]->field_length = 10 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 2 - table->field[2]->field_name c table->field[2]->offset = 21 table->field[2]->field_length = 10 table->field[2]->null_pos wrt to record 0 = 0 table->field[2]->null_bit_pos = 4 - table->field[3]->field_name d table->field[3]->offset = 31 table->field[3]->field_length = 10 table->field[3]->null_pos wrt to record 0 = 0 table->field[3]->null_bit_pos = 8 - table->field[4]->field_name DB_ROW_HASH_1 table->field[4]->offset = 41 table->field[4]->field_length = 8 table->field[4]->null_pos wrt to record 0 = 0 table->field[4]->null_bit_pos = 16 - table->field[5]->field_name DB_ROW_HASH_2 table->field[5]->offset = 49 table->field[5]->field_length = 8 table->field[5]->null_pos wrt to record 0 = 0 table->field[5]->null_bit_pos = 32 - SET debug_dbug=""; drop table t1; SET debug_dbug="d,print_long_unique_internal_state"; @@ -406,31 +392,26 @@ table->field[0]->offset = 1 table->field[0]->field_length = 4 table->field[0]->null_pos wrt to record 0 = -1 table->field[0]->null_bit_pos = 0 - table->field[1]->field_name b table->field[1]->offset = 5 table->field[1]->field_length = 10 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 1 - table->field[2]->field_name c table->field[2]->offset = 15 table->field[2]->field_length = 10 table->field[2]->null_pos wrt to record 0 = -1 table->field[2]->null_bit_pos = 0 - table->field[3]->field_name DB_ROW_HASH_1 table->field[3]->offset = 25 table->field[3]->field_length = 8 table->field[3]->null_pos wrt to record 0 = 0 table->field[3]->null_bit_pos = 2 - table->field[4]->field_name DB_ROW_HASH_2 table->field[4]->offset = 33 table->field[4]->field_length = 8 table->field[4]->null_pos wrt to record 0 = -1 table->field[4]->null_bit_pos = 0 - SET debug_dbug=""; drop table t1; ##Using hash @@ -487,25 +468,21 @@ table->field[0]->offset = 1 table->field[0]->field_length = 4 table->field[0]->null_pos wrt to record 0 = 0 table->field[0]->null_bit_pos = 2 - table->field[1]->field_name b table->field[1]->offset = 5 table->field[1]->field_length = 4 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 4 - table->field[2]->field_name c table->field[2]->offset = 9 table->field[2]->field_length = 4 table->field[2]->null_pos wrt to record 0 = 0 table->field[2]->null_bit_pos = 8 - table->field[3]->field_name DB_ROW_HASH_1 table->field[3]->offset = 13 table->field[3]->field_length = 8 table->field[3]->null_pos wrt to record 0 = 0 table->field[3]->null_bit_pos = 16 - SET debug_dbug=""; drop table t1; ##Using hash but with memory engine so no long unique column @@ -562,18 +539,15 @@ table->field[0]->offset = 1 table->field[0]->field_length = 4 table->field[0]->null_pos wrt to record 0 = 0 table->field[0]->null_bit_pos = 2 - table->field[1]->field_name b table->field[1]->offset = 5 table->field[1]->field_length = 4 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 4 - table->field[2]->field_name c table->field[2]->offset = 9 table->field[2]->field_length = 4 table->field[2]->null_pos wrt to record 0 = 0 table->field[2]->null_bit_pos = 8 - SET debug_dbug=""; drop table t1; diff --git a/mysql-test/main/memory_used.result b/mysql-test/main/memory_used.result new file mode 100644 index 00000000000..974be5a6e1e --- /dev/null +++ b/mysql-test/main/memory_used.result @@ -0,0 +1,8 @@ +select * from information_schema.processlist where id=0; +should be true +1 +should be true +1 +show global status like "max_memory_used"; +Variable_name Value +Max_memory_used NULL diff --git a/mysql-test/main/memory_used.test b/mysql-test/main/memory_used.test new file mode 100644 index 00000000000..0416f5114a5 --- /dev/null +++ b/mysql-test/main/memory_used.test @@ -0,0 +1,20 @@ +# +# Added status variable "Max_memory_used" to SHOW STATUS +# + +let $l1=`show status like "max_memory_used"`; +--disable_result_log +select * from information_schema.processlist where id=0; +--enable_result_log +let $l2=`show status like "max_memory_used"`; + +--disable_query_log +eval SET @l1= SUBSTRING_INDEX('$l1', ' ', -1); +eval SET @l2= SUBSTRING_INDEX('$l2', ' ', -1); +eval select @l1 > 10000 as "should be true"; +eval select @l2+0 > @l1+0 as "should be true"; + +--enable_query_log +# global max_memory should be NULL as we cannot calculate this +show global status like "max_memory_used"; + diff --git a/mysql-test/main/mysqld--help-aria.test b/mysql-test/main/mysqld--help-aria.test index 2bd332c1484..4f0da282040 100644 --- a/mysql-test/main/mysqld--help-aria.test +++ b/mysql-test/main/mysqld--help-aria.test @@ -6,7 +6,7 @@ flush tables; --let $args=--table-cache=5 --max-connections=10 --log-warnings=1 --silent-startup --lower-case-table-names=1 --help --verbose --exec $MYSQLD_CMD $args > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err ---replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // +--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // /^.*failed to retrieve the MAC address\n// --cat_file $MYSQL_TMP_DIR/mysqld--help2.err --echo # @@ -14,7 +14,7 @@ flush tables; --echo # --exec $MYSQLD_CMD $args --datadir=$MYSQL_TMP_DIR/help > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err ---replace_regex /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // +--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // /^.*failed to retrieve the MAC address\n// --cat_file $MYSQL_TMP_DIR/mysqld--help2.err --echo # @@ -23,7 +23,7 @@ flush tables; --mkdir $MYSQL_TMP_DIR/help --exec $MYSQLD_CMD $args --datadir=$MYSQL_TMP_DIR/help > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err ---replace_regex /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // +--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // /^.*failed to retrieve the MAC address\n// --cat_file $MYSQL_TMP_DIR/mysqld--help2.err --list_files $MYSQL_TMP_DIR/help diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 9a150398692..adc10ecd44e 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -1903,14 +1903,14 @@ profiling-history-size 15 progress-report-time 5 protocol-version 10 proxy-protocol-networks -query-alloc-block-size 16384 +query-alloc-block-size 32768 query-cache-limit 1048576 query-cache-min-res-unit 4096 query-cache-size 1048576 query-cache-strip-comments FALSE query-cache-type OFF query-cache-wlock-invalidate FALSE -query-prealloc-size 24576 +query-prealloc-size 32768 range-alloc-block-size 4096 read-binlog-speed-limit 0 read-buffer-size 131072 diff --git a/mysql-test/main/mysqldump-system,win.rdiff b/mysql-test/main/mysqldump-system,win.rdiff index 50c08438dcf..ce9d4c0d6be 100644 --- a/mysql-test/main/mysqldump-system,win.rdiff +++ b/mysql-test/main/mysqldump-system,win.rdiff @@ -6,7 +6,7 @@ mysql.time_zone_transition 3719776009 -mysql.plugin 1587119305 +mysql.plugin 2184891911 - mysql.servers 2079085450 + mysql.servers 2180549486 -mysql.func 3241572444 +mysql.func 310494789 mysql.innodb_table_stats 1285726777 @@ -18,7 +18,7 @@ mysql.time_zone_transition 3719776009 -mysql.plugin 1587119305 +mysql.plugin 2184891911 - mysql.servers 2079085450 + mysql.servers 2180549486 -mysql.func 3241572444 +mysql.func 310494789 mysql.innodb_table_stats 1285726777 diff --git a/mysql-test/main/mysqldump-system.result b/mysql-test/main/mysqldump-system.result index da690499ce6..9d71175a815 100644 --- a/mysql-test/main/mysqldump-system.result +++ b/mysql-test/main/mysqldump-system.result @@ -1865,7 +1865,7 @@ Table Checksum mysql.roles_mapping 2510045525 mysql.time_zone_transition 3719776009 mysql.plugin 1587119305 -mysql.servers 2079085450 +mysql.servers 2180549486 mysql.func 3241572444 mysql.innodb_table_stats 1285726777 mysql.table_stats 2836905944 @@ -1900,7 +1900,7 @@ Table Checksum mysql.roles_mapping 2510045525 mysql.time_zone_transition 3719776009 mysql.plugin 1587119305 -mysql.servers 2079085450 +mysql.servers 2180549486 mysql.func 3241572444 mysql.innodb_table_stats 1285726777 mysql.table_stats 2836905944 diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index 1ca535901f1..ba96d3c0974 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -4446,6 +4446,8 @@ CREATE TABLE t1(a VARCHAR(1027), b INT); INSERT INTO t1 SELECT seq, seq from seq_1_to_34; SET @save_tmp_memory_table_size= @@tmp_memory_table_size; SET tmp_memory_table_size= 1056*2; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '2112' SELECT COUNT(DISTINCT a) FROM t1; COUNT(DISTINCT a) 34 diff --git a/mysql-test/main/partition_innodb_plugin.test b/mysql-test/main/partition_innodb_plugin.test index c24945152b3..2699ca2ca1a 100644 --- a/mysql-test/main/partition_innodb_plugin.test +++ b/mysql-test/main/partition_innodb_plugin.test @@ -5,6 +5,9 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`; call mtr.add_suppression("InnoDB: Table .* does not exist in the InnoDB internal data dictionary .*"); call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log --echo # --echo # Bug#11766879/Bug#60106: DIFF BETWEEN # OF INDEXES IN MYSQL VS INNODB, diff --git a/mysql-test/main/ps_ddl.result b/mysql-test/main/ps_ddl.result index e4b9cd378de..00de5250bb7 100644 --- a/mysql-test/main/ps_ddl.result +++ b/mysql-test/main/ps_ddl.result @@ -2037,7 +2037,7 @@ SUCCESS execute stmt; Warnings: Note 1050 Table 't2' already exists -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); SUCCESS select * from t2; diff --git a/mysql-test/main/ps_ddl.test b/mysql-test/main/ps_ddl.test index e17539b3a7e..ba2b00363b8 100644 --- a/mysql-test/main/ps_ddl.test +++ b/mysql-test/main/ps_ddl.test @@ -1688,7 +1688,7 @@ drop table t2; execute stmt; call p_verify_reprepare_count(0); execute stmt; -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); select * from t2; execute stmt; call p_verify_reprepare_count(0); diff --git a/mysql-test/main/rowid_filter_innodb.test b/mysql-test/main/rowid_filter_innodb.test index 8fea721d2d0..0449104d5d7 100644 --- a/mysql-test/main/rowid_filter_innodb.test +++ b/mysql-test/main/rowid_filter_innodb.test @@ -4,6 +4,10 @@ --source include/have_sequence.inc --source include/innodb_stable_estimates.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent; diff --git a/mysql-test/main/secure_file_priv_win.test b/mysql-test/main/secure_file_priv_win.test index 40a7b4ea40d..bacc9fc2de1 100644 --- a/mysql-test/main/secure_file_priv_win.test +++ b/mysql-test/main/secure_file_priv_win.test @@ -13,10 +13,11 @@ LET $MYSQL_TMP_DIR_UCASE= `SELECT upper('$MYSQL_TMP_DIR')`; LET $MYSQL_TMP_DIR_LCASE= `SELECT lower('$MYSQL_TMP_DIR')`; --disable_ps2_protocol - +--disable_cursor_protocol #create the file --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR/B11764517.tmp' FROM t1; +--enable_cursor_protocol --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR show global variables like 'secure_file_priv'; @@ -52,6 +53,7 @@ eval LOAD DATA INFILE '$MYSQL_TMP_DIR_LCASE/B11764517.tmp' INTO TABLE t1; --error ER_OPTION_PREVENTS_STATEMENT eval LOAD DATA INFILE "$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp" into table t1; +--disable_cursor_protocol --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR --error ER_OPTION_PREVENTS_STATEMENT eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517-2.tmp' FROM t1; @@ -67,6 +69,7 @@ eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR_UCASE/B11764517-4.tmp' FROM t1; --replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR_LCASE/B11764517-5.tmp' FROM t1; +--enable_cursor_protocol --error 0,1 --remove_file $MYSQL_TMP_DIR/B11764517.tmp; diff --git a/mysql-test/main/select,ps.rdiff b/mysql-test/main/select,ps.rdiff index 7cbcd2be98e..61d6867c1dc 100644 --- a/mysql-test/main/select,ps.rdiff +++ b/mysql-test/main/select,ps.rdiff @@ -1,5 +1,5 @@ ---- mysql-test/main/select.result 2023-01-31 09:30:58.151377805 +0100 -+++ mysql-test/main/select.reject 2023-02-01 13:44:11.026958614 +0100 +--- mysql-test/main/select.result ++++ mysql-test/main/select.reject @@ -5661,6 +5661,8 @@ Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 diff --git a/mysql-test/main/select_jcl6,ps.rdiff b/mysql-test/main/select_jcl6,ps.rdiff index 18652a0683b..fc59dd211f9 100644 --- a/mysql-test/main/select_jcl6,ps.rdiff +++ b/mysql-test/main/select_jcl6,ps.rdiff @@ -1,5 +1,5 @@ ---- mysql-test/main/select_jcl6.result 2023-01-31 09:30:58.151377805 +0100 -+++ mysql-test/main/select_jcl6.reject 2023-02-01 13:44:10.722958771 +0100 +--- mysql-test/main/select_jcl6.result ++++ mysql-test/main/select_jcl6.reject @@ -5672,6 +5672,8 @@ Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 diff --git a/mysql-test/main/select_pkeycache,ps.rdiff b/mysql-test/main/select_pkeycache,ps.rdiff index 320a402fefc..dc9c30408a9 100644 --- a/mysql-test/main/select_pkeycache,ps.rdiff +++ b/mysql-test/main/select_pkeycache,ps.rdiff @@ -1,5 +1,5 @@ ---- mysql-test/main/select_pkeycache.result 2023-01-31 09:30:58.151377805 +0100 -+++ mysql-test/main/select_pkeycache.reject 2023-02-01 13:43:21.742985365 +0100 +--- mysql-test/main/select_pkeycache.result ++++ mysql-test/main/select_pkeycache.reject @@ -5661,6 +5661,8 @@ Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 diff --git a/mysql-test/main/servers.result b/mysql-test/main/servers.result index c466967a0db..d660aff1bd2 100644 --- a/mysql-test/main/servers.result +++ b/mysql-test/main/servers.result @@ -24,6 +24,11 @@ SELECT * FROM mysql.servers; Server_name Host Db Username Password Port Socket Wrapper Owner s1 3306 bar mysql DROP SERVER s1; +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET '/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock'); +SELECT Socket FROM mysql.servers where Server_name = 's1'; +Socket +/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock +DROP SERVER s1; # # MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers # diff --git a/mysql-test/main/servers.test b/mysql-test/main/servers.test index 6aaaa356c1d..1a58d5849f8 100644 --- a/mysql-test/main/servers.test +++ b/mysql-test/main/servers.test @@ -23,6 +23,10 @@ CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET 'bar'); SELECT * FROM mysql.servers; DROP SERVER s1; +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET '/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock'); +SELECT Socket FROM mysql.servers where Server_name = 's1'; +DROP SERVER s1; + --echo # --echo # MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers --echo # diff --git a/mysql-test/main/set_operation.result b/mysql-test/main/set_operation.result index f01b68357a2..248bc878cac 100644 --- a/mysql-test/main/set_operation.result +++ b/mysql-test/main/set_operation.result @@ -1177,10 +1177,8 @@ select 1 union all select 2 union all select 3 union select 4; 3 4 # test with limited resource -set @@max_heap_table_size= 1024; -Warnings: -Warning 1292 Truncated incorrect max_heap_table_size value: '1024' -set @@tmp_table_size= 1024; +set @@max_heap_table_size= 16384; +set @@tmp_table_size= 16384; create table t1 (a int, b int); insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(0,0); insert into t1 select * from t1; diff --git a/mysql-test/main/set_operation.test b/mysql-test/main/set_operation.test index e9f71a7e448..9d4583a4bca 100644 --- a/mysql-test/main/set_operation.test +++ b/mysql-test/main/set_operation.test @@ -458,8 +458,8 @@ select 1 union all select 2 union all select 3 union select 4; --echo # test with limited resource -set @@max_heap_table_size= 1024; -set @@tmp_table_size= 1024; +set @@max_heap_table_size= 16384; +set @@tmp_table_size= 16384; create table t1 (a int, b int); insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(0,0); diff --git a/mysql-test/main/ssl_cipher.result b/mysql-test/main/ssl_cipher.result index d549ec7d2b4..c6a6a0d94d5 100644 --- a/mysql-test/main/ssl_cipher.result +++ b/mysql-test/main/ssl_cipher.result @@ -68,3 +68,6 @@ disconnect ssl_con; connection default; call mtr.add_suppression("TLSv1.0 and TLSv1.1 are insecure"); FOUND 2 /TLSv1.0 and TLSv1.1 are insecure/ in mysqld.1.err +# restart: --ssl-cipher=ECDHE-ECDSA-AES128-GCM-SHA256 +Variable_name Value +Ssl_version diff --git a/mysql-test/main/ssl_cipher.test b/mysql-test/main/ssl_cipher.test index 0d33ec5d5e0..62e9a90d915 100644 --- a/mysql-test/main/ssl_cipher.test +++ b/mysql-test/main/ssl_cipher.test @@ -112,3 +112,20 @@ call mtr.add_suppression("TLSv1.0 and TLSv1.1 are insecure"); --let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err --let SEARCH_PATTERN= TLSv1.0 and TLSv1.1 are insecure --source include/search_pattern_in_file.inc + +# +# Server is configured with ciphers that are not compatible with the server certificate (std_data/cacert.pem is RSA) +# +let $restart_parameters=--ssl-cipher=ECDHE-ECDSA-AES128-GCM-SHA256; +source include/restart_mysqld.inc; + +# Connections are rejected as client attempts tls by default +--error 1 +--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'ssl_version'" + +# Connections are rejected if client explicitly specifies tls +--error 1 +--exec $MYSQL --host=localhost --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-verify-server-cert -e "SHOW STATUS LIKE 'ssl_version'" + +# Connections can be made with --skip-ssl +--exec $MYSQL --host=localhost --skip-ssl -e "SHOW STATUS LIKE 'ssl_version'" diff --git a/mysql-test/main/system_mysql_db.result b/mysql-test/main/system_mysql_db.result index fb54069ba97..b1d43d5f546 100644 --- a/mysql-test/main/system_mysql_db.result +++ b/mysql-test/main/system_mysql_db.result @@ -130,7 +130,7 @@ servers CREATE TABLE `servers` ( `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix40123.result b/mysql-test/main/system_mysql_db_fix40123.result index 9688038c492..3635945e1c5 100644 --- a/mysql-test/main/system_mysql_db_fix40123.result +++ b/mysql-test/main/system_mysql_db_fix40123.result @@ -168,7 +168,7 @@ servers CREATE TABLE `servers` ( `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix50030.result b/mysql-test/main/system_mysql_db_fix50030.result index ea2ea1c1044..32cfc761465 100644 --- a/mysql-test/main/system_mysql_db_fix50030.result +++ b/mysql-test/main/system_mysql_db_fix50030.result @@ -172,7 +172,7 @@ servers CREATE TABLE `servers` ( `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix50117.result b/mysql-test/main/system_mysql_db_fix50117.result index 7c85ca98253..25b58061ef0 100644 --- a/mysql-test/main/system_mysql_db_fix50117.result +++ b/mysql-test/main/system_mysql_db_fix50117.result @@ -152,7 +152,7 @@ servers CREATE TABLE `servers` ( `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix50568.result b/mysql-test/main/system_mysql_db_fix50568.result index 2dad3c47e75..9638564fd47 100644 --- a/mysql-test/main/system_mysql_db_fix50568.result +++ b/mysql-test/main/system_mysql_db_fix50568.result @@ -173,7 +173,7 @@ servers CREATE TABLE `servers` ( `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result index 014cdb37c31..66b3dd5f809 100644 --- a/mysql-test/main/union.result +++ b/mysql-test/main/union.result @@ -874,7 +874,7 @@ insert into t1 select * from t2; insert into t2 select * from t1; insert into t1 select * from t2; insert into t2 select * from t1; -set local tmp_table_size=1024; +set local tmp_table_size=16384; select count(*) from (select * from t1 union all select * from t2 order by 1) b; count(*) 21 diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test index 39125ee8927..c3951bfeebf 100644 --- a/mysql-test/main/union.test +++ b/mysql-test/main/union.test @@ -505,7 +505,7 @@ insert into t1 select * from t2; insert into t2 select * from t1; insert into t1 select * from t2; insert into t2 select * from t1; -set local tmp_table_size=1024; +set local tmp_table_size=16384; select count(*) from (select * from t1 union all select * from t2 order by 1) b; select count(*) from t1; select count(*) from t2; diff --git a/mysql-test/main/update.result b/mysql-test/main/update.result index 575dd5e3ea0..de0ebdb6f9a 100644 --- a/mysql-test/main/update.result +++ b/mysql-test/main/update.result @@ -491,7 +491,9 @@ a quux DROP TABLE t1; connect con1,localhost,root,,test; connection con1; -set tmp_table_size=1024; +set tmp_table_size=2048; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '2048' create table t1 (id int, a int, key idx(a)); create table t2 (id int unsigned not null auto_increment primary key, a int); insert into t2(a) values(1),(2),(3),(4),(5),(6),(7),(8); diff --git a/mysql-test/main/update.test b/mysql-test/main/update.test index 69477be32db..0bf41b687f7 100644 --- a/mysql-test/main/update.test +++ b/mysql-test/main/update.test @@ -397,7 +397,7 @@ DROP TABLE t1; connect (con1,localhost,root,,test); connection con1; -set tmp_table_size=1024; +set tmp_table_size=2048; # Create the test tables create table t1 (id int, a int, key idx(a)); diff --git a/mysql-test/main/variables.result b/mysql-test/main/variables.result index 97739d244a0..aa7b7055378 100644 --- a/mysql-test/main/variables.result +++ b/mysql-test/main/variables.result @@ -299,8 +299,8 @@ SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size', 'query_alloc_block_size', 'query_prealloc_size', 'transaction_alloc_block_size', 'transaction_prealloc_size'); Variable_name Value -query_alloc_block_size 16384 -query_prealloc_size 24576 +query_alloc_block_size 32768 +query_prealloc_size 32768 range_alloc_block_size 4096 transaction_alloc_block_size 8192 transaction_prealloc_size 4096 @@ -310,8 +310,8 @@ WHERE variable_name IN ('range_alloc_block_size', 'query_alloc_block_size', 'query_prealloc_size', 'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1; VARIABLE_NAME VARIABLE_VALUE -QUERY_ALLOC_BLOCK_SIZE 16384 -QUERY_PREALLOC_SIZE 24576 +QUERY_ALLOC_BLOCK_SIZE 32768 +QUERY_PREALLOC_SIZE 32768 RANGE_ALLOC_BLOCK_SIZE 4096 TRANSACTION_ALLOC_BLOCK_SIZE 8192 TRANSACTION_PREALLOC_SIZE 4096 @@ -392,8 +392,8 @@ SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size', 'query_alloc_block_size', 'query_prealloc_size', 'transaction_alloc_block_size', 'transaction_prealloc_size'); Variable_name Value -query_alloc_block_size 16384 -query_prealloc_size 24576 +query_alloc_block_size 32768 +query_prealloc_size 32768 range_alloc_block_size 4096 transaction_alloc_block_size 8192 transaction_prealloc_size 4096 @@ -547,7 +547,7 @@ set global table_open_cache=100; set default_storage_engine=myisam; set global thread_cache_size=100; set timestamp=1, timestamp=default; -set tmp_table_size=1024; +set tmp_table_size=16384; set transaction_isolation="READ-COMMITTED"; set wait_timeout=100; set log_warnings=1; diff --git a/mysql-test/main/variables.test b/mysql-test/main/variables.test index 0f6046c2e3f..e5615228211 100644 --- a/mysql-test/main/variables.test +++ b/mysql-test/main/variables.test @@ -340,7 +340,7 @@ set global table_open_cache=100; set default_storage_engine=myisam; set global thread_cache_size=100; set timestamp=1, timestamp=default; -set tmp_table_size=1024; +set tmp_table_size=16384; set transaction_isolation="READ-COMMITTED"; set wait_timeout=100; set log_warnings=1; diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index 6071f1f38b4..ece54a3dae1 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -1510,8 +1510,6 @@ execute stmt1 using @a; set @a= 301; execute stmt1 using @a; deallocate prepare stmt1; -insert into v3(a) select sum(302); -insert into v3(a) select sum(303) over (); select * from v3; a b 100 0 @@ -1530,14 +1528,6 @@ a b 301 10 301 1000 301 2000 -302 0 -302 10 -302 1000 -302 2000 -303 0 -303 10 -303 1000 -303 2000 drop view v3; drop tables t1,t2; create table t1(f1 int); diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index 0ac7bfdbc9f..c471b775192 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -1337,8 +1337,6 @@ execute stmt1 using @a; set @a= 301; execute stmt1 using @a; deallocate prepare stmt1; -insert into v3(a) select sum(302); -insert into v3(a) select sum(303) over (); --sorted_result select * from v3; diff --git a/mysql-test/main/xa.test b/mysql-test/main/xa.test index 77df6831355..a4c60ef316d 100644 --- a/mysql-test/main/xa.test +++ b/mysql-test/main/xa.test @@ -2,13 +2,16 @@ # WL#1756 # -- source include/have_innodb.inc - --source include/not_embedded.inc # Save the initial number of concurrent sessions --source include/count_sessions.inc call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --disable_warnings drop table if exists t1, t2; diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl index 81a27b03f9a..e84c4855e35 100755 --- a/mysql-test/mariadb-test-run.pl +++ b/mysql-test/mariadb-test-run.pl @@ -4537,7 +4537,7 @@ sub extract_warning_lines ($$) { qr|InnoDB: liburing disabled|, qr/InnoDB: Failed to set O_DIRECT on file/, qr|setrlimit could not change the size of core files to 'infinity';|, - qr|feedback plugin: failed to retrieve the MAC address|, + qr|failed to retrieve the MAC address|, qr|Plugin 'FEEDBACK' init function returned error|, qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|, qr|'log-bin-use-v1-row-events' is MySQL .* compatible option|, diff --git a/mysql-test/std_data/mdev35643_mysql_80_binlog.000001 b/mysql-test/std_data/mdev35643_mysql_80_binlog.000001 new file mode 100644 index 00000000000..2953c2a277c Binary files /dev/null and b/mysql-test/std_data/mdev35643_mysql_80_binlog.000001 differ diff --git a/mysql-test/suite/binlog/r/binlog_max_extension.result b/mysql-test/suite/binlog/r/binlog_max_extension.result index f69ffcce16a..f353b071589 100644 --- a/mysql-test/suite/binlog/r/binlog_max_extension.result +++ b/mysql-test/suite/binlog/r/binlog_max_extension.result @@ -4,4 +4,3 @@ call mtr.add_suppression("Can't generate a unique log-filename"); RESET MASTER; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - diff --git a/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result b/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result index 88ed236a528..bd3d699a74a 100644 --- a/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result +++ b/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result @@ -16,7 +16,6 @@ master-bin.2147483647 # Gtid # # GTID #-#-# master-bin.2147483647 # Query # # CREATE DATABASE db1 RESET MASTER TO 2147483648; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - FOUND 1 /Turning logging off for the whole duration of the MariaDB server process/ in mysqld.1.err "Following CREATE DATABSE db2 command will not be present in binary log" "as binary log got closed due to ER_NO_UNIQUE_LOGFILE error." diff --git a/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result b/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result index c2e634ebe82..014019a3294 100644 --- a/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result +++ b/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result @@ -11,5 +11,4 @@ UPDATE t1 SET c1=repeat('b',255); INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255)); SHOW BINLOG EVENTS FROM POS; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Invalid pos specified. Requested from pos:POS is greater than actual file size:MAX_POS - DROP TABLE t1; diff --git a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result index 0c79b079bd6..442b2a5da1d 100644 --- a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result +++ b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result @@ -26,7 +26,6 @@ RESET MASTER; SET @@global.debug_dbug="d,error_unique_log_filename"; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show one binlog show binary logs; Log_name File_size @@ -52,7 +51,6 @@ RESET MASTER; SET @@global.debug_dbug="d,error_unique_log_filename"; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show one entry SELECT count(*) FROM t2; count(*) @@ -78,7 +76,6 @@ LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; INSERT INTO t2 VALUES ('muse'); COMMIT; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show three entries SELECT count(*) FROM t2; count(*) @@ -95,7 +92,6 @@ count(*) 0 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show 1 entry SELECT count(*) FROM t4; count(*) @@ -118,13 +114,10 @@ count(*) 0 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # INFO: Count(*) Before Offending DELETEs # assert: must show 1 entry SELECT count(*) FROM t4; @@ -136,10 +129,8 @@ count(*) 4 DELETE FROM t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - DELETE FROM t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # INFO: Count(*) After Offending DELETEs # assert: must show zero entries SELECT count(*) FROM t4; diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum.result b/mysql-test/suite/binlog_encryption/rpl_checksum.result index 0b894e05a46..503f359f726 100644 --- a/mysql-test/suite/binlog_encryption/rpl_checksum.result +++ b/mysql-test/suite/binlog_encryption/rpl_checksum.result @@ -178,7 +178,6 @@ SET @old_dbug= @@GLOBAL.debug_dbug; SET debug_dbug= '+d,binlog_inject_new_name_error'; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - SET debug_dbug= @old_dbug; INSERT INTO t4 VALUES (2); connection slave; diff --git a/mysql-test/suite/encryption/r/debug_key_management.result b/mysql-test/suite/encryption/r/debug_key_management.result index 7fe681d52ae..394477969ad 100644 --- a/mysql-test/suite/encryption/r/debug_key_management.result +++ b/mysql-test/suite/encryption/r/debug_key_management.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[0-9]*\\] in file"); create table t1(a serial) engine=innoDB; set global innodb_encrypt_tables=ON; show variables like 'innodb_encrypt%'; diff --git a/mysql-test/suite/encryption/r/doublewrite_debug.result b/mysql-test/suite/encryption/r/doublewrite_debug.result new file mode 100644 index 00000000000..b289df9f77d --- /dev/null +++ b/mysql-test/suite/encryption/r/doublewrite_debug.result @@ -0,0 +1,81 @@ +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[12]\\.ibd looks corrupted"); +call mtr.add_suppression("InnoDB: Unable to apply log to corrupted page "); +call mtr.add_suppression("InnoDB: Plugin initialization aborted"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); +create table t1 (f1 int primary key, f2 blob)page_compressed = 1 engine=innodb stats_persistent=0; +create table t2(f1 int primary key, f2 blob)engine=innodb stats_persistent=0; +start transaction; +insert into t1 values(1, repeat('#',12)); +insert into t1 values(2, repeat('+',12)); +insert into t1 values(3, repeat('/',12)); +insert into t1 values(4, repeat('-',12)); +insert into t1 values(5, repeat('.',12)); +insert into t2 select * from t1; +commit work; +SET GLOBAL innodb_fast_shutdown = 0; +# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0 +select space into @t1_space_id from information_schema.innodb_sys_tablespaces where name='test/t1'; +select space into @t2_space_id from information_schema.innodb_sys_tablespaces where name='test/t2'; +begin; +insert into t1 values (6, repeat('%', 400)); +insert into t2 values (6, repeat('%', 400)); +# xtrabackup prepare +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t1_space_id; +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t2_space_id; +set global innodb_buf_flush_list_now = 1; +# Kill the server +# restart +FOUND 2 /InnoDB: Recovered page \[page id: space=[1-9]*, page number=3\]/ in mysqld.1.err +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +check table t2; +Table Op Msg_type Msg_text +test.t2 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +select f1, f2 from t2; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +SET GLOBAL innodb_fast_shutdown = 0; +# shutdown server +# remove datadir +# xtrabackup move back +# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0 +select space into @t1_space_id from information_schema.innodb_sys_tablespaces where name='test/t1'; +begin; +insert into t1 values (6, repeat('%', 400)); +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t1_space_id; +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the page 3 in t1.ibd file +# Assign the maximum value to lsn in doublewrite buffer page +# restart +FOUND 1 /InnoDB: Encrypted page \[page id: space=[1-9]*, page number=3\] in file .*test.t1.ibd looks corrupted/ in mysqld.1.err +select * from t1; +ERROR 42000: Unknown storage engine 'InnoDB' +# shutdown server +# remove datadir +# xtrabackup move back +# restart +select * from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +drop table t2, t1; diff --git a/mysql-test/suite/encryption/r/encrypt_and_grep,undo3.rdiff b/mysql-test/suite/encryption/r/encrypt_and_grep,undo3.rdiff index 210c2a61a17..ad81aacaf59 100644 --- a/mysql-test/suite/encryption/r/encrypt_and_grep,undo3.rdiff +++ b/mysql-test/suite/encryption/r/encrypt_and_grep,undo3.rdiff @@ -1,5 +1,5 @@ ---- encrypt_and_grep.result 2022-09-02 22:36:21.669650278 +0530 -+++ encrypt_and_grep.reject 2022-11-29 19:01:22.080027528 +0530 +--- encrypt_and_grep.result ++++ encrypt_and_grep.reject @@ -14,6 +14,9 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; NAME diff --git a/mysql-test/suite/encryption/r/innodb-remove-encryption,undo3.rdiff b/mysql-test/suite/encryption/r/innodb-remove-encryption,undo3.rdiff index 421c962bd2e..5d26dd20ac8 100644 --- a/mysql-test/suite/encryption/r/innodb-remove-encryption,undo3.rdiff +++ b/mysql-test/suite/encryption/r/innodb-remove-encryption,undo3.rdiff @@ -1,5 +1,5 @@ ---- innodb-remove-encryption.result 2022-09-02 20:44:59.960430396 +0530 -+++ innodb-remove-encryption,undo3.reject 2022-11-29 19:02:24.813094277 +0530 +--- innodb-remove-encryption.result ++++ innodb-remove-encryption,undo3.reject @@ -13,6 +13,9 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; NAME diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_freed,undo3.rdiff b/mysql-test/suite/encryption/r/innodb_encrypt_freed,undo3.rdiff index 36eea901a6e..721a847acb8 100644 --- a/mysql-test/suite/encryption/r/innodb_encrypt_freed,undo3.rdiff +++ b/mysql-test/suite/encryption/r/innodb_encrypt_freed,undo3.rdiff @@ -1,5 +1,5 @@ ---- innodb_encrypt_freed.result 2021-03-23 15:44:14.466377983 +0530 -+++ innodb_encrypt_freed,undo3.reject 2022-11-29 19:04:24.987010571 +0530 +--- innodb_encrypt_freed.result ++++ innodb_encrypt_freed,undo3.reject @@ -14,6 +14,9 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; NAME diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_key_rotation_age,undo3.rdiff b/mysql-test/suite/encryption/r/innodb_encrypt_key_rotation_age,undo3.rdiff index 476b0b3f213..830155acab6 100644 --- a/mysql-test/suite/encryption/r/innodb_encrypt_key_rotation_age,undo3.rdiff +++ b/mysql-test/suite/encryption/r/innodb_encrypt_key_rotation_age,undo3.rdiff @@ -1,5 +1,5 @@ ---- innodb_encrypt_key_rotation_age.result 2022-06-02 16:15:08.395122720 +0530 -+++ innodb_encrypt_key_rotation_age,undo3.reject 2022-11-29 19:06:07.964542115 +0530 +--- innodb_encrypt_key_rotation_age.result ++++ innodb_encrypt_key_rotation_age,undo3.reject @@ -12,6 +12,9 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; NAME diff --git a/mysql-test/suite/encryption/t/debug_key_management.test b/mysql-test/suite/encryption/t/debug_key_management.test index 45a93040d73..9638391e690 100644 --- a/mysql-test/suite/encryption/t/debug_key_management.test +++ b/mysql-test/suite/encryption/t/debug_key_management.test @@ -3,6 +3,7 @@ -- source include/innodb_undo_tablespaces.inc -- source include/not_embedded.inc +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[0-9]*\\] in file"); if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'debug_key_management' and plugin_status='active'`) { diff --git a/mysql-test/suite/encryption/t/doublewrite_debug.opt b/mysql-test/suite/encryption/t/doublewrite_debug.opt new file mode 100644 index 00000000000..ed86654270b --- /dev/null +++ b/mysql-test/suite/encryption/t/doublewrite_debug.opt @@ -0,0 +1,3 @@ +--innodb-use-atomic-writes=0 +--innodb-encrypt-tables=FORCE +--innodb_sys_tablespaces diff --git a/mysql-test/suite/encryption/t/doublewrite_debug.test b/mysql-test/suite/encryption/t/doublewrite_debug.test new file mode 100644 index 00000000000..4dc6032c902 --- /dev/null +++ b/mysql-test/suite/encryption/t/doublewrite_debug.test @@ -0,0 +1,223 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/not_embedded.inc +--source include/have_example_key_management_plugin.inc +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[12]\\.ibd looks corrupted"); +call mtr.add_suppression("InnoDB: Unable to apply log to corrupted page "); +call mtr.add_suppression("InnoDB: Plugin initialization aborted"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); + +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +let MYSQLD_DATADIR=`select @@datadir`; +let ALGO=`select @@innodb_checksum_algorithm`; + +create table t1 (f1 int primary key, f2 blob)page_compressed = 1 engine=innodb stats_persistent=0; +create table t2(f1 int primary key, f2 blob)engine=innodb stats_persistent=0; + +start transaction; +insert into t1 values(1, repeat('#',12)); +insert into t1 values(2, repeat('+',12)); +insert into t1 values(3, repeat('/',12)); +insert into t1 values(4, repeat('-',12)); +insert into t1 values(5, repeat('.',12)); +insert into t2 select * from t1; +commit work; + +# Slow shutdown and restart to make sure ibuf merge is finished +SET GLOBAL innodb_fast_shutdown = 0; +let $shutdown_timeout=; +let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0; +--source include/restart_mysqld.inc +--source ../../suite/innodb/include/no_checkpoint_start.inc + +select space into @t1_space_id from information_schema.innodb_sys_tablespaces where name='test/t1'; +select space into @t2_space_id from information_schema.innodb_sys_tablespaces where name='test/t2'; + +begin; +insert into t1 values (6, repeat('%', 400)); +insert into t2 values (6, repeat('%', 400)); + +# Copy the t1.ibd, t2.ibd file +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup_1; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir; + +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t1_space_id; + +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t2_space_id; + +set global innodb_buf_flush_list_now = 1; +--let CLEANUP_IF_CHECKPOINT=drop table t1, t2, unexpected_checkpoint; +--source ../../suite/innodb/include/no_checkpoint_end.inc +# Corrupt the page 3 in t1.ibd, t2.ibd file +perl; +use IO::Handle; +do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; +my $polynomial = 0x82f63b78; # CRC-32C +my $algo = $ENV{ALGO}; +die "Unsupported innodb_checksum_algorithm=$algo\n" unless $algo =~ /crc32/; + +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +my $page_size = $ENV{INNODB_PAGE_SIZE}; +my $page; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; +open(FILE, "+<", $fname) or die; +sysseek(FILE, 3*$page_size, 0); +sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n"; +sysseek(FILE, 3*$page_size, 0)||die "Unable to seek $fname\n"; +my $corrupted = $page; +# Set FIL_PAGE_LSN to the maximum +substr($corrupted, 16, 8) = chr(255) x 8; +substr($corrupted, $page_size - 8, 8) = chr(255) x 8; +if ($algo =~ /full_crc32/) +{ + my $ck = mycrc32(substr($corrupted, 0, $page_size - 4), 0, $polynomial); + substr($corrupted, $page_size - 4, 4) = pack("N", $ck); +} +else +{ + # Replace the innodb_checksum_algorithm=crc32 checksum + my $ck= pack("N", + mycrc32(substr($corrupted, 4, 22), 0, $polynomial) ^ + mycrc32(substr($corrupted_, 38, $page_size - 38 - 8), 0, + $polynomial)); + substr ($corrupted, 0, 4) = $ck; + substr ($corrupted, $page_size - 8, 4) = $ck; +} +syswrite(FILE, $corrupted); +close FILE; + +# Zero the complete page +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t2.ibd"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +sysseek(FILE, 3*$page_size, 0); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); +close FILE; +EOF + +# Successful recover from doublewrite buffer +let $restart_parameters=; +--source include/start_mysqld.inc +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=[1-9]*, page number=3\\]; +--source include/search_pattern_in_file.inc + +check table t1; +check table t2; +select f1, f2 from t1; +select f1, f2 from t2; + +SET GLOBAL innodb_fast_shutdown = 0; +let $shutdown_timeout=; +let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0; +--source ../../mariabackup/include/restart_and_restore.inc +--source ../../suite/innodb/include/no_checkpoint_start.inc +select space into @t1_space_id from information_schema.innodb_sys_tablespaces where name='test/t1'; + +begin; +insert into t1 values (6, repeat('%', 400)); + +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t1_space_id; + +set global innodb_buf_flush_list_now = 1; +--let CLEANUP_IF_CHECKPOINT=drop table t1, unexpected_checkpoint; +--source ../../suite/innodb/include/no_checkpoint_end.inc + +--echo # Corrupt the page 3 in t1.ibd file +--echo # Assign the maximum value to lsn in doublewrite buffer page +perl; +use IO::Handle; +do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; +my $polynomial = 0x82f63b78; # CRC-32C +my $algo = $ENV{ALGO}; +die "Unsupported innodb_checksum_algorithm=$algo\n" unless $algo =~ /crc32/; + +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +my $page_size = $ENV{INNODB_PAGE_SIZE}; +my $page; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; +open(FILE, "+<", $fname) or die; +sysseek(FILE, 3*$page_size, 0); +sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n"; +sysseek(FILE, 3*$page_size, 0)||die "Unable to seek $fname\n"; +my $corrupted = $page; +# Set FIL_PAGE_LSN to the maximum +substr($corrupted, 16, 8) = chr(255) x 8; +substr($corrupted, $page_size - 8, 8) = chr(255) x 8; +if ($algo =~ /full_crc32/) +{ + my $ck = mycrc32(substr($corrupted, 0, $page_size - 4), 0, $polynomial); + substr($corrupted, $page_size - 4, 4) = pack("N", $ck); +} +else +{ + # Replace the innodb_checksum_algorithm=crc32 checksum + my $ck= pack("N", + mycrc32(substr($corrupted, 4, 22), 0, $polynomial) ^ + mycrc32(substr($corrupted_, 38, $page_size - 38 - 8), 0, + $polynomial)); + substr ($corrupted, 0, 4) = $ck; + substr ($corrupted, $page_size - 8, 4) = $ck; +} +syswrite(FILE, $corrupted); +close FILE; + +# Change the page lsn to maximum value +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}ibdata1")||die "cannot open ibdata1\n"; +sysseek(FILE, 6 * $page_size - 190, 0)||die "Unable to seek ibdata1\n"; +sysread(FILE, $_, 12) == 12||die "Unable to read TRX_SYS\n"; +my($magic,$d1,$d2)=unpack "NNN", $_; +die "magic=$magic, $d1, $d2\n" unless $magic == 536853855 && $d2 >= $d1 + 64; +sysseek(FILE, $d1 * $page_size, 0)||die "Unable to seek ibdata1\n"; +# Find the page in the doublewrite buffer +for (my $d = $d1; $d < $d2 + 64; $d++) +{ + sysread(FILE, $_, $page_size)==$page_size||die "Cannot read doublewrite\n"; + next unless $_ eq $page; + sysseek(FILE, $d * $page_size, 0)||die "Unable to seek ibdata1\n"; + substr($_, 16, 8) = chr(255) x 8; + if ($algo =~ /full_crc32/) + { + my $ck = mycrc32(substr($_, 0, $page_size - 4), 0, $polynomial); + substr($_, $page_size - 4, 4) = pack("N", $ck); + } + else + { + # Replace the innodb_checksum_algorithm=crc32 checksum + my $ck= pack("N", + mycrc32(substr($_, 4, 22), 0, $polynomial) ^ + mycrc32(substr($_, 38, $page_size - 38 - 8), 0, + $polynomial)); + substr ($_, 0, 4) = $ck; + substr ($_, $page_size - 8, 4) = $ck; + } + syswrite(FILE, $_, $page_size)==$page_size||die; + close(FILE); + exit 0; +} +die "Did not find the page in the doublewrite buffer ($d1,$d2)\n"; +EOF + +let $restart_parameters=; +--source include/start_mysqld.inc +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_PATTERN=InnoDB: Encrypted page \\[page id: space=[1-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; +--source include/search_pattern_in_file.inc + +--error ER_UNKNOWN_STORAGE_ENGINE +select * from t1; + +--source ../../mariabackup/include/restart_and_restore.inc +select * from t1; +drop table t2, t1; diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index dc6f7f7fef3..a025cb1098b 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -57,6 +57,7 @@ def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 24 NULL NO bigint def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 16 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL NO NO def information_schema COLLATIONS CHARACTER_SET_NAME 2 NULL YES varchar 32 96 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(32) NEVER NULL NO NO def information_schema COLLATIONS COLLATION_NAME 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL NO NO +def information_schema COLLATIONS COMMENT 7 NULL NO varchar 80 240 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(80) NEVER NULL NO NO def information_schema COLLATIONS ID 3 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(11) NEVER NULL NO NO def information_schema COLLATIONS IS_COMPILED 5 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL NO NO def information_schema COLLATIONS IS_DEFAULT 4 NULL YES varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL NO NO @@ -641,6 +642,7 @@ NULL information_schema COLLATIONS ID bigint NULL NULL NULL NULL bigint(11) 3.0000 information_schema COLLATIONS IS_DEFAULT varchar 3 9 utf8mb3 utf8mb3_general_ci varchar(3) 3.0000 information_schema COLLATIONS IS_COMPILED varchar 3 9 utf8mb3 utf8mb3_general_ci varchar(3) NULL information_schema COLLATIONS SORTLEN bigint NULL NULL NULL NULL bigint(3) +3.0000 information_schema COLLATIONS COMMENT varchar 80 240 utf8mb3 utf8mb3_general_ci varchar(80) 3.0000 information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) 3.0000 information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME varchar 32 96 utf8mb3 utf8mb3_general_ci varchar(32) 3.0000 information_schema COLLATION_CHARACTER_SET_APPLICABILITY FULL_COLLATION_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 4cc89240f53..d210b6606c5 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -164,7 +164,7 @@ def mysql servers Owner 9 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_ def mysql servers Password 5 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) select,insert,update,references NEVER NULL NO NO def mysql servers Port 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(4) select,insert,update,references NEVER NULL NO NO def mysql servers Server_name 1 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) PRI select,insert,update,references NEVER NULL NO NO -def mysql servers Socket 7 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) select,insert,update,references NEVER NULL NO NO +def mysql servers Socket 7 '' NO char 108 324 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(108) select,insert,update,references NEVER NULL NO NO def mysql servers Username 4 '' NO char 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(128) select,insert,update,references NEVER NULL NO NO def mysql servers Wrapper 8 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) select,insert,update,references NEVER NULL NO NO def mysql slow_log db 7 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select,insert,update,references NEVER NULL NO NO @@ -492,7 +492,7 @@ NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp 3.0000 mysql servers Username char 128 384 utf8mb3 utf8mb3_general_ci char(128) 3.0000 mysql servers Password char 64 192 utf8mb3 utf8mb3_general_ci char(64) NULL mysql servers Port int NULL NULL NULL NULL int(4) -3.0000 mysql servers Socket char 64 192 utf8mb3 utf8mb3_general_ci char(64) +3.0000 mysql servers Socket char 108 324 utf8mb3 utf8mb3_general_ci char(108) 3.0000 mysql servers Wrapper char 64 192 utf8mb3 utf8mb3_general_ci char(64) 3.0000 mysql servers Owner varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512) NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index 3dd780730f9..4eaf6a1eb3c 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -150,7 +150,7 @@ def mysql servers Owner 9 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_ def mysql servers Password 5 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) NEVER NULL NO NO def mysql servers Port 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(4) NEVER NULL NO NO def mysql servers Server_name 1 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) PRI NEVER NULL NO NO -def mysql servers Socket 7 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) NEVER NULL NO NO +def mysql servers Socket 7 '' NO char 108 324 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(108) NEVER NULL NO NO def mysql servers Username 4 '' NO char 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(128) NEVER NULL NO NO def mysql servers Wrapper 8 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) NEVER NULL NO NO def mysql slow_log db 7 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL NO NO @@ -475,7 +475,7 @@ NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp 3.0000 mysql servers Username char 128 384 utf8mb3 utf8mb3_general_ci char(128) 3.0000 mysql servers Password char 64 192 utf8mb3 utf8mb3_general_ci char(64) NULL mysql servers Port int NULL NULL NULL NULL int(4) -3.0000 mysql servers Socket char 64 192 utf8mb3 utf8mb3_general_ci char(64) +3.0000 mysql servers Socket char 108 324 utf8mb3 utf8mb3_general_ci char(108) 3.0000 mysql servers Wrapper char 64 192 utf8mb3 utf8mb3_general_ci char(64) 3.0000 mysql servers Owner varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512) NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index cbb42331792..5b92b282ece 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -10,6 +10,5 @@ # ############################################################################## -galera_sequences : MDEV-32561 WSREP FSM failure: no such a transition REPLICATING -> COMMITTED galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() galera_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() diff --git a/mysql-test/suite/galera/r/MDEV-26266.result b/mysql-test/suite/galera/r/MDEV-26266.result new file mode 100644 index 00000000000..01171d4bb83 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-26266.result @@ -0,0 +1,23 @@ +connection node_2; +connection node_1; +SET SESSION query_prealloc_size=8192; +SET max_session_mem_used=50000; +CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=InnoDB ; +UPDATE t1 SET c1='1'; +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=50000 option so it cannot execute this statement +SET wsrep_trx_fragment_size=1; +SET SESSION AUTOCOMMIT=0; +INSERT INTO t1 VALUES (1); +SET @inserted_value=REPEAT ('z', 257); +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB ; +SELECT * FROM t1 WHERE c1='two'; +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=50000 option so it cannot execute this statement +UPDATE t1 SET c1='2'; +INSERT INTO t2 VALUES (2); +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=50000 option so it cannot execute this statement +INSERT INTO t2 VALUES (3); +INSERT INTO t2 VALUES (4); +INSERT INTO t2 VALUES (5); +CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1 IN (SELECT a FROM t2) GROUP BY c1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/r/galera_bf_kill.result b/mysql-test/suite/galera/r/galera_bf_kill.result index 71b0366081b..e6ddf3fc3c5 100644 --- a/mysql-test/suite/galera/r/galera_bf_kill.result +++ b/mysql-test/suite/galera/r/galera_bf_kill.result @@ -1,10 +1,12 @@ connection node_2; connection node_1; connection node_2; +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB; insert into t1 values (NULL,1); connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connection node_2a; +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); begin; update t1 set a = 5; connection node_2; diff --git a/mysql-test/suite/galera/r/galera_bf_lock_wait.result b/mysql-test/suite/galera/r/galera_bf_lock_wait.result index 9e5cb2d9266..590fcea2997 100644 --- a/mysql-test/suite/galera/r/galera_bf_lock_wait.result +++ b/mysql-test/suite/galera/r/galera_bf_lock_wait.result @@ -1,8 +1,10 @@ connection node_2; connection node_1; connection node_2; +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); call mtr.add_suppression("WSREP: Trying to continue unpaused monitor"); connection node_1; +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); call mtr.add_suppression("WSREP: Trying to continue unpaused monitor"); CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2; ALTER TABLE t1 add primary key(a); diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result index 1a5219c2d45..1f6b2bd6637 100644 --- a/mysql-test/suite/galera/r/galera_sequences.result +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -314,3 +314,14 @@ NEXTVAL(t) connection node_1; DROP TABLE t1; DROP SEQUENCE t; + +MDEV-33245 SIGSEGV in wsrep_check_sequence | Sql_cmd_alter_sequence::execute + +CREATE TABLE t (a INT) ENGINE=InnoDB; +INSERT INTO t VALUES (0); +CREATE TABLE t1 (c VARCHAR) ENGINE=InnoDB; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ENGINE=InnoDB' at line 1 +ALTER SEQUENCE IF EXISTS t MINVALUE=1; +ERROR 42000: This version of MariaDB doesn't yet support 'CACHE without INCREMENT BY 0 in Galera cluster' +DROP TABLE t; +End of 10.5 tests diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result new file mode 100644 index 00000000000..1d631198990 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result @@ -0,0 +1,13 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_2; +Shutting down server ... +connection node_1; +Cleaning var directory ... +connection node_2; +Starting server ... +include/assert_grep.inc [mariabackup: Using 128974848 bytes for buffer pool \(set by --use-memory parameter\)] +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/t/MDEV-26266.test b/mysql-test/suite/galera/t/MDEV-26266.test new file mode 100644 index 00000000000..7167e029cb5 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-26266.test @@ -0,0 +1,35 @@ +# +# MDEV-26266 - Assertion +# state() == s_preparing || +# (is_xa() && state() == s_replaying) || +# (ret && (state() == s_must_abort || +# state() == s_must_replay || +# state() == s_cert_failed || +# state() == s_aborted)) +# failed. +# + +--source include/galera_cluster.inc + +SET SESSION query_prealloc_size=8192; +SET max_session_mem_used=50000; +CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=InnoDB ; +--error ER_OPTION_PREVENTS_STATEMENT +UPDATE t1 SET c1='1'; +SET wsrep_trx_fragment_size=1; +SET SESSION AUTOCOMMIT=0; +INSERT INTO t1 VALUES (1); +SET @inserted_value=REPEAT ('z', 257); +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB ; +--error ER_OPTION_PREVENTS_STATEMENT +SELECT * FROM t1 WHERE c1='two'; +UPDATE t1 SET c1='2'; +--error ER_OPTION_PREVENTS_STATEMENT +INSERT INTO t2 VALUES (2); +INSERT INTO t2 VALUES (3); +INSERT INTO t2 VALUES (4); +INSERT INTO t2 VALUES (5); +--error ER_LOCK_DEADLOCK +CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1 IN (SELECT a FROM t2) GROUP BY c1; + +DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test index 1cb2e866cb4..4655a35fde5 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill.test +++ b/mysql-test/suite/galera/t/galera_bf_kill.test @@ -7,11 +7,13 @@ # --connection node_2 +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB; insert into t1 values (NULL,1); --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 --connection node_2a +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); begin; update t1 set a = 5; diff --git a/mysql-test/suite/galera/t/galera_bf_lock_wait.test b/mysql-test/suite/galera/t/galera_bf_lock_wait.test index 8ef2fee78ed..78a460eda09 100644 --- a/mysql-test/suite/galera/t/galera_bf_lock_wait.test +++ b/mysql-test/suite/galera/t/galera_bf_lock_wait.test @@ -3,9 +3,11 @@ --source include/big_test.inc --connection node_2 +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); call mtr.add_suppression("WSREP: Trying to continue unpaused monitor"); --connection node_1 +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); call mtr.add_suppression("WSREP: Trying to continue unpaused monitor"); CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2; diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index 53417055d7d..75a31b224b9 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -341,3 +341,18 @@ SELECT NEXTVAL(t); --connection node_1 DROP TABLE t1; DROP SEQUENCE t; + +--echo +--echo MDEV-33245 SIGSEGV in wsrep_check_sequence | Sql_cmd_alter_sequence::execute +--echo + +CREATE TABLE t (a INT) ENGINE=InnoDB; +INSERT INTO t VALUES (0); + +--error ER_PARSE_ERROR +CREATE TABLE t1 (c VARCHAR) ENGINE=InnoDB; +--error ER_NOT_SUPPORTED_YET +ALTER SEQUENCE IF EXISTS t MINVALUE=1; + +DROP TABLE t; +--echo End of 10.5 tests diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf new file mode 100644 index 00000000000..05a647eb090 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf @@ -0,0 +1,8 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=mariabackup +wsrep_sst_auth="root:" + +[mariabackup] +use_memory=123m diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test new file mode 100644 index 00000000000..f6ba873976e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test @@ -0,0 +1,53 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_2 + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# +# Force SST +# +--echo Cleaning var directory ... +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data + +--connection node_2 + +--echo Starting server ... +let $restart_noprint=2; +--source include/start_mysqld.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +# Confirm that IST did not take place +--let $assert_text = mariabackup: Using 128974848 bytes for buffer pool \(set by --use-memory parameter\) +--let $assert_select = mariabackup: Using 128974848 bytes for buffer pool \(set by --use-memory parameter\) +--let $assert_count = 1 +--let $assert_file = $MYSQLTEST_VARDIR/mysqld.2/data/mariabackup.prepare.log +--let $assert_only_after = Starting InnoDB instance for recovery +--source include/assert_grep.inc + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/mysql-test/suite/handler/handler_warnings.result b/mysql-test/suite/handler/handler_warnings.result new file mode 100644 index 00000000000..f64f7cad76f --- /dev/null +++ b/mysql-test/suite/handler/handler_warnings.result @@ -0,0 +1,14 @@ +# +# MDEV-30263: --echo # Assertion failure in Protocol::end_statement +# upon HANDLER READ with invalid timestamp +# +CREATE TABLE t (a TIMESTAMP, KEY(a)); +HANDLER t OPEN; +HANDLER t READ a > ('2022-12'); +a +# above should issue the same warnings/errors as following +SELECT * from t WHERE t.a > ('2022-12'); +a +HANDLER t CLOSE; +DROP TABLE t; +End of 10.5 tests diff --git a/mysql-test/suite/handler/handler_warnings.test b/mysql-test/suite/handler/handler_warnings.test new file mode 100644 index 00000000000..b632381c1c0 --- /dev/null +++ b/mysql-test/suite/handler/handler_warnings.test @@ -0,0 +1,15 @@ +--echo # +--echo # MDEV-30263: --echo # Assertion failure in Protocol::end_statement +--echo # upon HANDLER READ with invalid timestamp +--echo # + +CREATE TABLE t (a TIMESTAMP, KEY(a)); +HANDLER t OPEN; +HANDLER t READ a > ('2022-12'); +--echo # above should issue the same warnings/errors as following +SELECT * from t WHERE t.a > ('2022-12'); +# Cleanup +HANDLER t CLOSE; +DROP TABLE t; + +--echo End of 10.5 tests diff --git a/mysql-test/suite/heap/heap.result b/mysql-test/suite/heap/heap.result index 24c6aadb1bb..07d67bef6ef 100644 --- a/mysql-test/suite/heap/heap.result +++ b/mysql-test/suite/heap/heap.result @@ -799,58 +799,6 @@ id select_type table type possible_keys key key_len ref rows Extra 3 DERIVED t1 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Using where DROP TABLE t1,t2,h1; DROP VIEW v1; -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100; -insert into t1 values(1); -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -1600 2400 -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000; -insert into t1 values(1); -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -16000 24000 -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000; -insert into t1 values(1); -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -48000 72000 -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000; -insert into t1 values(1); -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -24000 36000 -drop table t1; -create table t1 (c1 int, index(c1)) engine=heap max_rows=10000; -insert into t1 select rand(100000000); -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1 limit 488; -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -16000 24000 -insert into t1 select rand(100000000) from t1 limit 1; -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -33024 49024 -insert into t1 select rand(100000000) from t1 limit 1000; -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -49024 73024 -insert into t1 select rand(100000000) from t1; -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -81024 121024 -drop table t1; CREATE TABLE t1 (id INT); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); diff --git a/mysql-test/suite/heap/heap.test b/mysql-test/suite/heap/heap.test index 7d8b91b5984..ff961281b74 100644 --- a/mysql-test/suite/heap/heap.test +++ b/mysql-test/suite/heap/heap.test @@ -547,7 +547,7 @@ CREATE TABLE t1 ( ); INSERT INTO t1 VALUES (19,5,'h'),(20,5,'h'); - + CREATE TABLE t2 (col_int_nokey INT); INSERT INTO t2 VALUES (1),(2); @@ -568,58 +568,6 @@ DROP TABLE t1,t2,h1; DROP VIEW v1; # End of 5.1 tests -# -# Show that MIN_ROWS and MAX_ROWS have an effect on how data_length -# and index_length are allocated. -# Result is different for 32 / 64 bit machines as pointer lengths are different -# - -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100; -insert into t1 values(1); ---replace_result 800 1600 1200 2400 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000; -insert into t1 values(1); ---replace_result 8000 16000 12000 24000 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000; -insert into t1 values(1); ---replace_result 24000 48000 36000 72000 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000; -insert into t1 values(1); ---replace_result 12000 24000 18000 36000 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -drop table t1; - -create table t1 (c1 int, index(c1)) engine=heap max_rows=10000; -insert into t1 select rand(100000000); -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1 limit 488; ---replace_result 8000 16000 12000 24000 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -insert into t1 select rand(100000000) from t1 limit 1; ---replace_result 16512 33024 24512 49024 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -insert into t1 select rand(100000000) from t1 limit 1000; ---replace_result 24512 49024 36512 73024 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -insert into t1 select rand(100000000) from t1; ---replace_result 40512 81024 60512 121024 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -drop table t1; - # # MDEV-5905 Creating tmp. memory table kills the server # diff --git a/mysql-test/suite/heap/heap_memory_used,32bit.rdiff b/mysql-test/suite/heap/heap_memory_used,32bit.rdiff new file mode 100644 index 00000000000..19004c065c8 --- /dev/null +++ b/mysql-test/suite/heap/heap_memory_used,32bit.rdiff @@ -0,0 +1,40 @@ +--- suite/heap/heap_memory_used.result ++++ suite/heap/heap_memory_used.reject +@@ -17,13 +17,13 @@ + insert into t1 values(1); + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-65504 131040 ++32736 65504 + drop table t1; + CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000; + insert into t1 values(1); + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-16352 32736 ++16352 16352 + drop table t1; + create table t1 (c1 int, index(c1)) engine=heap max_rows=10000; + insert into t1 select rand(100000000); +@@ -39,17 +39,17 @@ + insert into t1 select rand(100000000) from t1 limit 488; + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-32704 32704 ++16352 16352 + insert into t1 select rand(100000000) from t1 limit 1; + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-32704 32704 ++16352 16352 + insert into t1 select rand(100000000) from t1 limit 1000; + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-49056 65408 ++32704 32704 + insert into t1 select rand(100000000) from t1; + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-81760 114464 ++49056 65408 + drop table t1; diff --git a/mysql-test/suite/heap/heap_memory_used.result b/mysql-test/suite/heap/heap_memory_used.result new file mode 100644 index 00000000000..c09755fed88 --- /dev/null +++ b/mysql-test/suite/heap/heap_memory_used.result @@ -0,0 +1,55 @@ +# +# Test of heap table memory usage +# +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +16352 16352 +drop table t1; +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +16352 16352 +drop table t1; +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +65504 131040 +drop table t1; +CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +16352 32736 +drop table t1; +create table t1 (c1 int, index(c1)) engine=heap max_rows=10000; +insert into t1 select rand(100000000); +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1 limit 488; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +32704 32704 +insert into t1 select rand(100000000) from t1 limit 1; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +32704 32704 +insert into t1 select rand(100000000) from t1 limit 1000; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +49056 65408 +insert into t1 select rand(100000000) from t1; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +81760 114464 +drop table t1; diff --git a/mysql-test/suite/heap/heap_memory_used.test b/mysql-test/suite/heap/heap_memory_used.test new file mode 100644 index 00000000000..c9b8578e2d5 --- /dev/null +++ b/mysql-test/suite/heap/heap_memory_used.test @@ -0,0 +1,50 @@ +--echo # +--echo # Test of heap table memory usage +--echo # + +--source include/word_size.inc + +# +# Show that MIN_ROWS and MAX_ROWS have an effect on how data_length +# and index_length are allocated. +# Result is different for 32 / 64 bit machines as pointer lengths are different +# + +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +drop table t1; + +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +drop table t1; +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +drop table t1; +CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +drop table t1; + +create table t1 (c1 int, index(c1)) engine=heap max_rows=10000; +insert into t1 select rand(100000000); +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1 limit 488; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +insert into t1 select rand(100000000) from t1 limit 1; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +insert into t1 select rand(100000000) from t1 limit 1000; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +insert into t1 select rand(100000000) from t1; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +drop table t1; diff --git a/mysql-test/suite/innodb/r/alter_copy_bulk.result b/mysql-test/suite/innodb/r/alter_copy_bulk.result index e64853f72a4..cd57d95af96 100644 --- a/mysql-test/suite/innodb/r/alter_copy_bulk.result +++ b/mysql-test/suite/innodb/r/alter_copy_bulk.result @@ -66,4 +66,28 @@ SELECT COUNT(*) FROM t; COUNT(*) 2 DROP TABLE t1, t2, t; +# +# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +# failed in cmp_rec_rec_simple_field +# +CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), +(REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), +(REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), +(REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), +(REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), +(REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), +(REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), +(REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), +(REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), +(REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), +(REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), +(REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), +(REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), +(REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), +(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), +(REPEAT('x',65535),'dd'); +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +DROP TABLE t1; SET GLOBAL innodb_stats_persistent=@default_stats_persistent; diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash,dynamic.rdiff b/mysql-test/suite/innodb/r/innodb-64k-crash,dynamic.rdiff new file mode 100644 index 00000000000..83c5e3aa787 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-64k-crash,dynamic.rdiff @@ -0,0 +1,8 @@ +--- innodb-64k-crash.result 2024-11-28 10:37:26.491384671 +0530 ++++ innodb-64k-crash.reject 2024-11-28 11:05:46.461405444 +0530 +@@ -334,5 +334,4 @@ + REPEAT('s', 1024), REPEAT('t', 1024), + REPEAT('u', 1024), REPEAT('v', 1024), + REPEAT('w', 1024), REPEAT('x', 1024)); +-ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash,redundant.rdiff b/mysql-test/suite/innodb/r/innodb-64k-crash,redundant.rdiff new file mode 100644 index 00000000000..637512a2448 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-64k-crash,redundant.rdiff @@ -0,0 +1,52 @@ +--- innodb-64k-crash.result 2024-11-28 10:37:26.491384671 +0530 ++++ innodb-64k-crash.reject 2024-11-28 11:10:13.381250612 +0530 +@@ -290,49 +290,3 @@ + # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' + # failed in cmp_rec_rec_simple_field + # +-CREATE TABLE t1(f1 int not null, f2 text, f3 text, f4 text, +-f5 text, f6 text, f7 text, f8 text, +-f9 text, f10 text, f11 text, f12 text, +-f13 text, f14 text, f15 text, f16 text, +-f17 text, f18 text, f19 text, f20 text, +-f21 text, f22 text, f23 text, f24 text, +-f25 text, PRIMARY KEY(f1))ENGINE=InnoDB; +-SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR +-INSERT INTO t1 VALUES(1, REPEAT('a', 1024), REPEAT('b', 1024), +-REPEAT('c', 1024), REPEAT('d', 1024), +-REPEAT('e', 1024), REPEAT('f', 1024), +-REPEAT('g', 4096), REPEAT('h', 1024), +-REPEAT('i', 1024), REPEAT('j', 1024), +-REPEAT('k', 1024), REPEAT('l', 1024), +-REPEAT('m', 1024), REPEAT('n', 1024), +-REPEAT('o', 1024), REPEAT('p', 1024), +-REPEAT('q', 1024), REPEAT('r', 1024), +-REPEAT('s', 1024), REPEAT('t', 1024), +-REPEAT('u', 1024), REPEAT('v', 1024), +-REPEAT('w', 1024), REPEAT('x', 1024)), +-(2, REPEAT('a', 1024), REPEAT('b', 1024), +-REPEAT('c', 1024), REPEAT('d', 1024), +-REPEAT('e', 1024), REPEAT('f', 1024), +-REPEAT('g', 4096), REPEAT('h', 1024), +-REPEAT('i', 1024), REPEAT('j', 1024), +-REPEAT('k', 1024), REPEAT('l', 1024), +-REPEAT('m', 1024), REPEAT('n', 1024), +-REPEAT('o', 1024), REPEAT('p', 1024), +-REPEAT('q', 1024), REPEAT('r', 1024), +-REPEAT('s', 1024), REPEAT('t', 1024), +-REPEAT('u', 1024), REPEAT('v', 1024), +-REPEAT('w', 1024), REPEAT('x', 1024)), +-(3, REPEAT('a', 1024), REPEAT('b', 1024), +-REPEAT('c', 1024), REPEAT('d', 1024), +-REPEAT('e', 1024), REPEAT('f', 1024), +-REPEAT('g', 4096), REPEAT('h', 1024), +-REPEAT('i', 1024), REPEAT('j', 1024), +-REPEAT('k', 1024), REPEAT('l', 1024), +-REPEAT('m', 1024), REPEAT('n', 1024), +-REPEAT('o', 1024), REPEAT('p', 1024), +-REPEAT('q', 1024), REPEAT('r', 1024), +-REPEAT('s', 1024), REPEAT('t', 1024), +-REPEAT('u', 1024), REPEAT('v', 1024), +-REPEAT('w', 1024), REPEAT('x', 1024)); +-ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +-DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash.result b/mysql-test/suite/innodb/r/innodb-64k-crash.result index 1f3b41f75a6..2b00f9988c2 100644 --- a/mysql-test/suite/innodb/r/innodb-64k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-64k-crash.result @@ -286,3 +286,53 @@ Table Op Msg_type Msg_text test.t1 check status OK test.t2 check status OK drop table t1,t2; +# +# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +# failed in cmp_rec_rec_simple_field +# +CREATE TABLE t1(f1 int not null, f2 text, f3 text, f4 text, +f5 text, f6 text, f7 text, f8 text, +f9 text, f10 text, f11 text, f12 text, +f13 text, f14 text, f15 text, f16 text, +f17 text, f18 text, f19 text, f20 text, +f21 text, f22 text, f23 text, f24 text, +f25 text, PRIMARY KEY(f1))ENGINE=InnoDB; +SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR +INSERT INTO t1 VALUES(1, REPEAT('a', 1024), REPEAT('b', 1024), +REPEAT('c', 1024), REPEAT('d', 1024), +REPEAT('e', 1024), REPEAT('f', 1024), +REPEAT('g', 4096), REPEAT('h', 1024), +REPEAT('i', 1024), REPEAT('j', 1024), +REPEAT('k', 1024), REPEAT('l', 1024), +REPEAT('m', 1024), REPEAT('n', 1024), +REPEAT('o', 1024), REPEAT('p', 1024), +REPEAT('q', 1024), REPEAT('r', 1024), +REPEAT('s', 1024), REPEAT('t', 1024), +REPEAT('u', 1024), REPEAT('v', 1024), +REPEAT('w', 1024), REPEAT('x', 1024)), +(2, REPEAT('a', 1024), REPEAT('b', 1024), +REPEAT('c', 1024), REPEAT('d', 1024), +REPEAT('e', 1024), REPEAT('f', 1024), +REPEAT('g', 4096), REPEAT('h', 1024), +REPEAT('i', 1024), REPEAT('j', 1024), +REPEAT('k', 1024), REPEAT('l', 1024), +REPEAT('m', 1024), REPEAT('n', 1024), +REPEAT('o', 1024), REPEAT('p', 1024), +REPEAT('q', 1024), REPEAT('r', 1024), +REPEAT('s', 1024), REPEAT('t', 1024), +REPEAT('u', 1024), REPEAT('v', 1024), +REPEAT('w', 1024), REPEAT('x', 1024)), +(3, REPEAT('a', 1024), REPEAT('b', 1024), +REPEAT('c', 1024), REPEAT('d', 1024), +REPEAT('e', 1024), REPEAT('f', 1024), +REPEAT('g', 4096), REPEAT('h', 1024), +REPEAT('i', 1024), REPEAT('j', 1024), +REPEAT('k', 1024), REPEAT('l', 1024), +REPEAT('m', 1024), REPEAT('n', 1024), +REPEAT('o', 1024), REPEAT('p', 1024), +REPEAT('q', 1024), REPEAT('r', 1024), +REPEAT('s', 1024), REPEAT('t', 1024), +REPEAT('u', 1024), REPEAT('v', 1024), +REPEAT('w', 1024), REPEAT('x', 1024)); +ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result index 1c6761dbca1..8f9fa5609c5 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result @@ -451,7 +451,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Got error 42 'Tablespace not found' from ./test/t1.ibd +ERROR HY000: Got error 41 'Tablespace not found' from ./test/t1.ibd SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; diff --git a/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff index 9d40decbb30..ba7e68ad890 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff +++ b/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff @@ -1,4 +1,6 @@ -@@ -377,8 +377,6 @@ +--- insert_into_empty.result ++++ insert_into_empty,32k.result +@@ -446,12 +446,9 @@ c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; ALTER TABLE t1 FORCE; @@ -7,3 +9,7 @@ INSERT IGNORE INTO t1 VALUES (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CHECK TABLE t1; + Table Op Msg_type Msg_text + test.t1 check status OK diff --git a/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff index ad3d03a7eae..9964ae21f9f 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff +++ b/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff @@ -1,10 +1,40 @@ ---- a/mysql-test/suite/innodb/r/insert_into_empty.result -+++ b/mysql-test/suite/innodb/r/insert_into_empty.result -@@ -430,6 +430,7 @@ +--- insert_into_empty.result ++++ insert_into_empty,4k.result +@@ -451,7 +451,7 @@ INSERT IGNORE INTO t1 VALUES (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK +@@ -542,28 +542,6 @@ + commit; + DROP TABLE t1; + # +-# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +-# failed in cmp_rec_rec_simple_field +-# +-CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +-INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), +-(REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), +-(REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), +-(REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), +-(REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), +-(REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), +-(REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), +-(REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), +-(REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), +-(REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), +-(REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), +-(REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), +-(REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), +-(REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), +-(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), +-(REPEAT('x',65535),'dd'); +-DROP TABLE t1; +-# + # Assertion `page_dir_get_n_heap(new_page) == 2U' failed + # in dberr_t PageBulk::init() + # diff --git a/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff index 9d40decbb30..e3d784a7c88 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff +++ b/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff @@ -1,4 +1,6 @@ -@@ -377,8 +377,6 @@ +--- insert_into_empty.result ++++ insert_into_empty,64k.result +@@ -446,12 +446,9 @@ c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; ALTER TABLE t1 FORCE; @@ -7,3 +9,7 @@ INSERT IGNORE INTO t1 VALUES (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CHECK TABLE t1; + Table Op Msg_type Msg_text + test.t1 check status OK diff --git a/mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff new file mode 100644 index 00000000000..6a10197f021 --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff @@ -0,0 +1,40 @@ +--- insert_into_empty.result ++++ insert_into_empty,8k.result +@@ -451,7 +451,7 @@ + INSERT IGNORE INTO t1 VALUES + (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), + (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 4030). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CHECK TABLE t1; + Table Op Msg_type Msg_text + test.t1 check status OK +@@ -542,28 +542,6 @@ + commit; + DROP TABLE t1; + # +-# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +-# failed in cmp_rec_rec_simple_field +-# +-CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +-INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), +-(REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), +-(REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), +-(REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), +-(REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), +-(REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), +-(REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), +-(REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), +-(REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), +-(REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), +-(REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), +-(REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), +-(REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), +-(REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), +-(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), +-(REPEAT('x',65535),'dd'); +-DROP TABLE t1; +-# + # Assertion `page_dir_get_n_heap(new_page) == 2U' failed + # in dberr_t PageBulk::init() + # diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result index c679f11ac0a..74b3a39ecdc 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty.result +++ b/mysql-test/suite/innodb/r/insert_into_empty.result @@ -451,6 +451,7 @@ Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB o INSERT IGNORE INTO t1 VALUES (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -540,4 +541,43 @@ INSERT INTO t1 VALUES(2,0); DELETE FROM t1; commit; DROP TABLE t1; +# +# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +# failed in cmp_rec_rec_simple_field +# +CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), +(REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), +(REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), +(REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), +(REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), +(REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), +(REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), +(REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), +(REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), +(REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), +(REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), +(REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), +(REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), +(REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), +(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), +(REPEAT('x',65535),'dd'); +DROP TABLE t1; +# +# Assertion `page_dir_get_n_heap(new_page) == 2U' failed +# in dberr_t PageBulk::init() +# +CREATE TABLE t1(f1 INT)ENGINE=InnoDB PARTITION BY RANGE (f1) (PARTITION p0 VALUES LESS THAN (100)); +SET @old_bulk_op= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_bulk_operations'); +BEGIN; +INSERT INTO t1 SELECT seq FROM seq_1_to_1; +COMMIT; +SELECT variable_value-@old_bulk_op bulk_operations +FROM information_schema.global_status +WHERE variable_name = 'innodb_bulk_operations'; +bulk_operations +1 +DROP TABLE t1; # End of 10.11 tests diff --git a/mysql-test/suite/innodb/r/log_file_size_online.result b/mysql-test/suite/innodb/r/log_file_size_online.result index 197e1145b77..7b2b23bd776 100644 --- a/mysql-test/suite/innodb/r/log_file_size_online.result +++ b/mysql-test/suite/innodb/r/log_file_size_online.result @@ -19,7 +19,7 @@ SHOW VARIABLES LIKE 'innodb_log_file_size'; Variable_name Value innodb_log_file_size 4194304 FOUND 1 /InnoDB: Resized log to 4\.000MiB/ in mysqld.1.err -SET @save=@@GLOBAL.innodb_log_file_buffering; +SET @save=@@global.innodb_log_file_buffering; SET GLOBAL innodb_log_file_buffering=OFF; SET GLOBAL innodb_log_file_buffering=ON; SET GLOBAL innodb_log_file_buffering=@save; diff --git a/mysql-test/suite/innodb/t/alter_copy_bulk.test b/mysql-test/suite/innodb/t/alter_copy_bulk.test index 2d195617ea4..bc19aca00da 100644 --- a/mysql-test/suite/innodb/t/alter_copy_bulk.test +++ b/mysql-test/suite/innodb/t/alter_copy_bulk.test @@ -83,4 +83,29 @@ CREATE TABLE t engine=innodb SELECT t2.f2 FROM t2 JOIN t1 ON t1.f1 = t2.f1 AND t1.f3 = '' AND t1.f2=1 ; SELECT COUNT(*) FROM t; DROP TABLE t1, t2, t; + +--echo # +--echo # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +--echo # failed in cmp_rec_rec_simple_field +--echo # +CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES + (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), + (REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), + (REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), + (REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), + (REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), + (REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), + (REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), + (REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), + (REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), + (REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), + (REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), + (REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), + (REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), + (REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), + (REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), + (REPEAT('x',65535),'dd'); +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +DROP TABLE t1; SET GLOBAL innodb_stats_persistent=@default_stats_persistent; diff --git a/mysql-test/suite/innodb/t/autoinc_debug.test b/mysql-test/suite/innodb/t/autoinc_debug.test index d38a70b3376..f62cfd8afce 100644 --- a/mysql-test/suite/innodb/t/autoinc_debug.test +++ b/mysql-test/suite/innodb/t/autoinc_debug.test @@ -3,6 +3,10 @@ --source include/have_debug_sync.inc --source include/not_embedded.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # Two parallel connection with autoinc column after restart. CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY)ENGINE=INNODB; diff --git a/mysql-test/suite/innodb/t/deadlock_detect.test b/mysql-test/suite/innodb/t/deadlock_detect.test index a84e6fc328f..39ea174a3ec 100644 --- a/mysql-test/suite/innodb/t/deadlock_detect.test +++ b/mysql-test/suite/innodb/t/deadlock_detect.test @@ -5,6 +5,10 @@ --source include/have_innodb.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + let $have_deadlock=`select @@GLOBAL.innodb_deadlock_detect`; connection default; diff --git a/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test b/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test index b3adfb3b02d..beded05198e 100644 --- a/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test +++ b/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test @@ -1,6 +1,10 @@ --source include/have_innodb.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + CREATE TABLE t1 ( pkey int NOT NULL PRIMARY KEY, c int diff --git a/mysql-test/suite/innodb/t/deadlock_victim_race.test b/mysql-test/suite/innodb/t/deadlock_victim_race.test index b9a442fc5b9..dac6be698fc 100644 --- a/mysql-test/suite/innodb/t/deadlock_victim_race.test +++ b/mysql-test/suite/innodb/t/deadlock_victim_race.test @@ -2,6 +2,10 @@ --source include/have_debug_sync.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connect(cancel_purge,localhost,root,,) # Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx # ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point diff --git a/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test b/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test index 79a62b098c9..27d02898b72 100644 --- a/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test +++ b/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test @@ -2,6 +2,10 @@ --source include/have_debug_sync.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx # ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point # lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be diff --git a/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test b/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test index 42576f35baf..318db88a470 100644 --- a/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test +++ b/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test @@ -2,6 +2,10 @@ --source include/have_debug_sync.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx # ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point # lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test index 8c6ce939bab..4b0dcc97e58 100644 --- a/mysql-test/suite/innodb/t/foreign_key.test +++ b/mysql-test/suite/innodb/t/foreign_key.test @@ -2,6 +2,10 @@ --source include/count_sessions.inc --source include/default_charset.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + SET GLOBAL innodb_stats_persistent = 0; --echo # diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.opt b/mysql-test/suite/innodb/t/innodb-64k-crash.opt new file mode 100644 index 00000000000..c856c2d215a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-64k-crash.opt @@ -0,0 +1 @@ +--innodb_sort_buffer_size=65536 diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.test b/mysql-test/suite/innodb/t/innodb-64k-crash.test index 93f6f79edf3..61735890618 100644 --- a/mysql-test/suite/innodb/t/innodb-64k-crash.test +++ b/mysql-test/suite/innodb/t/innodb-64k-crash.test @@ -2,6 +2,7 @@ --source include/have_innodb_64k.inc # Embedded server does not support restarting --source include/not_embedded.inc +--source innodb_default_row_format.inc let $MYSQLD_DATADIR= `select @@datadir`; @@ -314,3 +315,64 @@ connection default; check table t1,t2; drop table t1,t2; + +--echo # +--echo # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +--echo # failed in cmp_rec_rec_simple_field +--echo # +let $row_format= `select @@global.innodb_default_row_format`; +if ($row_format != "redundant") +{ +CREATE TABLE t1(f1 int not null, f2 text, f3 text, f4 text, + f5 text, f6 text, f7 text, f8 text, + f9 text, f10 text, f11 text, f12 text, + f13 text, f14 text, f15 text, f16 text, + f17 text, f18 text, f19 text, f20 text, + f21 text, f22 text, f23 text, f24 text, + f25 text, PRIMARY KEY(f1))ENGINE=InnoDB; +let $error_code = ER_TOO_BIG_ROWSIZE; +if ($row_format == "dynamic") +{ + let $error_code = 0; +} + +--error $error_code +SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR +INSERT INTO t1 VALUES(1, REPEAT('a', 1024), REPEAT('b', 1024), + REPEAT('c', 1024), REPEAT('d', 1024), + REPEAT('e', 1024), REPEAT('f', 1024), + REPEAT('g', 4096), REPEAT('h', 1024), + REPEAT('i', 1024), REPEAT('j', 1024), + REPEAT('k', 1024), REPEAT('l', 1024), + REPEAT('m', 1024), REPEAT('n', 1024), + REPEAT('o', 1024), REPEAT('p', 1024), + REPEAT('q', 1024), REPEAT('r', 1024), + REPEAT('s', 1024), REPEAT('t', 1024), + REPEAT('u', 1024), REPEAT('v', 1024), + REPEAT('w', 1024), REPEAT('x', 1024)), + (2, REPEAT('a', 1024), REPEAT('b', 1024), + REPEAT('c', 1024), REPEAT('d', 1024), + REPEAT('e', 1024), REPEAT('f', 1024), + REPEAT('g', 4096), REPEAT('h', 1024), + REPEAT('i', 1024), REPEAT('j', 1024), + REPEAT('k', 1024), REPEAT('l', 1024), + REPEAT('m', 1024), REPEAT('n', 1024), + REPEAT('o', 1024), REPEAT('p', 1024), + REPEAT('q', 1024), REPEAT('r', 1024), + REPEAT('s', 1024), REPEAT('t', 1024), + REPEAT('u', 1024), REPEAT('v', 1024), + REPEAT('w', 1024), REPEAT('x', 1024)), + (3, REPEAT('a', 1024), REPEAT('b', 1024), + REPEAT('c', 1024), REPEAT('d', 1024), + REPEAT('e', 1024), REPEAT('f', 1024), + REPEAT('g', 4096), REPEAT('h', 1024), + REPEAT('i', 1024), REPEAT('j', 1024), + REPEAT('k', 1024), REPEAT('l', 1024), + REPEAT('m', 1024), REPEAT('n', 1024), + REPEAT('o', 1024), REPEAT('p', 1024), + REPEAT('q', 1024), REPEAT('r', 1024), + REPEAT('s', 1024), REPEAT('t', 1024), + REPEAT('u', 1024), REPEAT('v', 1024), + REPEAT('w', 1024), REPEAT('x', 1024)); +DROP TABLE t1; +} diff --git a/mysql-test/suite/innodb/t/innodb-lock.test b/mysql-test/suite/innodb/t/innodb-lock.test index fbbb1035481..394681702c0 100644 --- a/mysql-test/suite/innodb/t/innodb-lock.test +++ b/mysql-test/suite/innodb/t/innodb-lock.test @@ -1,6 +1,10 @@ --source include/have_innodb.inc --source include/have_partition.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # # Check and select innodb lock type # diff --git a/mysql-test/suite/innodb/t/innodb_bug42419.test b/mysql-test/suite/innodb/t/innodb_bug42419.test index ef350529604..2314a2b43ab 100644 --- a/mysql-test/suite/innodb/t/innodb_bug42419.test +++ b/mysql-test/suite/innodb/t/innodb_bug42419.test @@ -4,6 +4,10 @@ # Bug#42419 Server crash with "Pure virtual method called" on two concurrent connections # +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --source include/not_embedded.inc let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1); diff --git a/mysql-test/suite/innodb/t/innodb_mysql_rbk.test b/mysql-test/suite/innodb/t/innodb_mysql_rbk.test index 85a9769732f..ffdfaf48ea6 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql_rbk.test +++ b/mysql-test/suite/innodb/t/innodb_mysql_rbk.test @@ -1,5 +1,9 @@ --source include/have_innodb.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # # Bug #41453: Assertion `m_status == DA_ERROR' failed in # Diagnostics_area::sql_errno diff --git a/mysql-test/suite/innodb/t/innodb_trx_weight.test b/mysql-test/suite/innodb/t/innodb_trx_weight.test index 819f05f331e..a8c29a1a8a8 100644 --- a/mysql-test/suite/innodb/t/innodb_trx_weight.test +++ b/mysql-test/suite/innodb/t/innodb_trx_weight.test @@ -6,6 +6,10 @@ # be heavier than ones that had not. # +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + -- source include/have_innodb.inc SET default_storage_engine=InnoDB; diff --git a/mysql-test/suite/innodb/t/insert-before-delete.test b/mysql-test/suite/innodb/t/insert-before-delete.test index 2547b94e5ea..1cadbf7c0c6 100644 --- a/mysql-test/suite/innodb/t/insert-before-delete.test +++ b/mysql-test/suite/innodb/t/insert-before-delete.test @@ -3,6 +3,10 @@ --source include/have_debug_sync.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connect (pause_purge,localhost,root) START TRANSACTION WITH CONSISTENT SNAPSHOT; diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index 7ec5c147a7f..f2f277fa417 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -484,7 +484,7 @@ ALTER TABLE t1 FORCE; let $page_size= `SELECT @@innodb_page_size`; let $error_code = 0; -if ($page_size == 4096) { +if ($page_size <= 16384) { let $error_code = ER_TOO_BIG_ROWSIZE; } @@ -593,4 +593,49 @@ INSERT INTO t1 VALUES(2,0); DELETE FROM t1; commit; DROP TABLE t1; + + +if ($page_size >= 16384) { +--echo # +--echo # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +--echo # failed in cmp_rec_rec_simple_field +--echo # +CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), + (REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), + (REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), + (REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), + (REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), + (REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), + (REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), + (REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), + (REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), + (REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), + (REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), + (REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), + (REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), + (REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), + (REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), + (REPEAT('x',65535),'dd'); +DROP TABLE t1; +} + +--echo # +--echo # Assertion `page_dir_get_n_heap(new_page) == 2U' failed +--echo # in dberr_t PageBulk::init() +--echo # +CREATE TABLE t1(f1 INT)ENGINE=InnoDB PARTITION BY RANGE (f1) (PARTITION p0 VALUES LESS THAN (100)); + +SET @old_bulk_op= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_bulk_operations'); + +BEGIN; +INSERT INTO t1 SELECT seq FROM seq_1_to_1; +COMMIT; + +SELECT variable_value-@old_bulk_op bulk_operations +FROM information_schema.global_status +WHERE variable_name = 'innodb_bulk_operations'; +DROP TABLE t1; --echo # End of 10.11 tests diff --git a/mysql-test/suite/innodb/t/lock_delete_updated.test b/mysql-test/suite/innodb/t/lock_delete_updated.test index 1f7b13144e4..8697ff595ab 100644 --- a/mysql-test/suite/innodb/t/lock_delete_updated.test +++ b/mysql-test/suite/innodb/t/lock_delete_updated.test @@ -3,6 +3,10 @@ --source include/have_debug.inc --source include/have_debug_sync.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t VALUES (3); diff --git a/mysql-test/suite/innodb/t/lock_isolation.test b/mysql-test/suite/innodb/t/lock_isolation.test index c9658c0a362..bac034a50e4 100644 --- a/mysql-test/suite/innodb/t/lock_isolation.test +++ b/mysql-test/suite/innodb/t/lock_isolation.test @@ -1,5 +1,9 @@ --source include/have_innodb.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --echo # --echo # MDEV-26642 Weird SELECT view when a record is --echo # modified to the same value by two transactions diff --git a/mysql-test/suite/innodb/t/lock_memory_debug.test b/mysql-test/suite/innodb/t/lock_memory_debug.test index 51e0e8fd57e..588356f7fa4 100644 --- a/mysql-test/suite/innodb/t/lock_memory_debug.test +++ b/mysql-test/suite/innodb/t/lock_memory_debug.test @@ -6,6 +6,9 @@ --echo # call mtr.add_suppression("\\[Warning\\] InnoDB: Over 67 percent of the buffer pool"); +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log CREATE TABLE t1 (col1 INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2),(3),(4),(5); diff --git a/mysql-test/suite/innodb/t/log_file_size_online.test b/mysql-test/suite/innodb/t/log_file_size_online.test index 0435e288cbc..bf9f3510592 100644 --- a/mysql-test/suite/innodb/t/log_file_size_online.test +++ b/mysql-test/suite/innodb/t/log_file_size_online.test @@ -26,7 +26,7 @@ let SEARCH_PATTERN = InnoDB: Resized log to 4\\.000MiB; --source include/search_pattern_in_file.inc --error 0,ER_UNKNOWN_SYSTEM_VARIABLE -SET @save=@@GLOBAL.innodb_log_file_buffering; +SET @save=@@global.innodb_log_file_buffering; --error 0,ER_UNKNOWN_SYSTEM_VARIABLE SET GLOBAL innodb_log_file_buffering=OFF; --error 0,ER_UNKNOWN_SYSTEM_VARIABLE diff --git a/mysql-test/suite/innodb/t/mdev-14846.test b/mysql-test/suite/innodb/t/mdev-14846.test index 5c101eaa4e6..fac010871fe 100644 --- a/mysql-test/suite/innodb/t/mdev-14846.test +++ b/mysql-test/suite/innodb/t/mdev-14846.test @@ -4,6 +4,10 @@ --source include/innodb_stable_estimates.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + CREATE TABLE t1 ( pk INT, f1 VARCHAR(10) NOT NULL, diff --git a/mysql-test/suite/innodb/t/row_lock.test b/mysql-test/suite/innodb/t/row_lock.test index 361bce461f7..2598189d0e2 100644 --- a/mysql-test/suite/innodb/t/row_lock.test +++ b/mysql-test/suite/innodb/t/row_lock.test @@ -4,6 +4,10 @@ # concurrent CREATE OR REPLACE and transactional UPDATE # +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --source include/have_innodb.inc CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/t/stat_tables.test b/mysql-test/suite/innodb/t/stat_tables.test index 79bc107d0ea..d606ad27709 100644 --- a/mysql-test/suite/innodb/t/stat_tables.test +++ b/mysql-test/suite/innodb/t/stat_tables.test @@ -1,5 +1,9 @@ source include/have_innodb.inc; +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # # MDEV-20354 All but last insert ignored in InnoDB tables when table locked # diff --git a/mysql-test/suite/innodb_fts/r/savepoint.result b/mysql-test/suite/innodb_fts/r/savepoint.result index 1abfc961d0a..b2d53c36fbe 100644 --- a/mysql-test/suite/innodb_fts/r/savepoint.result +++ b/mysql-test/suite/innodb_fts/r/savepoint.result @@ -249,9 +249,33 @@ id title 7 mysql TRUNCATE TABLE articles; INSERT INTO articles(id, title) VALUES(1, 'mysql'); +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; BEGIN; +INSERT INTO t SET a=1; +SAVEPOINT t; +INSERT INTO articles(id, title) VALUES(2, 'mysql'); +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); +id title +1 mysql +ROLLBACK TO SAVEPOINT t; +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); +id title +1 mysql +SELECT * FROM t; +a +1 +COMMIT; +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); +id title +1 mysql +BEGIN; +INSERT INTO t SET a=2; INSERT INTO articles(id, title) VALUES(2, 'mysql'); ROLLBACK; +SELECT * FROM t; +a +1 +DROP TABLE t; INSERT INTO articles(id, title) VALUES(3, 'mysql'); SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); id title diff --git a/mysql-test/suite/innodb_fts/t/savepoint.test b/mysql-test/suite/innodb_fts/t/savepoint.test index 09ccb383bb9..ae83c23d20c 100644 --- a/mysql-test/suite/innodb_fts/t/savepoint.test +++ b/mysql-test/suite/innodb_fts/t/savepoint.test @@ -366,12 +366,28 @@ TRUNCATE TABLE articles; INSERT INTO articles(id, title) VALUES(1, 'mysql'); +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; BEGIN; +INSERT INTO t SET a=1; +SAVEPOINT t; +INSERT INTO articles(id, title) VALUES(2, 'mysql'); +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); +ROLLBACK TO SAVEPOINT t; +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); +SELECT * FROM t; +COMMIT; +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); + +BEGIN; +INSERT INTO t SET a=2; INSERT INTO articles(id, title) VALUES(2, 'mysql'); ROLLBACK; +SELECT * FROM t; +DROP TABLE t; + INSERT INTO articles(id, title) VALUES(3, 'mysql'); SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); diff --git a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result index 0d9fdbde86f..d3a8358da38 100644 --- a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result @@ -91,7 +91,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Got error 42 'Tablespace not found' from ./test/t1.ibd +ERROR HY000: Got error 41 'Tablespace not found' from ./test/t1.ibd SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; diff --git a/mysql-test/suite/maria/aria_sort_buffer.result b/mysql-test/suite/maria/aria_sort_buffer.result index 5db9b9d7d44..a9e06cc3db3 100644 --- a/mysql-test/suite/maria/aria_sort_buffer.result +++ b/mysql-test/suite/maria/aria_sort_buffer.result @@ -5,6 +5,8 @@ Note 1105 Cast to unsigned converted negative integer to it's positive complemen Note 1105 Cast to unsigned converted negative integer to it's positive complement Warning 1292 Truncated incorrect aria_sort_buffer_size value: '18446744073709551615' SET SESSION tmp_table_size=65535; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '65535' CREATE TABLE t1 (a VARCHAR(255)); insert into t1 (a) select seq from seq_1_to_1000; UPDATE t1 SET a=( (SELECT MAX(a) FROM t1)); diff --git a/mysql-test/suite/maria/repair-big-sort.result b/mysql-test/suite/maria/repair-big-sort.result index a650a3872d3..d1dfe3f7c2f 100644 --- a/mysql-test/suite/maria/repair-big-sort.result +++ b/mysql-test/suite/maria/repair-big-sort.result @@ -2,6 +2,8 @@ SET sql_mode=''; CREATE TEMPORARY TABLE t1 (a tinyINT,b CHAR(1)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; INSERT INTO t1 VALUES (1,1),(3,3),(2,2); SET SESSION tmp_table_size=True; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1' CREATE TABLE t2 (c INT, d DATE) ENGINE=InnoDB PARTITION BY RANGE (YEAR (d)) SUBPARTITION BY HASH (TO_DAYS (d)) (PARTITION p0 VALUES LESS THAN (1990) (SUBPARTITION s0, SUBPARTITION s1), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION s4, SUBPARTITION s5)); SET SESSION aria_sort_buffer_size=CAST(-1 AS UNSIGNED INT); Warnings: diff --git a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test index 75c56877404..2607bc44a4f 100644 --- a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test +++ b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test @@ -2,6 +2,9 @@ --source include/have_innodb.inc --source include/have_debug.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log --echo *** Test all-to-all replication with --gtid-ignore-duplicates *** diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result index 6cd4c4991b7..84265955dc6 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = InnoDB, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = InnoDB, @@ -987,7 +987,6 @@ a b 2001 Second in MAX ALTER TABLE t1 ANALYZE PARTITION MAX; Table Op Msg_type Msg_text -mysql_test_db.t1 analyze status Engine-independent statistics collected mysql_test_db.t1 analyze status OK # Truncate without FLUSH ALTER TABLE t1 TRUNCATE PARTITION MAX; diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result index d1b7a599923..5e089f2d2b5 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MEMORY, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MEMORY, @@ -987,7 +987,6 @@ a b 2001 Second in MAX ALTER TABLE t1 ANALYZE PARTITION MAX; Table Op Msg_type Msg_text -mysql_test_db.t1 analyze status Engine-independent statistics collected mysql_test_db.t1 analyze note The storage engine for the table doesn't support analyze # Truncate without FLUSH ALTER TABLE t1 TRUNCATE PARTITION MAX; diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result index ad83e95929a..26f168e3734 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MyISAM, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MyISAM, @@ -987,7 +987,6 @@ a b 2001 Second in MAX ALTER TABLE t1 ANALYZE PARTITION MAX; Table Op Msg_type Msg_text -mysql_test_db.t1 analyze status Engine-independent statistics collected mysql_test_db.t1 analyze status OK # Truncate without FLUSH ALTER TABLE t1 TRUNCATE PARTITION MAX; diff --git a/mysql-test/suite/perfschema/r/misc_session_status.result b/mysql-test/suite/perfschema/r/misc_session_status.result index 3ce472fc617..2133b064eb2 100644 --- a/mysql-test/suite/perfschema/r/misc_session_status.result +++ b/mysql-test/suite/perfschema/r/misc_session_status.result @@ -7,7 +7,6 @@ select * from performance_schema.session_status limit 0; VARIABLE_NAME VARIABLE_VALUE set max_session_mem_used=32768; select * from performance_schema.session_status; -ERROR HY000: The MariaDB server is running with the --max-session-mem-used=32768 option so it cannot execute this statement set global innodb_io_capacity_max=100; Warnings: Warning 1210 Setting innodb_io_capacity_max 100 lower than innodb_io_capacity 200. diff --git a/mysql-test/suite/perfschema/t/misc_session_status.test b/mysql-test/suite/perfschema/t/misc_session_status.test index c9e7d066b0c..afb08eb4e9d 100644 --- a/mysql-test/suite/perfschema/t/misc_session_status.test +++ b/mysql-test/suite/perfschema/t/misc_session_status.test @@ -10,9 +10,11 @@ set @old_innodb_io_capacity=@@global.innodb_io_capacity; set @old_innodb_io_capacity_max=@@global.innodb_io_capacity_max; select * from performance_schema.session_status limit 0; # discover the table set max_session_mem_used=32768; ---error ER_OPTION_PREVENTS_STATEMENT +--disable_result_log +--error 0,ER_OPTION_PREVENTS_STATEMENT # this used to crash, when OOM happened under LOCK_thd_kill select * from performance_schema.session_status; +--enable_result_log # this used to cause mutex lock order violation when OOM happened under LOCK_global_system_variables set global innodb_io_capacity_max=100; set max_session_mem_used=default; diff --git a/mysql-test/suite/plugins/r/server_audit_pwd_mask.result b/mysql-test/suite/plugins/r/server_audit_pwd_mask.result index ce90230f1ea..8068bbcf4d8 100644 --- a/mysql-test/suite/plugins/r/server_audit_pwd_mask.result +++ b/mysql-test/suite/plugins/r/server_audit_pwd_mask.result @@ -30,4 +30,13 @@ DROP USER u2; set global server_audit_logging=off; UNINSTALL PLUGIN ed25519; UNINSTALL PLUGIN server_audit; +# +# MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing +# +INSTALL PLUGIN server_audit SONAME 'server_audit'; +SET GLOBAL server_audit_logging=ON; +SET STATEMENT max_error_count=1 SELECT 1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1' at line 1 +SET GLOBAL server_audit_logging=OFF; +UNINSTALL SONAME 'server_audit'; # end of 10.5 tests diff --git a/mysql-test/suite/plugins/t/server_audit_pwd_mask.test b/mysql-test/suite/plugins/t/server_audit_pwd_mask.test index b393e22d11e..fe660795ab3 100644 --- a/mysql-test/suite/plugins/t/server_audit_pwd_mask.test +++ b/mysql-test/suite/plugins/t/server_audit_pwd_mask.test @@ -56,4 +56,20 @@ UNINSTALL PLUGIN ed25519; UNINSTALL PLUGIN server_audit; --enable_warnings +--echo # +--echo # MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing +--echo # + +INSTALL PLUGIN server_audit SONAME 'server_audit'; +SET GLOBAL server_audit_logging=ON; + +--ERROR ER_PARSE_ERROR +SET STATEMENT max_error_count=1 SELECT 1; + +# Cleanup +SET GLOBAL server_audit_logging=OFF; +--disable_warnings +UNINSTALL SONAME 'server_audit'; +--enable_warnings + --echo # end of 10.5 tests diff --git a/mysql-test/suite/rpl/r/rpl_binlog_errors.result b/mysql-test/suite/rpl/r/rpl_binlog_errors.result index 0c79b079bd6..442b2a5da1d 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_errors.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result @@ -26,7 +26,6 @@ RESET MASTER; SET @@global.debug_dbug="d,error_unique_log_filename"; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show one binlog show binary logs; Log_name File_size @@ -52,7 +51,6 @@ RESET MASTER; SET @@global.debug_dbug="d,error_unique_log_filename"; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show one entry SELECT count(*) FROM t2; count(*) @@ -78,7 +76,6 @@ LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; INSERT INTO t2 VALUES ('muse'); COMMIT; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show three entries SELECT count(*) FROM t2; count(*) @@ -95,7 +92,6 @@ count(*) 0 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show 1 entry SELECT count(*) FROM t4; count(*) @@ -118,13 +114,10 @@ count(*) 0 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # INFO: Count(*) Before Offending DELETEs # assert: must show 1 entry SELECT count(*) FROM t4; @@ -136,10 +129,8 @@ count(*) 4 DELETE FROM t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - DELETE FROM t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # INFO: Count(*) After Offending DELETEs # assert: must show zero entries SELECT count(*) FROM t4; diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result index 7ade3067eae..39ebb85b9e9 100644 --- a/mysql-test/suite/rpl/r/rpl_checksum.result +++ b/mysql-test/suite/rpl/r/rpl_checksum.result @@ -178,7 +178,6 @@ SET @old_dbug= @@GLOBAL.debug_dbug; SET debug_dbug= '+d,binlog_inject_new_name_error'; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - SET debug_dbug= @old_dbug; INSERT INTO t4 VALUES (2); connection slave; diff --git a/mysql-test/suite/rpl/r/rpl_from_mysql80.result b/mysql-test/suite/rpl/r/rpl_from_mysql80.result new file mode 100644 index 00000000000..95ce1a78cfb --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_from_mysql80.result @@ -0,0 +1,56 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +connection master; +include/rpl_stop_server.inc [server_number=1] +include/rpl_start_server.inc [server_number=1] +connection slave; +CHANGE MASTER TO Master_log_file='master-bin.000001', Master_log_pos=4, Master_use_gtid=No; +START SLAVE IO_THREAD; +include/wait_for_slave_io_to_start.inc +START SLAVE UNTIL Master_log_file='master-bin.000001', Master_log_pos= 1178; +SELECT MASTER_POS_WAIT('master-bin.000001', 1178, 60); +MASTER_POS_WAIT('master-bin.000001', 1178, 60) +NULL +SELECT * FROM t1 ORDER BY a; +a b c +1 0 +2 0 hulu +3 0 bulu +include/wait_for_slave_sql_to_stop.inc +START SLAVE; +include/wait_for_slave_sql_error.inc [errno=1594] +STOP SLAVE IO_THREAD; +include/wait_for_slave_io_to_stop.inc +CHANGE MASTER TO Master_log_file='master-bin.000001', Master_log_pos=2297; +Warnings: +Note 4190 CHANGE MASTER TO is implicitly changing the value of 'Using_Gtid' from 'No' to 'No' +START SLAVE IO_THREAD; +START SLAVE SQL_THREAD; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_error.inc [errno=1594] +SELECT * FROM t1 ORDER BY a; +a b c +1 0 +2 0 hulu +3 0 bulu +4 0 skip +5 0 after compressed +SELECT * FROM t2 ORDER BY a; +a b +1 {"a": "hulu", "b": "[zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy][zyzzy]", "c": "bulu"} +STOP SLAVE IO_THREAD; +include/wait_for_slave_io_to_stop.inc +CHANGE MASTER TO Master_log_file='master-bin.000002', Master_log_pos=4; +Warnings: +Note 4190 CHANGE MASTER TO is implicitly changing the value of 'Using_Gtid' from 'No' to 'No' +START SLAVE IO_THREAD; +START SLAVE SQL_THREAD; +include/wait_for_slave_io_to_start.inc +include/wait_for_slave_sql_to_start.inc +DROP TABLE t1, t2; +CALL mtr.add_suppression('TRANSACTION_PAYLOAD_EVENT event. You can avoid this event by specifying'); +CALL mtr.add_suppression('PARTIAL_UPDATE_ROWS_EVENT event. You can avoid this event by specifying'); +connection master; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mark_optimize_tbl_ddl.result b/mysql-test/suite/rpl/r/rpl_mark_optimize_tbl_ddl.result index 09edd28827b..6296196104b 100644 --- a/mysql-test/suite/rpl/r/rpl_mark_optimize_tbl_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_mark_optimize_tbl_ddl.result @@ -36,9 +36,9 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK FLUSH LOGS; -FOUND 1 /GTID 0-1-8 ddl/ in mysqlbinlog.out FOUND 1 /GTID 0-1-9 ddl/ in mysqlbinlog.out FOUND 1 /GTID 0-1-10 ddl/ in mysqlbinlog.out +FOUND 1 /GTID 0-1-11 ddl/ in mysqlbinlog.out # # Clean up # @@ -63,9 +63,9 @@ ALTER TABLE t1 REPAIR PARTITION p0; Table Op Msg_type Msg_text test.t1 repair status OK FLUSH LOGS; -FOUND 1 /GTID 0-1-14 ddl/ in mysqlbinlog.out FOUND 1 /GTID 0-1-15 ddl/ in mysqlbinlog.out FOUND 1 /GTID 0-1-16 ddl/ in mysqlbinlog.out +FOUND 1 /GTID 0-1-17 ddl/ in mysqlbinlog.out # # Clean up # diff --git a/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result b/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result index 696eb8d867b..6fafa256b77 100644 --- a/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result +++ b/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result @@ -32,6 +32,7 @@ insert into t1 set a = 2; insert into t1 set a = 1; include/save_master_gtid.inc connection slave; +SET @@global.gtid_cleanup_batch_size = $val; CHANGE MASTER TO master_use_gtid= no; include/start_slave.inc include/sync_with_master_gtid.inc @@ -56,6 +57,7 @@ set statement sql_log_bin=0 for delete from mysql.gtid_slave_pos; insert into mysql.gtid_slave_pos values (99 + 2, 1, 1, 1); # 5. include/rpl_restart_server.inc [server_number=2] +SET @@global.gtid_cleanup_batch_size = $val; select * from mysql.gtid_slave_pos; domain_id sub_id server_id seq_no 101 1 1 1 @@ -100,6 +102,7 @@ set statement sql_log_bin=0 for delete from mysql.gtid_slave_pos; insert into mysql.gtid_slave_pos values (99 + 1, 1, 1, 1); # 5. include/rpl_restart_server.inc [server_number=2] +SET @@global.gtid_cleanup_batch_size = $val; select * from mysql.gtid_slave_pos; domain_id sub_id server_id seq_no 100 1 1 1 @@ -146,5 +149,6 @@ connection master; DROP TABLE t1; include/save_master_gtid.inc connection slave; +SET @@global.gtid_cleanup_batch_size= $old_gtid_cleanup_batch_size; include/sync_with_master_gtid.inc include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_from_mysql80.test b/mysql-test/suite/rpl/t/rpl_from_mysql80.test new file mode 100644 index 00000000000..ec4a22056f9 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_from_mysql80.test @@ -0,0 +1,121 @@ +--source include/have_innodb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +# Test some replication events from MySQL 8.0 to MariaDB. +# Works by copying in a binlog generated by MySQL 8.0. +# The binlog was generated by the following test case. Note that after +# re-generating this, values for Master_log_pos below may need updating, check +# mysqlbinlog for the correct new values. +# +# The latin1 character set is needed since MariaDB currently does not support +# the default MySQL character set. The binlog_format=statement is needed due to +# missing support for the JSON type in row events. These can be removed once +# support is added in MariaDB. +# +# --source include/not_group_replication_plugin.inc +# --source include/have_binlog_format_row.inc +# --source include/master-slave.inc +# +# --connection master +# SET NAMES 'latin1'; +# SET SESSION collation_server= 'latin1_swedish_ci'; +# CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c VARCHAR(1024)) ENGINE=InnoDB CHARACTER SET latin1; +# INSERT INTO t1 VALUES (1, 0, ''); +# BEGIN; +# INSERT INTO t1 VALUES (2, 0, 'hulu'); +# INSERT INTO t1 VALUES (3, 0, 'bulu'); +# COMMIT; +# INSERT INTO t1 VALUES (4, 0, 'skip'); +# +# SET SESSION binlog_transaction_compression= 1; +# BEGIN; +# --disable_query_log +# --let $i= 0 +# while ($i < 100) { +# eval INSERT INTO t1 VALUES ($i+1000, $i, CONCAT("--", $i, "--", REPEAT("\\/", 100), "--")); +# inc $i; +# } +# --enable_query_log +# COMMIT; +# SET SESSION binlog_transaction_compression= default; +# +# INSERT INTO t1 VALUES (5, 0, 'after compressed'); +# SET SESSION binlog_row_value_options= PARTIAL_JSON; +# CREATE TABLE t2 (a INT PRIMARY KEY, b JSON) ENGINE=InnoDB; +# SET SESSION binlog_format=statement; +# INSERT INTO t2 VALUES (1, CONCAT('{"a": "hulu", "b": "', REPEAT("[zyzzy]", 100), '", "c": "bulu"}')); +# SET SESSION binlog_format=row; +# UPDATE t2 SET b=JSON_REPLACE(b, '$.b', REPEAT("oOo", 50)); +# SET SESSION binlog_row_value_options= DEFAULT; +# --sync_slave_with_master +# +# --connection master +# SET sql_log_bin= 0; +# FLUSH BINARY LOGS; +# SET sql_log_bin= 1; +# DROP TABLE t1, t2; +# --source include/rpl_end.inc + + +--connection slave +--source include/stop_slave.inc + +--connection master +--let $datadir= `SELECT @@datadir` +--let $rpl_server_number= 1 +--source include/rpl_stop_server.inc + +# Copy in the MySQL 8.0 generated binlog. +--remove_file $datadir/master-bin.000001 +--copy_file $MYSQL_TEST_DIR/std_data/mdev35643_mysql_80_binlog.000001 $datadir/master-bin.000001 + +--source include/rpl_start_server.inc + +--save_master_pos + +--connection slave +CHANGE MASTER TO Master_log_file='master-bin.000001', Master_log_pos=4, Master_use_gtid=No; +START SLAVE IO_THREAD; +--source include/wait_for_slave_io_to_start.inc +# The position 1178 is the start of: INSERT INTO t1 VALUES (4, 0, 'skip'); +# After that comes unknown MySQL 8.0 events, which we test error for below. +START SLAVE UNTIL Master_log_file='master-bin.000001', Master_log_pos= 1178; +SELECT MASTER_POS_WAIT('master-bin.000001', 1178, 60); +SELECT * FROM t1 ORDER BY a; + +--source include/wait_for_slave_sql_to_stop.inc + +START SLAVE; +--let $slave_sql_errno= 1594 +--source include/wait_for_slave_sql_error.inc + +STOP SLAVE IO_THREAD; +--source include/wait_for_slave_io_to_stop.inc +# The position 2298 is the start of: INSERT INTO t1 VALUES (5, 0, 'after compressed'); +CHANGE MASTER TO Master_log_file='master-bin.000001', Master_log_pos=2297; +START SLAVE IO_THREAD; +START SLAVE SQL_THREAD; +--source include/wait_for_slave_io_to_start.inc +--let $slave_sql_errno= 1594 +--source include/wait_for_slave_sql_error.inc + +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; + +STOP SLAVE IO_THREAD; +--source include/wait_for_slave_io_to_stop.inc +# Restart replication after the MySQL 8.0 file. +CHANGE MASTER TO Master_log_file='master-bin.000002', Master_log_pos=4; +START SLAVE IO_THREAD; +START SLAVE SQL_THREAD; +--source include/wait_for_slave_io_to_start.inc +--source include/wait_for_slave_sql_to_start.inc +--sync_with_master + +DROP TABLE t1, t2; +CALL mtr.add_suppression('TRANSACTION_PAYLOAD_EVENT event. You can avoid this event by specifying'); +CALL mtr.add_suppression('PARTIAL_UPDATE_ROWS_EVENT event. You can avoid this event by specifying'); + +--connection master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mark_optimize_tbl_ddl.test b/mysql-test/suite/rpl/t/rpl_mark_optimize_tbl_ddl.test index 6d66e3fd088..4c9b57e4bda 100644 --- a/mysql-test/suite/rpl/t/rpl_mark_optimize_tbl_ddl.test +++ b/mysql-test/suite/rpl/t/rpl_mark_optimize_tbl_ddl.test @@ -22,6 +22,10 @@ --let $rpl_topology=1->2 --source include/rpl_init.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connection server_1 FLUSH TABLES; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; diff --git a/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test b/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test index 464f68723f9..cd25949c16b 100644 --- a/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test +++ b/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test @@ -47,6 +47,12 @@ while ($i) --source include/save_master_gtid.inc --connection slave +# enforce determistic SELECT * from mysql.gtid_slave_pos +--let $old_gtid_cleanup_batch_size = `select @@GLOBAL.gtid_cleanup_batch_size` +# the number of generated transactions on master must not exceed this value: +--let $val= 2147483647 +--evalp SET @@global.gtid_cleanup_batch_size = $val + # due to MDEV-19801 on 10+.10+ CHANGE MASTER TO master_use_gtid= no; --source include/start_slave.inc @@ -87,6 +93,7 @@ while ($i) --echo # 5. --let $rpl_server_number= 2 --source include/rpl_restart_server.inc + --evalp SET @@global.gtid_cleanup_batch_size = $val select * from mysql.gtid_slave_pos; select @@global.gtid_slave_pos as "before dump restore"; --let $dump=dump_$i.sql @@ -132,6 +139,7 @@ DROP TABLE t1; --source include/save_master_gtid.inc --connection slave +--evalp SET @@global.gtid_cleanup_batch_size= $old_gtid_cleanup_batch_size --remove_files_wildcard $MYSQLTEST_VARDIR/tmp dump_*.sql --source include/sync_with_master_gtid.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim.test b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim.test index ab634d2953e..c1876a43dca 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim.test @@ -2,6 +2,9 @@ --source include/have_debug.inc --source include/master-slave.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log --echo MDEV-31655: Parallel replication deadlock victim preference code erroneously removed # The problem was that InnoDB would choose the wrong deadlock victim. diff --git a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim2.test b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim2.test index 522cec18bbc..68d5ad6a481 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim2.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim2.test @@ -3,6 +3,10 @@ --source include/have_debug.inc --source include/have_binlog_format_statement.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connection master ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; CREATE TABLE t1(a INT) ENGINE=INNODB; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test b/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test index 90304937445..532eb58571c 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test @@ -5,6 +5,10 @@ --source include/have_debug_sync.inc --source include/master-slave.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connection server_2 SET sql_log_bin=0; CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test index 2cf18cd2756..dc0b741eb33 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test @@ -7,6 +7,9 @@ call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); call mtr.add_suppression("Can't find record in 't1'"); call mtr.add_suppression("Can't find record in 't2'"); +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log --connection server_1 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic_nobinlog.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic_nobinlog.test index b8df2ffae46..df30916a6ce 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_optimistic_nobinlog.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic_nobinlog.test @@ -3,6 +3,10 @@ --let $rpl_topology=1->2 --source include/rpl_init.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connection server_1 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_xa_same_xid.test b/mysql-test/suite/rpl/t/rpl_parallel_xa_same_xid.test index 888dd2f177b..17c404adef8 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_xa_same_xid.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_xa_same_xid.test @@ -9,6 +9,10 @@ --source include/have_perfschema.inc --source include/master-slave.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --let $xid_num = 19 --let $repeat = 17 --let $workers = 7 diff --git a/mysql-test/suite/rpl/t/rpl_temporary_error2.test b/mysql-test/suite/rpl/t/rpl_temporary_error2.test index 3537499d562..23a84a02760 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_error2.test +++ b/mysql-test/suite/rpl/t/rpl_temporary_error2.test @@ -2,6 +2,9 @@ --source include/master-slave.inc call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log --echo *** Provoke a deadlock on the slave, check that transaction retry succeeds. *** --connection master diff --git a/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result index 6da4c9bfe97..32e1c9965d6 100644 --- a/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result +++ b/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result @@ -22,13 +22,13 @@ Warnings: Warning 1292 Truncated incorrect aria_sort_buffer_size value: '10' select @@global.aria_sort_buffer_size; @@global.aria_sort_buffer_size -16376 +16352 set session aria_sort_buffer_size=10; Warnings: Warning 1292 Truncated incorrect aria_sort_buffer_size value: '10' select @@session.aria_sort_buffer_size; @@session.aria_sort_buffer_size -16376 +16352 set global aria_sort_buffer_size=1.1; ERROR 42000: Incorrect argument type to variable 'aria_sort_buffer_size' set session aria_sort_buffer_size=1e1; @@ -40,7 +40,7 @@ Warnings: Warning 1292 Truncated incorrect aria_sort_buffer_size value: '0' select @@global.aria_sort_buffer_size; @@global.aria_sort_buffer_size -16376 +16352 set session aria_sort_buffer_size=cast(-1 as unsigned int); select @@session.aria_sort_buffer_size; @@session.aria_sort_buffer_size diff --git a/mysql-test/suite/sys_vars/r/maximum_basic.result b/mysql-test/suite/sys_vars/r/maximum_basic.result index becd6da91f4..2a5c3e2a70c 100644 --- a/mysql-test/suite/sys_vars/r/maximum_basic.result +++ b/mysql-test/suite/sys_vars/r/maximum_basic.result @@ -9,7 +9,7 @@ Warnings: Warning 1292 Truncated incorrect tmp_table_size value: '40960' SELECT @@session.tmp_table_size; @@session.tmp_table_size -8192 +16384 SET @@session.max_join_size=40960; Warnings: Warning 1292 Truncated incorrect max_join_size value: '40960' diff --git a/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic.result b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic.result index accabb34dbe..2f49ab15705 100644 --- a/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic.result +++ b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic.result @@ -1,11 +1,11 @@ SET @start_global_value = @@global.query_alloc_block_size; SELECT @start_global_value; @start_global_value -16384 +32768 SET @start_session_value = @@session.query_alloc_block_size; SELECT @start_session_value; @start_session_value -16384 +32768 '#--------------------FN_DYNVARS_130_01-------------------------#' SET @@global.query_alloc_block_size = 10000; Warnings: @@ -13,22 +13,22 @@ Warning 1292 Truncated incorrect query_alloc_block_size value: '10000' SET @@global.query_alloc_block_size = DEFAULT; SELECT @@global.query_alloc_block_size; @@global.query_alloc_block_size -16384 +32768 SET @@session.query_alloc_block_size = 20000; Warnings: Warning 1292 Truncated incorrect query_alloc_block_size value: '20000' SET @@session.query_alloc_block_size = DEFAULT; SELECT @@session.query_alloc_block_size; @@session.query_alloc_block_size -16384 +32768 '#--------------------FN_DYNVARS_130_02-------------------------#' SET @@global.query_alloc_block_size = DEFAULT; -SELECT @@global.query_alloc_block_size = 16384; -@@global.query_alloc_block_size = 16384 +SELECT @@global.query_alloc_block_size = 32768; +@@global.query_alloc_block_size = 32768 1 SET @@session.query_alloc_block_size = DEFAULT; -SELECT @@session.query_alloc_block_size = 16384; -@@session.query_alloc_block_size = 16384 +SELECT @@session.query_alloc_block_size = 32768; +@@session.query_alloc_block_size = 32768 1 '#--------------------FN_DYNVARS_130_03-------------------------#' SET @@global.query_alloc_block_size = 1024; @@ -177,8 +177,8 @@ ERROR 42S22: Unknown column 'query_alloc_block_size' in 'SELECT' SET @@global.query_alloc_block_size = @start_global_value; SELECT @@global.query_alloc_block_size; @@global.query_alloc_block_size -16384 +32768 SET @@session.query_alloc_block_size = @start_session_value; SELECT @@session.query_alloc_block_size; @@session.query_alloc_block_size -16384 +32768 diff --git a/mysql-test/suite/sys_vars/r/query_prealloc_size_basic.result b/mysql-test/suite/sys_vars/r/query_prealloc_size_basic.result index 23cb61f0849..9e02be78b8b 100644 --- a/mysql-test/suite/sys_vars/r/query_prealloc_size_basic.result +++ b/mysql-test/suite/sys_vars/r/query_prealloc_size_basic.result @@ -1,11 +1,11 @@ SET @start_global_value = @@global.query_prealloc_size ; SELECT @start_global_value; @start_global_value -24576 +32768 SET @start_session_value = @@session.query_prealloc_size ; SELECT @start_session_value; @start_session_value -24576 +32768 '#--------------------FN_DYNVARS_005_01-------------------------#' SET @@global.query_prealloc_size = 100; Warnings: @@ -13,22 +13,22 @@ Warning 1292 Truncated incorrect query_prealloc_size value: '100' SET @@global.query_prealloc_size = DEFAULT; SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size -24576 +32768 SET @@session.query_prealloc_size = 200; Warnings: Warning 1292 Truncated incorrect query_prealloc_size value: '200' SET @@session.query_prealloc_size = DEFAULT; SELECT @@session.query_prealloc_size ; @@session.query_prealloc_size -24576 +32768 '#--------------------FN_DYNVARS_005_02-------------------------#' SET @@global.query_prealloc_size = DEFAULT; -SELECT @@global.query_prealloc_size = 24576; -@@global.query_prealloc_size = 24576 +SELECT @@global.query_prealloc_size = 32768; +@@global.query_prealloc_size = 32768 1 SET @@session.query_prealloc_size = DEFAULT; -SELECT @@session.query_prealloc_size = 24576; -@@session.query_prealloc_size = 24576 +SELECT @@session.query_prealloc_size = 32768; +@@session.query_prealloc_size = 32768 1 '#--------------------FN_DYNVARS_005_03-------------------------#' SET @@global.query_prealloc_size = 8192; @@ -163,8 +163,8 @@ ERROR 42S22: Unknown column 'query_prealloc_size' in 'SELECT' SET @@global.query_prealloc_size = @start_global_value; SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size -24576 +32768 SET @@session.query_prealloc_size = @start_session_value; SELECT @@session.query_prealloc_size ; @@session.query_prealloc_size -24576 +32768 diff --git a/mysql-test/suite/sys_vars/r/sysvars_aria,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_aria,32bit.rdiff index f7d64b784d3..495fd50b7c2 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_aria,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_aria,32bit.rdiff @@ -1,5 +1,5 @@ ---- a/mysql-test/suite/sys_vars/r/sysvars_aria.result -+++ b/mysql-test/suite/sys_vars/r/sysvars_aria.result +--- suite/sys_vars/r/sysvars_aria.result ++++ suite/sys_vars/r/sysvars_aria,32bit.reject @@ -5,7 +5,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 8192 diff --git a/mysql-test/suite/sys_vars/r/sysvars_aria.result b/mysql-test/suite/sys_vars/r/sysvars_aria.result index 427eb83c949..58aae0fc664 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_aria.result +++ b/mysql-test/suite/sys_vars/r/sysvars_aria.result @@ -223,7 +223,7 @@ DEFAULT_VALUE 268434432 VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE. -NUMERIC_MIN_VALUE 16376 +NUMERIC_MIN_VALUE 16352 NUMERIC_MAX_VALUE 1152921504606846975 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 0417b41b80f..b511a77117d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -226,7 +226,7 @@ VARIABLE_NAME ARIA_SORT_BUFFER_SIZE VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE. -NUMERIC_MIN_VALUE 16376 +NUMERIC_MIN_VALUE 16352 NUMERIC_MAX_VALUE 1152921504606846975 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL @@ -3968,7 +3968,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 18446744073709551615 -NUMERIC_BLOCK_SIZE 1 +NUMERIC_BLOCK_SIZE 16384 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED @@ -3978,7 +3978,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 18446744073709551615 -NUMERIC_BLOCK_SIZE 1 +NUMERIC_BLOCK_SIZE 16384 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 2cc1a6ba763..2edbc327b25 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -226,7 +226,7 @@ VARIABLE_NAME ARIA_SORT_BUFFER_SIZE VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE. -NUMERIC_MIN_VALUE 16376 +NUMERIC_MIN_VALUE 16352 NUMERIC_MAX_VALUE 1152921504606846975 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL @@ -4828,7 +4828,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 18446744073709551615 -NUMERIC_BLOCK_SIZE 1 +NUMERIC_BLOCK_SIZE 16384 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED @@ -4838,7 +4838,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 18446744073709551615 -NUMERIC_BLOCK_SIZE 1 +NUMERIC_BLOCK_SIZE 16384 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_wsrep,32bit.rdiff index 94292859590..5de35b7e0e8 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_wsrep,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep,32bit.rdiff @@ -1,5 +1,5 @@ ---- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result -+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result +--- suite/sys_vars/r/sysvars_wsrep.result ++++ suite/sys_vars/r/sysvars_wsrep,32bit.reject @@ -307,7 +307,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 diff --git a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result index 7b26106384b..c0866cfec6a 100644 --- a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result +++ b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result @@ -3,7 +3,7 @@ SET @start_tmp_memory_table_size=@@session.tmp_memory_table_size; SET @start_tmp_disk_table_size=@@session.tmp_disk_table_size; -set @@session.tmp_memory_table_size=1000; +set @@session.tmp_memory_table_size=16384; set @@session.tmp_disk_table_size=3000000; create table t1 (a int primary key, b varchar(2000)); insert into t1 select seq,repeat(char(mod(seq,62)+64),seq) from seq_1_to_2000; diff --git a/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result index 8d36354a7bb..4049e7e8c3a 100644 --- a/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result +++ b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result @@ -168,7 +168,6 @@ SET @@global.transaction_alloc_block_size = @start_global_value; SELECT @@global.transaction_alloc_block_size; @@global.transaction_alloc_block_size 8192 -SET @@session.tmp_table_size = @start_session_value; SELECT @@session.transaction_alloc_block_size; @@session.transaction_alloc_block_size 1024 diff --git a/mysql-test/suite/sys_vars/t/maximum_basic-master.opt b/mysql-test/suite/sys_vars/t/maximum_basic-master.opt index 16e365d491c..db0ee8b60c4 100644 --- a/mysql-test/suite/sys_vars/t/maximum_basic-master.opt +++ b/mysql-test/suite/sys_vars/t/maximum_basic-master.opt @@ -1,5 +1,5 @@ --maximum-auto-increment-increment=8192 ---maximum-tmp-table-size=8192 +--maximum-tmp-table-size=16384 --maximum-max-join-size=8192 --maximum-use-stat-tables=COMPLEMENTARY --maximum-sql-mode='REAL_AS_FLOAT,ANSI_QUOTES' diff --git a/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test b/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test index 1793652397f..85c0c34f0ac 100644 --- a/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test +++ b/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test @@ -60,10 +60,10 @@ SELECT @@session.query_alloc_block_size; ################################################################### SET @@global.query_alloc_block_size = DEFAULT; -SELECT @@global.query_alloc_block_size = 16384; +SELECT @@global.query_alloc_block_size = 32768; SET @@session.query_alloc_block_size = DEFAULT; -SELECT @@session.query_alloc_block_size = 16384; +SELECT @@session.query_alloc_block_size = 32768; --echo '#--------------------FN_DYNVARS_130_03-------------------------#' diff --git a/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test b/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test index 1a6ed56c5f9..6122a288610 100644 --- a/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test +++ b/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test @@ -60,10 +60,10 @@ SELECT @@session.query_prealloc_size ; ######################################################################## SET @@global.query_prealloc_size = DEFAULT; -SELECT @@global.query_prealloc_size = 24576; +SELECT @@global.query_prealloc_size = 32768; SET @@session.query_prealloc_size = DEFAULT; -SELECT @@session.query_prealloc_size = 24576; +SELECT @@session.query_prealloc_size = 32768; --echo '#--------------------FN_DYNVARS_005_03-------------------------#' diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test index c78eac199c3..8eb4a2790fc 100644 --- a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test +++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test @@ -12,7 +12,7 @@ SET @start_tmp_memory_table_size=@@session.tmp_memory_table_size; SET @start_tmp_disk_table_size=@@session.tmp_disk_table_size; -set @@session.tmp_memory_table_size=1000; +set @@session.tmp_memory_table_size=16384; set @@session.tmp_disk_table_size=3000000; --disable_ps2_protocol diff --git a/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test index 0faa95c8fe6..64452ad3f36 100644 --- a/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test +++ b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test @@ -218,11 +218,9 @@ SELECT transaction_alloc_block_size = @@session.transaction_alloc_block_size; SET @@global.transaction_alloc_block_size = @start_global_value; SELECT @@global.transaction_alloc_block_size; -SET @@session.tmp_table_size = @start_session_value; SELECT @@session.transaction_alloc_block_size; ############################################################# # END OF transaction_alloc_block_size TESTS # ############################################################# - diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index f2c7ea370a8..26899493168 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -1146,7 +1146,7 @@ f varchar(45000) partition by system_time interval 1 year (partition p1 history, partition pn current); # fill the table until full -insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); insert into t1 (f) select f from t1; ERROR HY000: The table 't1' is full # leave space for exactly one record in current partition @@ -1162,7 +1162,7 @@ f varchar(45000) ) with system versioning engine=memory partition by system_time interval 1 year (partition p1 history, partition pn current); -insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); select * into outfile 'MDEV-17891.data' from t1; load data infile 'MDEV-17891.data' replace into table t1; load data infile 'MDEV-17891.data' replace into table t1; diff --git a/mysql-test/suite/versioning/r/select2,trx_id.rdiff b/mysql-test/suite/versioning/r/select2,trx_id.rdiff index 45555385c31..561c16d277b 100644 --- a/mysql-test/suite/versioning/r/select2,trx_id.rdiff +++ b/mysql-test/suite/versioning/r/select2,trx_id.rdiff @@ -1,5 +1,5 @@ ---- suite/versioning/r/select2.result 2022-12-12 19:34:34.242342915 +0200 -+++ suite/versioning/r/select2,trx_id.reject 2022-12-12 19:37:18.721907294 +0200 +--- select2.result ++++ select2,trx_id.reject @@ -22,6 +22,8 @@ delete from t1 where x > 7; insert into t1(x, y) values(3, 33); diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 41aa509d5a5..f6b2dcb49f7 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -999,7 +999,7 @@ create or replace table t1 ( partition pn current); --echo # fill the table until full -insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); --error ER_RECORD_FILE_FULL insert into t1 (f) select f from t1; --echo # leave space for exactly one record in current partition @@ -1017,7 +1017,7 @@ create or replace table t1 ( partition by system_time interval 1 year (partition p1 history, partition pn current); -insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); --disable_cursor_protocol --disable_ps2_protocol diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 54361a412d2..87c41b1ab16 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -1,6 +1,10 @@ source suite/versioning/engines.inc; source suite/versioning/common.inc; +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + replace_result $sys_datatype_expl SYS_DATATYPE; eval create table t1( x int unsigned, diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index 7f8c6a43bc8..15836b9a0c2 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -3,6 +3,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep%'; Variable_name Value wsrep_local_state_uuid # wsrep_protocol_version # +wsrep_protocol_application # +wsrep_protocol_replicator # +wsrep_protocol_gcs # wsrep_last_committed # wsrep_replicated # wsrep_replicated_bytes # diff --git a/mysql-test/suite/wsrep/r/variables_debug.result b/mysql-test/suite/wsrep/r/variables_debug.result index d088c4f1714..6c4f8877761 100644 --- a/mysql-test/suite/wsrep/r/variables_debug.result +++ b/mysql-test/suite/wsrep/r/variables_debug.result @@ -3,6 +3,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep%'; Variable_name Value wsrep_local_state_uuid # wsrep_protocol_version # +wsrep_protocol_application # +wsrep_protocol_replicator # +wsrep_protocol_gcs # wsrep_last_committed # wsrep_replicated # wsrep_replicated_bytes # diff --git a/mysql-test/suite/wsrep/r/wsrep_protocol_versions.result b/mysql-test/suite/wsrep/r/wsrep_protocol_versions.result new file mode 100644 index 00000000000..35139f5b9cf --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep_protocol_versions.result @@ -0,0 +1,7 @@ +# Correct Galera library found +show status like 'wsrep_protocol%'; +Variable_name Value +wsrep_protocol_application 4 +wsrep_protocol_gcs 5 +wsrep_protocol_replicator 11 +wsrep_protocol_version 11 diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index c28638e78f1..3f3363d8f26 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -3,7 +3,7 @@ --source include/have_innodb.inc --source include/galera_no_debug_sync.inc ---let $galera_version=26.4.11 +--let $galera_version=26.4.21 source include/check_galera_version.inc; source include/galera_variables_ok.inc; diff --git a/mysql-test/suite/wsrep/t/variables_debug.test b/mysql-test/suite/wsrep/t/variables_debug.test index b218586fea7..29d98f7373d 100644 --- a/mysql-test/suite/wsrep/t/variables_debug.test +++ b/mysql-test/suite/wsrep/t/variables_debug.test @@ -5,7 +5,7 @@ --source include/have_debug_sync.inc --source include/galera_have_debug_sync.inc ---let $galera_version=26.4.11 +--let $galera_version=26.4.21 source include/check_galera_version.inc; source include/galera_variables_ok_debug.inc; diff --git a/mysql-test/suite/wsrep/t/wsrep_protocol_versions.cnf b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.cnf new file mode 100644 index 00000000000..f4d5689404c --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.cnf @@ -0,0 +1,13 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld.1] +wsrep-on=ON +binlog-format=ROW +innodb-flush-log-at-trx-commit=1 +wsrep-cluster-address=gcomm:// +wsrep-provider=@ENV.WSREP_PROVIDER +innodb-autoinc-lock-mode=2 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port diff --git a/mysql-test/suite/wsrep/t/wsrep_protocol_versions.test b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.test new file mode 100644 index 00000000000..f8979050686 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.test @@ -0,0 +1,9 @@ +--source include/have_wsrep.inc +--source include/force_restart.inc +--source include/have_innodb.inc + +--let $galera_version=26.4.21 +source include/check_galera_version.inc; + +--sorted_result +show status like 'wsrep_protocol%'; diff --git a/mysys/array.c b/mysys/array.c index b44d34285fc..dee6459e2e0 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -286,7 +286,7 @@ my_bool allocate_dynamic(DYNAMIC_ARRAY *array, size_t max_elements) if (!(new_ptr= (uchar *) my_malloc(array->m_psi_key, size * array->size_of_element, MYF(array->malloc_flags | MY_WME)))) - DBUG_RETURN(0); + DBUG_RETURN(TRUE); memcpy(new_ptr, array->buffer, array->elements * array->size_of_element); array->malloc_flags&= ~MY_INIT_BUFFER_USED; diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 39c113650da..24a2bab0235 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -151,7 +151,10 @@ void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root, size_t block_size, mem_root->free= mem_root->used= mem_root->pre_alloc= 0; mem_root->min_malloc= 32 + REDZONE_SIZE; - mem_root->block_size= MY_MAX(block_size, ROOT_MIN_BLOCK_SIZE); + + /* Ensure block size is not to small (we need space for memory accounting */ + block_size= MY_MAX(block_size, ROOT_MIN_BLOCK_SIZE); + mem_root->flags= 0; DBUG_ASSERT(!test_all_bits(mem_root->flags, (MY_THREAD_SPECIFIC | MY_ROOT_USE_MPROTECT))); @@ -270,7 +273,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) reg2 USED_MEM **prev; size_t original_length __attribute__((unused)) = length; DBUG_ENTER("alloc_root"); - DBUG_PRINT("enter",("root: %p", mem_root)); + DBUG_PRINT("enter",("root: %p length: %zu", mem_root, length)); DBUG_ASSERT(alloc_root_inited(mem_root)); DBUG_ASSERT((mem_root->flags & ROOT_FLAG_READ_ONLY) == 0); @@ -311,8 +314,8 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) (*prev)->left < ALLOC_MAX_BLOCK_TO_DROP) { next= *prev; - *prev= next->next; /* Remove block from list */ - next->next= mem_root->used; + *prev= next->next; /* Remove block from free list */ + next->next= mem_root->used; /* Add to used list */ mem_root->used= next; mem_root->first_block_usage= 0; } @@ -337,21 +340,27 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) DBUG_RETURN((void*) 0); /* purecov: inspected */ } mem_root->block_num++; - next->next= *prev; + DBUG_ASSERT(*prev == 0); + next->next= 0; next->size= alloced_length; next->left= alloced_length - ALIGN_SIZE(sizeof(USED_MEM)); - *prev=next; + *prev= next; TRASH_MEM(next); } + else + { + /* Reset first_block_usage if we used the first block */ + if (prev == &mem_root->free) + mem_root->first_block_usage= 0; + } point= (uchar*) ((char*) next+ (next->size-next->left)); - /*TODO: next part may be unneded due to mem_root->first_block_usage counter*/ if ((next->left-= length) < mem_root->min_malloc) - { /* Full block */ - *prev= next->next; /* Remove block from list */ + { + /* Full block. Move the block from the free list to the used list */ + *prev= next->next; next->next= mem_root->used; mem_root->used= next; - mem_root->first_block_usage= 0; } point+= REDZONE_SIZE; TRASH_ALLOC(point, original_length); diff --git a/mysys/my_create.c b/mysys/my_create.c index 6fb817da8df..32cc73a53c4 100644 --- a/mysys/my_create.c +++ b/mysys/my_create.c @@ -33,12 +33,12 @@ */ -File my_create(const char *FileName, int CreateFlags, int access_flags, +File my_create(const char *FileName, mode_t CreateFlags, int access_flags, myf MyFlags) { int fd; DBUG_ENTER("my_create"); - DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %lu", + DBUG_PRINT("my",("Name: '%s' CreateFlags: %u AccessFlags: %d MyFlags: %lu", FileName, CreateFlags, access_flags, MyFlags)); #if defined(_WIN32) fd= my_win_open(FileName, access_flags | O_CREAT); diff --git a/mysys/my_default.c b/mysys/my_default.c index 65a876a9e25..e63a3a8abd3 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -410,14 +410,14 @@ int my_load_defaults(const char *conf_file, const char **groups, int *argc, const char **dirs; DBUG_ENTER("my_load_defaults"); - init_alloc_root(key_memory_defaults, &alloc, 512, 0, MYF(0)); + init_alloc_root(key_memory_defaults, &alloc, 4096, 0, MYF(0)); if ((dirs= init_default_directories(&alloc)) == NULL) goto err; args_used= get_defaults_options(*argv); - if (my_init_dynamic_array(key_memory_defaults, &args, sizeof(char*), 128, 64, - MYF(0))) + if (my_init_dynamic_array(key_memory_defaults, &args, sizeof(char*), + DEFAULT_ROOT_BLOCK_SIZE, 0, MYF(0))) goto err; insert_dynamic(&args, *argv);/* Name MUST be set, even by embedded library */ diff --git a/mysys/my_init.c b/mysys/my_init.c index 383d45fbcc6..9c0d1f9957b 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -61,7 +61,7 @@ size_t my_system_page_size= 8192; /* Default if no sysconf() */ ulonglong my_thread_stack_size= (sizeof(void*) <= 4)? 65536: ((256-16)*1024); -static ulong atoi_octal(const char *str) +static mode_t atoi_octal(const char *str) { long int tmp; while (*str && my_isspace(&my_charset_latin1, *str)) @@ -69,7 +69,7 @@ static ulong atoi_octal(const char *str) str2int(str, (*str == '0' ? 8 : 10), /* Octalt or decimalt */ 0, INT_MAX, &tmp); - return (ulong) tmp; + return (mode_t) tmp; } MYSQL_FILE *mysql_stdin= NULL; @@ -162,10 +162,10 @@ my_bool my_init(void) /* Default creation of new files */ if ((str= getenv("UMASK")) != 0) - my_umask= (int) (atoi_octal(str) | 0600); + my_umask= atoi_octal(str) | 0600; /* Default creation of new dir's */ if ((str= getenv("UMASK_DIR")) != 0) - my_umask_dir= (int) (atoi_octal(str) | 0700); + my_umask_dir= atoi_octal(str) | 0700; init_glob_errs(); diff --git a/mysys/my_open.c b/mysys/my_open.c index 4d26a7b250e..182bb149277 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -20,7 +20,7 @@ #include "my_atomic.h" CREATE_NOSYMLINK_FUNCTION( - open_nosymlinks(const char *pathname, int flags, int mode), + open_nosymlinks(const char *pathname, int flags, mode_t mode), openat(dfd, filename, O_NOFOLLOW | flags, mode), open(pathname, O_NOFOLLOW | flags, mode) ); diff --git a/mysys/my_static.c b/mysys/my_static.c index 35e67693e15..782f7ddeda6 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -62,7 +62,7 @@ char curr_dir[FN_REFLEN]= {0}, home_dir_buff[FN_REFLEN]= {0}; ulong my_stream_opened=0,my_tmp_file_created=0; ulong my_file_total_opened= 0; -int my_umask=0664, my_umask_dir=0777; +mode_t my_umask=0664, my_umask_dir=0777; #ifdef _WIN32 SECURITY_ATTRIBUTES my_dir_security_attributes= {sizeof(SECURITY_ATTRIBUTES),NULL,FALSE}; #endif diff --git a/mysys/my_symlink2.c b/mysys/my_symlink2.c index 0b580ecd32f..d9b31e3dfaf 100644 --- a/mysys/my_symlink2.c +++ b/mysys/my_symlink2.c @@ -26,7 +26,7 @@ #include File my_create_with_symlink(const char *linkname, const char *filename, - int createflags, int access_flags, myf MyFlags) + mode_t createflags, int access_flags, myf MyFlags) { File file; int tmp_errno; diff --git a/mysys/thr_timer.c b/mysys/thr_timer.c index 00fc74cdf77..6e9e5a421e0 100644 --- a/mysys/thr_timer.c +++ b/mysys/thr_timer.c @@ -330,8 +330,7 @@ static void *timer_handler(void *arg __attribute__((unused))) } mysql_mutex_unlock(&LOCK_timer); my_thread_end(); - pthread_exit(0); - return 0; /* Impossible */ + return 0; } diff --git a/plugin/auth_gssapi/gssapi_server.cc b/plugin/auth_gssapi/gssapi_server.cc index db7bda9a6b4..8896c39859d 100644 --- a/plugin/auth_gssapi/gssapi_server.cc +++ b/plugin/auth_gssapi/gssapi_server.cc @@ -85,6 +85,15 @@ cleanup: return default_name; } +static void release_service_name() +{ + if (service_name != GSS_C_NO_NAME) + { + OM_uint32 minor; + gss_release_name(&minor, &service_name); + service_name= GSS_C_NO_NAME; + } +} int plugin_init() { @@ -127,6 +136,7 @@ int plugin_init() if (GSS_ERROR(major)) { log_error(major, minor, "gss_acquire_cred failed"); + release_service_name(); return -1; } gss_release_cred(&minor, &cred); @@ -136,11 +146,7 @@ int plugin_init() int plugin_deinit() { - if (service_name != GSS_C_NO_NAME) - { - OM_uint32 minor; - gss_release_name(&minor, &service_name); - } + release_service_name(); return 0; } diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc index 899157b0ae9..8020ae2a9e8 100644 --- a/plugin/feedback/sender_thread.cc +++ b/plugin/feedback/sender_thread.cc @@ -290,7 +290,6 @@ pthread_handler_t background_thread(void *arg __attribute__((unused))) } my_thread_end(); - pthread_exit(0); return 0; } diff --git a/plugin/handler_socket/CMakeLists.txt b/plugin/handler_socket/CMakeLists.txt index 5a1925b40e0..1510dc839a4 100644 --- a/plugin/handler_socket/CMakeLists.txt +++ b/plugin/handler_socket/CMakeLists.txt @@ -6,8 +6,6 @@ IF(WIN32 OR WITHOUT_SERVER) RETURN() ENDIF() -MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated-declarations") - INCLUDE_DIRECTORIES(libhsclient) # Handlersocket client library. We do not distribute it, diff --git a/plugin/handler_socket/handlersocket/database.hpp b/plugin/handler_socket/handlersocket/database.hpp index ed5d00800d9..9e2aadf7380 100644 --- a/plugin/handler_socket/handlersocket/database.hpp +++ b/plugin/handler_socket/handlersocket/database.hpp @@ -9,6 +9,11 @@ #ifndef DENA_DATABASE_HPP #define DENA_DATABASE_HPP +#ifdef __GNUC__ +/* auto_ptr is deprecated */ +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + #include #include #include diff --git a/plugin/handler_socket/libhsclient/hstcpcli.hpp b/plugin/handler_socket/libhsclient/hstcpcli.hpp index fa0d4db1742..d078bdfd533 100644 --- a/plugin/handler_socket/libhsclient/hstcpcli.hpp +++ b/plugin/handler_socket/libhsclient/hstcpcli.hpp @@ -19,6 +19,11 @@ #include "string_ref.hpp" #include "string_buffer.hpp" +#ifdef __GNUC__ +/* auto_ptr is deprecated */ +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + namespace dena { struct hstcpcli_filter { diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index af4de984fe1..43249df744d 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -1782,6 +1782,8 @@ static int filter_query_type(const char *query, struct sa_keyword *kwd) char fword[MAX_KEYWORD + 1], nword[MAX_KEYWORD + 1]; int len, nlen= 0; const struct sa_keyword *l_keywords; + if (!query) + return SQLCOM_NOTHING; while (*query && (is_space(*query) || *query == '(' || *query == '/')) { diff --git a/scripts/mariadb_system_tables.sql b/scripts/mariadb_system_tables.sql index d12f0b48e4f..b3fcce8b6f1 100644 --- a/scripts/mariadb_system_tables.sql +++ b/scripts/mariadb_system_tables.sql @@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=Aria transactional=1 CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci comment='MySQL plugins'; -CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host varchar(2048) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(128) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) engine=Aria transactional=1 CHARACTER SET utf8mb3 comment='MySQL Foreign Servers table'; +CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host varchar(2048) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(128) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(108) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) engine=Aria transactional=1 CHARACTER SET utf8mb3 comment='MySQL Foreign Servers table'; CREATE TABLE IF NOT EXISTS tables_priv ( Host char(255) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(128) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor varchar(384) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') COLLATE utf8mb3_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8mb3_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=Aria transactional=1 CHARACTER SET utf8mb3 COLLATE utf8mb3_bin comment='Table privileges'; diff --git a/scripts/mariadb_system_tables_fix.sql b/scripts/mariadb_system_tables_fix.sql index dfa8b08ec33..1e5dc57bdfe 100644 --- a/scripts/mariadb_system_tables_fix.sql +++ b/scripts/mariadb_system_tables_fix.sql @@ -882,3 +882,7 @@ DELIMITER ; ALTER TABLE servers MODIFY Host varchar(2048) NOT NULL DEFAULT '', MODIFY Owner varchar(512) NOT NULL DEFAULT ''; + +# MDEV-34716 Fix mysql.servers socket max length too short +ALTER TABLE servers + MODIFY Socket char(108) NOT NULL DEFAULT ''; diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index b4eace044be..efda991bdec 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -209,6 +209,7 @@ INNODB_DATA_HOME_DIR=$(trim_dir "${INNODB_DATA_HOME_DIR:-}") INNODB_LOG_GROUP_HOME=$(trim_dir "${INNODB_LOG_GROUP_HOME:-}") INNODB_UNDO_DIR=$(trim_dir "${INNODB_UNDO_DIR:-}") INNODB_BUFFER_POOL="" +INNODB_BUFFER_POOL_SIZE="" INNODB_FORCE_RECOVERY="" INNOEXTRA="" @@ -329,6 +330,10 @@ case "$1" in readonly INNODB_BUFFER_POOL=$(trim_string "$2") shift ;; + '--innodb-buffer-pool-size') + readonly INNODB_BUFFER_POOL_SIZE=$(trim_string "$2") + shift + ;; '--defaults-file') file=$(trim_string "$2") readonly WSREP_SST_OPT_DEFAULT="$1=$file" @@ -607,6 +612,12 @@ case "$1" in fi skip_mysqld_arg=1 ;; + '--innodb-buffer-pool-size') + if [ -z "$INNODB_BUFFER_POOL_SIZE" ]; then + MYSQLD_OPT_INNODB_BUFFER_POOL_SIZE=$(trim_string "$value") + fi + skip_mysqld_arg=1 + ;; '--innodb-force-recovery') if [ -n "$value" -a "$value" != "0" ]; then INNODB_FORCE_RECOVERY=$(trim_string "$value") @@ -696,6 +707,10 @@ if [ -n "${MYSQLD_OPT_INNODB_BUFFER_POOL:-}" -a \ -z "$INNODB_BUFFER_POOL" ]; then readonly INNODB_BUFFER_POOL="$MYSQLD_OPT_INNODB_BUFFER_POOL" fi +if [ -n "${MYSQLD_OPT_INNODB_BUFFER_POOL_SIZE:-}" -a \ + -z "$INNODB_BUFFER_POOL_SIZE" ]; then + readonly INNODB_BUFFER_POOL_SIZE="$MYSQLD_OPT_INNODB_BUFFER_POOL_SIZE" +fi if [ -n "${MYSQLD_OPT_LOG_BIN:-}" -a \ -z "$WSREP_SST_OPT_BINLOG" ]; then readonly WSREP_SST_OPT_BINLOG="$MYSQLD_OPT_LOG_BIN" @@ -752,6 +767,9 @@ fi if [ -n "$INNODB_BUFFER_POOL" ]; then INNOEXTRA="$INNOEXTRA --innodb-buffer-pool-filename='$INNODB_BUFFER_POOL'" fi +if [ -n "$INNODB_BUFFER_POOL_SIZE" ]; then + INNOEXTRA="$INNOEXTRA --innodb-buffer-pool-size='$INNODB_BUFFER_POOL_SIZE'" +fi if [ -n "$WSREP_SST_OPT_BINLOG" ]; then INNOEXTRA="$INNOEXTRA --log-bin='$WSREP_SST_OPT_BINLOG'" if [ -n "$WSREP_SST_OPT_BINLOG_INDEX" ]; then @@ -1117,7 +1135,7 @@ get_openssl() { # If the OPENSSL_BINARY variable is already defined, just return: if [ -n "${OPENSSL_BINARY+x}" ]; then - return + return 0 fi # Let's look for openssl: OPENSSL_BINARY=$(commandex 'openssl') @@ -1556,7 +1574,7 @@ cleanup_pid() fi done elif ps -p $pid >/dev/null 2>&1; then - wsrep_log_warning "Unable to kill PID=$pid ($pid_file)" + wsrep_log_warning "Unable to kill PID=$pid${pid_file:+ ($pid_file)}" return 1 fi fi @@ -1775,14 +1793,14 @@ simple_cleanup() create_data() { OLD_PWD="$(pwd)" + DATA_DIR="$OLD_PWD" if [ -n "$DATA" -a "$DATA" != '.' ]; then [ ! -d "$DATA" ] && mkdir -p "$DATA" cd "$DATA" + DATA_DIR="$(pwd)" + cd "$OLD_PWD" fi - DATA_DIR="$(pwd)" - - cd "$OLD_PWD" } create_dirs() @@ -1863,6 +1881,8 @@ create_dirs() cd "$OLD_PWD" [ $simplify -ne 0 -a "$ar_log_dir" = "$DATA_DIR" ] && ar_log_dir="" fi + + return 0 } wait_previous_sst() diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index d4d3e370c4e..ac42c7ffae5 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -439,17 +439,30 @@ get_transfer() get_footprint() { cd "$DATA_DIR" - local payload_data=$(find $findopt . \ - -regex '.*undo[0-9]+$\|.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \ - -type f -print0 | du --files0-from=- --block-size=1 -c -s | \ - awk 'END { print $1 }') + local payload_data + if [ "$OS" = 'Linux' ]; then + payload_data=$(find $findopt . \ + -regex '.*undo[0-9]+$\|.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \ + -type f -print0 | du --files0-from=- --bytes -c -s | \ + awk 'END { print $1 }') + else + payload_data=$(find $findopt . \ + -regex '.*undo[0-9]+$|.*\.ibd$|.*\.MYI$\.*\.MYD$|.*ibdata1$' \ + -type f -print0 | xargs -0 stat -f '%z' | \ + awk '{ sum += $1 } END { print sum }') + fi local payload_undo=0 if [ -n "$ib_undo_dir" -a "$ib_undo_dir" != '.' -a \ "$ib_undo_dir" != "$DATA_DIR" -a -d "$ib_undo_dir" ] then cd "$ib_undo_dir" - payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \ - du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }') + if [ "$OS" = 'Linux' ]; then + payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \ + du --files0-from=- --bytes -c -s | awk 'END { print $1 }') + else + payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \ + xargs -0 stat -f '%z' | awk '{ sum += $1 } END { print sum }') + fi fi cd "$OLD_PWD" @@ -527,7 +540,8 @@ adjust_progress() fi } -encgroups='--mysqld|sst|xtrabackup' +bkgroups='sst|xtrabackup|mariabackup' +encgroups="--mysqld|$bkgroups" read_cnf() { @@ -583,26 +597,34 @@ read_cnf() ssl_dhparams=$(parse_cnf "$encgroups" 'ssl-dhparams') fi - sockopt=$(parse_cnf sst sockopt "") - progress=$(parse_cnf sst progress "") + sockopt=$(parse_cnf sst sockopt) + progress=$(parse_cnf sst progress) ttime=$(parse_cnf sst time 0) cpat='.*\.pem$\|.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$' [ "$OS" = 'FreeBSD' ] && cpat=$(echo "$cpat" | sed 's/\\|/|/g') cpat=$(parse_cnf sst cpat "$cpat") - scomp=$(parse_cnf sst compressor "") - sdecomp=$(parse_cnf sst decompressor "") + scomp=$(parse_cnf sst compressor) + sdecomp=$(parse_cnf sst decompressor) - rlimit=$(parse_cnf sst rlimit "") + rlimit=$(parse_cnf sst rlimit) uextra=$(parse_cnf sst use-extra 0) - speciald=$(parse_cnf sst sst-special-dirs 1) - iopts=$(parse_cnf sst inno-backup-opts "") - iapts=$(parse_cnf sst inno-apply-opts "") - impts=$(parse_cnf sst inno-move-opts "") - stimeout=$(parse_cnf sst sst-initial-timeout 300) - ssyslog=$(parse_cnf sst sst-syslog 0) - ssystag=$(parse_cnf mysqld_safe syslog-tag "${SST_SYSLOG_TAG:-}") + speciald=$(parse_cnf sst 'sst-special-dirs' 1) + iopts=$(parse_cnf "$bkgroups" 'inno-backup-opts') + iapts=$(parse_cnf "$bkgroups" 'inno-apply-opts') + impts=$(parse_cnf "$bkgroups" 'inno-move-opts') + use_memory=$(parse_cnf "$bkgroups" 'use-memory') + if [ -z "$use_memory" ]; then + if [ -n "$INNODB_BUFFER_POOL_SIZE" ]; then + use_memory="$INNODB_BUFFER_POOL_SIZE" + else + use_memory=$(parse_cnf '--mysqld' 'innodb-buffer-pool-size') + fi + fi + stimeout=$(parse_cnf sst 'sst-initial-timeout' 300) + ssyslog=$(parse_cnf sst 'sst-syslog' 0) + ssystag=$(parse_cnf mysqld_safe 'syslog-tag' "${SST_SYSLOG_TAG:-}") ssystag="$ssystag-" - sstlogarchive=$(parse_cnf sst sst-log-archive 1) + sstlogarchive=$(parse_cnf sst 'sst-log-archive' 1) sstlogarchivedir="" if [ $sstlogarchive -ne 0 ]; then sstlogarchivedir=$(parse_cnf sst sst-log-archive-dir \ @@ -676,24 +698,25 @@ cleanup_at_exit() [ "$(pwd)" != "$OLD_PWD" ] && cd "$OLD_PWD" - if [ $estatus -ne 0 ]; then - wsrep_log_error "Removing $MAGIC_FILE file due to signal" + if [ "$WSREP_SST_OPT_ROLE" = 'donor' -o $estatus -ne 0 ]; then + if [ $estatus -ne 0 ]; then + wsrep_log_error "Removing $MAGIC_FILE file due to signal" + fi [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" || : [ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE" || : + [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || : fi if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then if [ -n "$BACKUP_PID" ]; then if ps -p $BACKUP_PID >/dev/null 2>&1; then wsrep_log_error \ - "mariadb-backup process is still running. Killing..." - cleanup_pid $CHECK_PID + "SST streaming process is still running. Killing..." + cleanup_pid $BACKUP_PID fi fi wsrep_log_info "Removing the sst_in_progress file" wsrep_cleanup_progress_file - else - [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || : fi if [ -n "$progress" -a -p "$progress" ]; then @@ -1045,6 +1068,9 @@ setup_commands() if [ -n "$INNODB_FORCE_RECOVERY" ]; then recovery=" --innodb-force-recovery=$INNODB_FORCE_RECOVERY" fi + if [ -n "$use_memory" ]; then + INNOEXTRA="$INNOEXTRA --use-memory=$use_memory" + fi INNOAPPLY="$BACKUP_BIN --prepare$disver$recovery${iapts:+ }$iapts$INNOEXTRA --target-dir='$DATA' --datadir='$DATA'$mysqld_args $INNOAPPLY" INNOMOVE="$BACKUP_BIN$WSREP_SST_OPT_CONF --move-back$disver${impts:+ }$impts$INNOEXTRA --galera-info --force-non-empty-directories --target-dir='$DATA' --datadir='${TDATA:-$DATA}' $INNOMOVE" INNOBACKUP="$BACKUP_BIN$WSREP_SST_OPT_CONF --backup$disver${iopts:+ }$iopts$tmpopts$INNOEXTRA --galera-info --stream=$sfmt --target-dir='$itmpdir' --datadir='$DATA'$mysqld_args $INNOBACKUP" diff --git a/sql/filesort.cc b/sql/filesort.cc index e4449f9ef79..ad893c6405f 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -530,7 +530,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort, MYF(0), ER_THD(thd, ER_FILSORT_ABORT), kill_errno ? ER_THD(thd, kill_errno) : - thd->killed == ABORT_QUERY ? "" : + thd->killed == ABORT_QUERY ? "LIMIT ROWS EXAMINED" : thd->get_stmt_da()->message()); if ((thd->killed == ABORT_QUERY || kill_errno) && diff --git a/sql/handler.cc b/sql/handler.cc index 1243c3395f3..710d1b6a96c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4875,6 +4875,12 @@ void handler::print_error(int error, myf errflag) case HA_ERR_PARTITION_LIST: my_error(ER_VERS_NOT_ALLOWED, errflag, table->s->db.str, table->s->table_name.str); DBUG_VOID_RETURN; + case HA_ERR_ROLLBACK: + /* Crash if we run with --debug-assert-on-error */ + DBUG_ASSERT(!debug_assert_if_crashed_table); + SET_FATAL_ERROR; + textno= ER_ROLLBACK_ONLY; + break; default: { /* The error was "unknown" to this function. @@ -4909,7 +4915,7 @@ void handler::print_error(int error, myf errflag) /* Ensure this becomes a true error */ errflag&= ~(ME_WARNING | ME_NOTE); if ((debug_assert_if_crashed_table || - global_system_variables.log_warnings > 1)) + global_system_variables.log_warnings > 1)) { /* Log error to log before we crash or if extended warnings are requested diff --git a/sql/item_func.cc b/sql/item_func.cc index 153375b07ab..cbf70379850 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1318,9 +1318,10 @@ longlong Item_func_minus::int_op() { if (args[1]->unsigned_flag) { - if ((ulonglong) val0 < (ulonglong) val1) + if ((ulonglong) val0 >= (ulonglong) val1) + res_unsigned= TRUE; + else if ((ulonglong)val1 - (ulonglong)val0 > (ulonglong)LONGLONG_MAX) goto err; - res_unsigned= TRUE; } else { diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index a8f33ad7594..5f816aa85d2 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2653,7 +2653,7 @@ String *Item_func_password::val_str_ascii(String *str) if (args[0]->null_value || res->length() == 0) return make_empty_result(str); my_make_scrambled_password(tmp_value, res->ptr(), res->length()); - str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, &my_charset_latin1); + str->copy(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, &my_charset_latin1); break; case OLD: if ((null_value=args[0]->null_value)) @@ -2661,7 +2661,7 @@ String *Item_func_password::val_str_ascii(String *str) if (res->length() == 0) return make_empty_result(str); my_make_scrambled_password_323(tmp_value, res->ptr(), res->length()); - str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, &my_charset_latin1); + str->copy(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, &my_charset_latin1); break; default: DBUG_ASSERT(0); diff --git a/sql/log.cc b/sql/log.cc index a91150d7d82..c351f30a0cf 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1308,7 +1308,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, size_t query_length, user_host_buff); DBUG_ASSERT(thd->start_utime); - DBUG_ASSERT(thd->start_time); + DBUG_ASSERT(thd->start_time || thd->start_time_sec_part); query_utime= (current_utime - thd->start_utime); lock_utime= (thd->utime_after_lock - thd->start_utime); my_hrtime_t current_time= { hrtime_from_time(thd->start_time) + diff --git a/sql/log_event.cc b/sql/log_event.cc index 8cf598b5159..ae5362c426c 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -694,6 +694,9 @@ const char* Log_event::get_type_str(Log_event_type type) case TRANSACTION_CONTEXT_EVENT: return "Transaction_context"; case VIEW_CHANGE_EVENT: return "View_change"; case XA_PREPARE_LOG_EVENT: return "XA_prepare"; + case PARTIAL_UPDATE_ROWS_EVENT: return "MySQL Update_rows_partial"; + case TRANSACTION_PAYLOAD_EVENT: return "MySQL Transaction_payload"; + case HEARTBEAT_LOG_EVENT_V2: return "MySQL Heartbeat"; case QUERY_COMPRESSED_EVENT: return "Query_compressed"; case WRITE_ROWS_COMPRESSED_EVENT: return "Write_rows_compressed"; case UPDATE_ROWS_COMPRESSED_EVENT: return "Update_rows_compressed"; @@ -983,6 +986,7 @@ Log_event* Log_event::read_log_event(const uchar *buf, uint event_len, DBUG_PRINT("info", ("binlog_version: %d", fdle->binlog_version)); DBUG_DUMP_EVENT_BUF(buf, event_len); + *error= 0; /* Check the integrity; This is needed because handle_slave_io() doesn't check if packet is of proper length. @@ -1180,6 +1184,7 @@ Log_event* Log_event::read_log_event(const uchar *buf, uint event_len, case ANONYMOUS_GTID_LOG_EVENT: case PREVIOUS_GTIDS_LOG_EVENT: case TRANSACTION_CONTEXT_EVENT: + case HEARTBEAT_LOG_EVENT_V2: // MySQL 8.0 case VIEW_CHANGE_EVENT: ev= new Ignorable_log_event(buf, fdle, get_type_str((Log_event_type) event_type)); @@ -1204,6 +1209,21 @@ Log_event* Log_event::read_log_event(const uchar *buf, uint event_len, case START_ENCRYPTION_EVENT: ev= new Start_encryption_log_event(buf, event_len, fdle); break; + case TRANSACTION_PAYLOAD_EVENT: // MySQL 8.0 + *error= + "Found incompatible MySQL 8.0 TRANSACTION_PAYLOAD_EVENT event. " + "You can avoid this event by specifying " + "'binlog_transaction_compression=0' in the MySQL server"; + ev= NULL; + break; + case PARTIAL_UPDATE_ROWS_EVENT: // MySQL 8.0 + *error= + "Found incompatible MySQL 8.0 PARTIAL_UPDATE_ROWS_EVENT event. " + "You can avoid this event by specifying " + "'binlog-row-value-options=\"\"' in the MySQL server"; + ev= NULL; + break; + case PRE_GA_WRITE_ROWS_EVENT: case PRE_GA_UPDATE_ROWS_EVENT: case PRE_GA_DELETE_ROWS_EVENT: @@ -1253,12 +1273,14 @@ exit: #ifdef MYSQL_CLIENT if (!force_opt) /* then mysqlbinlog dies */ { - *error= "Found invalid event in binary log"; + if (!*error) + *error= "Found invalid event in binary log"; DBUG_RETURN(0); } ev= new Unknown_log_event(buf, fdle); #else - *error= "Found invalid event in binary log"; + if (!*error) + *error= "Found invalid event in binary log"; DBUG_RETURN(0); #endif } @@ -2057,6 +2079,9 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver, post_header_len[TRANSACTION_CONTEXT_EVENT-1]= 0; post_header_len[VIEW_CHANGE_EVENT-1]= 0; post_header_len[XA_PREPARE_LOG_EVENT-1]= 0; + post_header_len[PARTIAL_UPDATE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; + post_header_len[TRANSACTION_PAYLOAD_EVENT-1]= ROWS_HEADER_LEN_V2; + post_header_len[HEARTBEAT_LOG_EVENT_V2-1]= ROWS_HEADER_LEN_V2; post_header_len[WRITE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; post_header_len[UPDATE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; post_header_len[DELETE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; diff --git a/sql/log_event.h b/sql/log_event.h index 41d550da8ae..d424fe0c4bd 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -681,6 +681,14 @@ enum Log_event_type /* not ignored */ XA_PREPARE_LOG_EVENT= 38, + /** + Extension of UPDATE_ROWS_EVENT, allowing partial values according + to binlog_row_value_options. + */ + PARTIAL_UPDATE_ROWS_EVENT = 39, + TRANSACTION_PAYLOAD_EVENT = 40, + HEARTBEAT_LOG_EVENT_V2 = 41, + /* Add new events here - right above this comment! Existing events (except ENUM_END_EVENT) should never change their numbers diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc index edf2e75fdb4..db6ab18727a 100644 --- a/sql/log_event_client.cc +++ b/sql/log_event_client.cc @@ -2049,7 +2049,7 @@ bool Query_log_event::print_query_header(IO_CACHE* file, print_event_info->auto_increment_offset= auto_increment_offset; } - /* TODO: print the catalog when we feature SET CATALOG */ + /* TODO: print the catalog when we feature USE CATALOG */ if (likely(charset_inited) && (unlikely(!print_event_info->charset_inited || @@ -2063,12 +2063,15 @@ bool Query_log_event::print_query_header(IO_CACHE* file, cs_info->cs_name.str, print_event_info->delimiter)) goto err; } + else if (my_b_printf(file, "# Ignored (Unknown charset) ")) + goto err; + if (my_b_printf(file,"SET " "@@session.character_set_client=%s," "@@session.collation_connection=%d," "@@session.collation_server=%d" "%s\n", - cs_info->cs_name.str, + cs_info ? cs_info->cs_name.str : "Unknown", uint2korr(charset+2), uint2korr(charset+4), print_event_info->delimiter)) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 2d7fe632778..d575ed1aaa8 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3280,7 +3280,6 @@ pthread_handler_t signal_hand(void *) /* switch to the old log message processing */ logger.set_handlers(global_system_variables.sql_log_slow ? LOG_FILE:LOG_NONE, opt_log ? LOG_FILE:LOG_NONE); - DBUG_PRINT("info",("Got signal: %d abort_loop: %d",sig,abort_loop)); break_connect_loop(); DBUG_ASSERT(abort_loop); @@ -3316,7 +3315,6 @@ pthread_handler_t signal_hand(void *) break; /* purecov: tested */ } } - DBUG_PRINT("quit", ("signal_handler: calling my_thread_end()")); my_thread_end(); signal_thread_in_use= 0; return nullptr; @@ -6929,7 +6927,6 @@ static int show_queries(THD *thd, SHOW_VAR *var, void *, return 0; } - static int show_net_compression(THD *thd, SHOW_VAR *var, void *, system_status_var *, enum_var_type) { @@ -7358,6 +7355,22 @@ static int show_memory_used(THD *thd, SHOW_VAR *var, void *buff, return 0; } +static int show_max_memory_used(THD *thd, SHOW_VAR *var, void *buff, + struct system_status_var *status_var, + enum enum_var_type scope) +{ + var->type= SHOW_LONGLONG; + var->value= buff; + if (scope == OPT_GLOBAL) + { + var->type= SHOW_CHAR; + var->value= (char*) "NULL"; // Emulate null value + } + else + *(longlong*) buff= (longlong) status_var->max_local_memory_used; + return 0; +} + static int show_binlog_space_total(THD *thd, SHOW_VAR *var, char *buff, struct system_status_var *status_var, @@ -7475,7 +7488,7 @@ SHOW_VAR status_vars[]= { {"Binlog_stmt_cache_disk_use",(char*) &binlog_stmt_cache_disk_use, SHOW_LONG}, {"Binlog_stmt_cache_use", (char*) &binlog_stmt_cache_use, SHOW_LONG}, {"Binlog_disk_use", (char*) &show_binlog_space_total, SHOW_SIMPLE_FUNC}, - {"Busy_time", (char*) offsetof(STATUS_VAR, busy_time), SHOW_DOUBLE_STATUS}, + {"Busy_time", (char*) offsetof(STATUS_VAR, busy_time), SHOW_MICROSECOND_STATUS}, {"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONGLONG_STATUS}, {"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS}, {"Column_compressions", (char*) offsetof(STATUS_VAR, column_compressions), SHOW_LONG_STATUS}, @@ -7489,7 +7502,7 @@ SHOW_VAR status_vars[]= { {"Connection_errors_peer_address", (char*) &connection_errors_peer_addr, SHOW_LONG}, {"Connection_errors_select", (char*) &connection_errors_select, SHOW_LONG}, {"Connection_errors_tcpwrap", (char*) &connection_errors_tcpwrap, SHOW_LONG}, - {"Cpu_time", (char*) offsetof(STATUS_VAR, cpu_time), SHOW_DOUBLE_STATUS}, + {"Cpu_time", (char*) offsetof(STATUS_VAR, cpu_time), SHOW_MICROSECOND_STATUS}, {"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables_), SHOW_LONG_STATUS}, {"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG}, {"Created_tmp_tables", (char*) offsetof(STATUS_VAR, created_tmp_tables_), SHOW_LONG_STATUS}, @@ -7561,6 +7574,7 @@ SHOW_VAR status_vars[]= { {"Master_gtid_wait_time", (char*) offsetof(STATUS_VAR, master_gtid_wait_time), SHOW_LONG_STATUS}, {"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, {"Max_used_connections_time",(char*) &show_max_used_connections_time, SHOW_SIMPLE_FUNC}, + {"Max_memory_used", (char*) &show_max_memory_used, SHOW_SIMPLE_FUNC}, {"Memory_used", (char*) &show_memory_used, SHOW_SIMPLE_FUNC}, {"Memory_used_initial", (char*) &start_memory_used, SHOW_LONGLONG}, {"Resultset_metadata_skipped", (char *) offsetof(STATUS_VAR, skip_metadata_count),SHOW_LONG_STATUS}, @@ -7609,6 +7623,7 @@ SHOW_VAR status_vars[]= { {"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_NOFLUSH}, #endif /*HAVE_QUERY_CACHE*/ {"Queries", (char*) &show_queries, SHOW_SIMPLE_FUNC}, + {"Query_time", (char*) offsetof(STATUS_VAR, query_time), SHOW_MICROSECOND_STATUS}, {"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS}, #ifdef HAVE_REPLICATION {"Rpl_status", (char*) &show_rpl_status, SHOW_SIMPLE_FUNC}, @@ -10038,7 +10053,7 @@ static int calculate_server_uid(char *dest) int2store(rawbuf, mysqld_port); if (my_gethwaddr(rawbuf + 2)) { - sql_print_error("feedback plugin: failed to retrieve the MAC address"); + sql_print_warning("failed to retrieve the MAC address"); return 1; } diff --git a/sql/semisync_master.cc b/sql/semisync_master.cc index 9e187403065..ce6bf24d35a 100644 --- a/sql/semisync_master.cc +++ b/sql/semisync_master.cc @@ -608,13 +608,17 @@ int Repl_semi_sync_master::report_reply_packet(uint32 server_id, DBUG_RETURN(-1); } else - sql_print_error("Read semi-sync reply magic number error"); + sql_print_error("Read semi-sync reply magic number error. " + "Got magic: %u command %u length: %lu", + (uint) packet[REPLY_MAGIC_NUM_OFFSET], (uint) packet[0], + packet_len); goto l_end; } if (unlikely(packet_len < REPLY_BINLOG_NAME_OFFSET)) { - sql_print_error("Read semi-sync reply length error: packet is too small"); + sql_print_error("Read semi-sync reply length error: packet is too small: %lu", + packet_len); goto l_end; } @@ -622,7 +626,8 @@ int Repl_semi_sync_master::report_reply_packet(uint32 server_id, log_file_len = packet_len - REPLY_BINLOG_NAME_OFFSET; if (unlikely(log_file_len >= FN_REFLEN)) { - sql_print_error("Read semi-sync reply binlog file length too large"); + sql_print_error("Read semi-sync reply binlog file length too large: %llu", + (ulonglong) log_file_pos); goto l_end; } strncpy(log_file_name, (const char*)packet + REPLY_BINLOG_NAME_OFFSET, log_file_len); diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 01a39765815..61f2747f976 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -2058,89 +2058,89 @@ ER_NORMAL_SHUTDOWN swe "%s (%s): Normal avslutning" ukr "%s (%s): Нормальне завершення" ER_GOT_SIGNAL - chi "%s: 收到信号 %d. 强行中止!\n" - cze "%s: přijat signal %d, končím\n" - dan "%s: Fangede signal %d. Afslutter!!\n" - eng "%s: Got signal %d. Aborting!\n" - est "%s: sain signaali %d. Lõpetan!\n" - fre "%s: Reçu le signal %d. Abandonne!\n" - ger "%s: Signal %d erhalten. Abbruch!\n" - geo "%s: მიღებულია სიგნალი %d. გაუქმება! \n" - greek "%s: Ελήφθη το μήνυμα %d. Η διαδικασία εγκαταλείπεται!\n" - hindi "%s: सिग्नल %d मिलने के कारण सिस्टम बंद किया जा रहा है!\n" - hun "%s: %d jelzes. Megszakitva!\n" - ita "%s: Ricevuto segnale %d. Interruzione!\n" - jpn "%s: シグナル %d を受信しました。強制終了します!\n" - kor "%s: %d 신호가 들어왔음. 중지!\n" - nla "%s: Signaal %d. Systeem breekt af!\n" - nor "%s: Oppdaget signal %d. Avslutter!\n" - norwegian-ny "%s: Oppdaga signal %d. Avsluttar!\n" - pol "%s: Otrzymano sygnał %d. Kończenie działania!\n" - por "%s: Obteve sinal %d. Abortando!\n" - rum "%s: Semnal %d obtinut. Aborting!\n" - rus "%s: Получен сигнал %d. Прекращаем!\n" - serbian "%s: Dobio signal %d. Prekidam!\n" - slo "%s: prijatý signál %d, ukončenie (Abort)!\n" - spa "%s: Obtenida señal %d. ¡Abortando!\n" - sw "%s: Nimepata ishara %d. Ninaacha kazi ghafla!\n" - swe "%s: Fick signal %d. Avslutar!\n" - ukr "%s: Отримано сигнал %d. Перериваюсь!\n" + chi "%s: 收到信号 %d. 强行中止!" + cze "%s: přijat signal %d, končím!" + dan "%s: Fangede signal %d. Afslutter!" + eng "%s: Got signal %d. Aborting!" + est "%s: sain signaali %d. Lõpetan!" + fre "%s: Reçu le signal %d. Abandonne!" + ger "%s: Signal %d erhalten. Abbruch!" + geo "%s: მიღებულია სიგნალი %d. გაუქმება! " + greek "%s: Ελήφθη το μήνυμα %d. Η διαδικασία εγκαταλείπεται!" + hindi "%s: सिग्नल %d मिलने के कारण सिस्टम बंद किया जा रहा है!" + hun "%s: %d jelzes. Megszakitva!" + ita "%s: Ricevuto segnale %d. Interruzione!" + jpn "%s: シグナル %d を受信しました。強制終了します!" + kor "%s: %d 신호가 들어왔음. 중지!" + nla "%s: Signaal %d. Systeem breekt af!" + nor "%s: Oppdaget signal %d. Avslutter!" + norwegian-ny "%s: Oppdaga signal %d. Avsluttar!" + pol "%s: Otrzymano sygnał %d. Kończenie działania!" + por "%s: Obteve sinal %d. Abortando!" + rum "%s: Semnal %d obtinut. Aborting!" + rus "%s: Получен сигнал %d. Прекращаем!" + serbian "%s: Dobio signal %d. Prekidam!" + slo "%s: prijatý signál %d, ukončenie (Abort)!" + spa "%s: Obtenida señal %d. ¡Abortando!" + sw "%s: Nimepata ishara %d. Ninaacha kazi ghafla!" + swe "%s: Fick signal %d. Avslutar!" + ukr "%s: Отримано сигнал %d. Перериваюсь!" ER_SHUTDOWN_COMPLETE - chi "%s:关闭完成\n" - cze "%s: ukončení práce hotovo\n" - dan "%s: Server lukket\n" - eng "%s: Shutdown complete\n" - est "%s: Lõpp\n" - fre "%s: Arrêt du serveur terminé\n" - ger "%s: Herunterfahren beendet\n" - geo "%s: მუშაობა წარმატებიტ დასრულდა\n" - greek "%s: Η διαδικασία Shutdown ολοκληρώθηκε\n" - hindi "%s: शटडाउन पूर्ण\n" - hun "%s: A leallitas kesz\n" - ita "%s: Shutdown completato\n" - jpn "%s: シャットダウン完了\n" - kor "%s: Shutdown 이 완료됨!\n" - nla "%s: Afsluiten afgerond\n" - nor "%s: Avslutning komplett\n" - norwegian-ny "%s: Nedkopling komplett\n" - pol "%s: Zakończenie działania wykonane\n" - por "%s: 'Shutdown' completo\n" - rum "%s: Terminare completa\n" - rus "%s: Остановка завершена\n" - serbian "%s: Gašenje završeno\n" - slo "%s: práca ukončená\n" - spa "%s: Apagado completado\n" - sw "%s: Kuzima kumekamilika\n" - swe "%s: Avslutning klar\n" - ukr "%s: Роботу завершено\n" + chi "%s:关闭完成" + cze "%s: ukončení práce hotovo" + dan "%s: Server lukket" + eng "%s: Shutdown complete" + est "%s: Lõpp" + fre "%s: Arrêt du serveur terminé" + ger "%s: Herunterfahren beendet" + geo "%s: მუშაობა წარმატებიტ დასრულდა" + greek "%s: Η διαδικασία Shutdown ολοκληρώθηκε" + hindi "%s: शटडाउन पूर्ण" + hun "%s: A leallitas kesz" + ita "%s: Shutdown completato" + jpn "%s: シャットダウン完了" + kor "%s: Shutdown 이 완료됨!" + nla "%s: Afsluiten afgerond" + nor "%s: Avslutning komplett" + norwegian-ny "%s: Nedkopling komplett" + pol "%s: Zakończenie działania wykonane" + por "%s: 'Shutdown' completo" + rum "%s: Terminare completa" + rus "%s: Остановка завершена" + serbian "%s: Gašenje završeno" + slo "%s: práca ukončená" + spa "%s: Apagado completado" + sw "%s: Kuzima kumekamilika" + swe "%s: Avslutning klar" + ukr "%s: Роботу завершено" ER_FORCING_CLOSE 08S01 - chi "%s: 强行关闭线程 %ld 用户: '%-.48s'\n" - cze "%s: násilné uzavření threadu %ld uživatele '%-.48s'\n" - dan "%s: Forceret nedlukning af tråd: %ld bruger: '%-.48s'\n" - eng "%s: Forcing close of thread %ld user: '%-.48s'\n" - est "%s: Sulgen jõuga lõime %ld kasutaja: '%-.48s'\n" - fre "%s: Arrêt forcé de la tâche (thread) %ld utilisateur: '%-.48s'\n" - ger "%s: Thread %ld zwangsweise beendet. Benutzer: '%-.48s'\n" - geo "%s: ნაძალადევი დახურვა: ნაკადი: %ld, მომხმარებელი: '%-.48s'\n" - greek "%s: Το thread θα κλείσει %ld user: '%-.48s'\n" - hindi "%s: %ld थ्रेड बंद किया जा रहा है (यूज़र: '%-.48s')\n" - hun "%s: A(z) %ld thread kenyszeritett zarasa. Felhasznalo: '%-.48s'\n" - ita "%s: Forzata la chiusura del thread %ld utente: '%-.48s'\n" - jpn "%s: スレッド %ld を強制終了します (ユーザー: '%-.48s')\n" - kor "%s: thread %ld의 강제 종료 user: '%-.48s'\n" - nla "%s: Afsluiten afgedwongen van thread %ld gebruiker: '%-.48s'\n" - nor "%s: Påtvinget avslutning av tråd %ld bruker: '%-.48s'\n" - norwegian-ny "%s: Påtvinga avslutning av tråd %ld brukar: '%-.48s'\n" - pol "%s: Wymuszenie zamknięcia w?tku %ld użytkownik: '%-.48s'\n" - por "%s: Forçando finalização da 'thread' %ld - usuário '%-.48s'\n" - rum "%s: Terminare fortata a thread-ului %ld utilizatorului: '%-.48s'\n" - rus "%s: Принудительно закрываем поток %ld пользователя: '%-.48s'\n" - serbian "%s: Usiljeno gašenje thread-a %ld koji pripada korisniku: '%-.48s'\n" - slo "%s: násilné ukončenie vlákna %ld užívateľa '%-.48s'\n" - spa "%s: Forzando a cerrar el hilo (thread) %ld usuario: '%-.48s'\n" - sw "%s: Kulazimisha kufungwa kwa mazungumzo %ld user: '%-.48s'\n" - swe "%s: Stänger av tråd %ld; användare: '%-.48s'\n" - ukr "%s: Прискорюю закриття гілки %ld користувача: '%-.48s'\n" + chi "%s: 强行关闭线程 %ld 用户: '%-.48s'" + cze "%s: násilné uzavření threadu %ld uživatele '%-.48s'" + dan "%s: Forceret nedlukning af tråd: %ld bruger: '%-.48s'" + eng "%s: Forcing close of thread %ld user: '%-.48s'" + est "%s: Sulgen jõuga lõime %ld kasutaja: '%-.48s'" + fre "%s: Arrêt forcé de la tâche (thread) %ld utilisateur: '%-.48s'" + ger "%s: Thread %ld zwangsweise beendet. Benutzer: '%-.48s'" + geo "%s: ნაძალადევი დახურვა: ნაკადი: %ld, მომხმარებელი: '%-.48s'" + greek "%s: Το thread θα κλείσει %ld user: '%-.48s'" + hindi "%s: %ld थ्रेड बंद किया जा रहा है (यूज़र: '%-.48s')" + hun "%s: A(z) %ld thread kenyszeritett zarasa. Felhasznalo: '%-.48s'" + ita "%s: Forzata la chiusura del thread %ld utente: '%-.48s'" + jpn "%s: スレッド %ld を強制終了します (ユーザー: '%-.48s')" + kor "%s: thread %ld의 강제 종료 user: '%-.48s'" + nla "%s: Afsluiten afgedwongen van thread %ld gebruiker: '%-.48s'" + nor "%s: Påtvinget avslutning av tråd %ld bruker: '%-.48s'" + norwegian-ny "%s: Påtvinga avslutning av tråd %ld brukar: '%-.48s'" + pol "%s: Wymuszenie zamknięcia w?tku %ld użytkownik: '%-.48s'" + por "%s: Forçando finalização da 'thread' %ld - usuário '%-.48s'" + rum "%s: Terminare fortata a thread-ului %ld utilizatorului: '%-.48s'" + rus "%s: Принудительно закрываем поток %ld пользователя: '%-.48s'" + serbian "%s: Usiljeno gašenje thread-a %ld koji pripada korisniku: '%-.48s'" + slo "%s: násilné ukončenie vlákna %ld užívateľa '%-.48s'" + spa "%s: Forzando a cerrar el hilo (thread) %ld usuario: '%-.48s'" + sw "%s: Kulazimisha kufungwa kwa mazungumzo %ld user: '%-.48s'" + swe "%s: Stänger av tråd %ld; användare: '%-.48s'" + ukr "%s: Прискорюю закриття гілки %ld користувача: '%-.48s'" ER_IPSOCK_ERROR 08S01 chi "无法创建IP插口" cze "Nemohu vytvořit IP socket" @@ -2593,33 +2593,33 @@ ER_TOO_BIG_SET swe "För många alternativ till kolumn %-.192s för SET" ukr "Забагато строк для стовбця %-.192s та SET" ER_NO_UNIQUE_LOGFILE - chi "无法生成唯一的log-filename%-.200s.(1-999)\ n" - cze "Nemohu vytvořit jednoznačné jméno logovacího souboru %-.200s.(1-999)\n" - dan "Kan ikke lave unikt log-filnavn %-.200s.(1-999)\n" - eng "Can't generate a unique log-filename %-.200s.(1-999)\n" - est "Ei suuda luua unikaalset logifaili nime %-.200s.(1-999)\n" - fre "Ne peut générer un unique nom de journal %-.200s.(1-999)\n" - ger "Kann keinen eindeutigen Dateinamen für die Logdatei %-.200s(1-999) erzeugen\n" - geo "უნიკალური ჟურნალის ფაილის სახელის %-.200s.(1-999) შექმნის შეცდომა\n" - greek "Αδύνατη η δημιουργία unique log-filename %-.200s.(1-999)\n" - hindi "एक अनूठा लॉग-फ़ाइल नाम %-.200s.(1-999) उत्पन्न नहीं कर सके\n" - hun "Egyedi log-filenev nem generalhato: %-.200s.(1-999)\n" - ita "Impossibile generare un nome del file log unico %-.200s.(1-999)\n" - jpn "一意なログファイル名 %-.200s.(1-999) を生成できません。\n" - kor "Unique 로그화일 '%-.200s'를 만들수 없습니다.(1-999)\n" - nla "Het is niet mogelijk een unieke naam te maken voor de logfile %-.200s.(1-999)\n" - nor "Kan ikke lage unikt loggfilnavn %-.200s.(1-999)\n" - norwegian-ny "Kan ikkje lage unikt loggfilnavn %-.200s.(1-999)\n" - pol "Nie można stworzyć unikalnej nazwy pliku z logiem %-.200s.(1-999)\n" - por "Não pode gerar um nome de arquivo de 'log' único '%-.200s'.(1-999)\n" - rum "Nu pot sa generez un nume de log unic %-.200s.(1-999)\n" - rus "Невозможно создать уникальное имя файла журнала %-.200s.(1-999)\n" - serbian "Ne mogu da generišem jedinstveno ime log-file-a: '%-.200s.(1-999)'\n" - slo "Nemôžem vytvoriť unikátne meno log-súboru %-.200s.(1-999)\n" - spa "No puedo generar un único fichero/archivo de historial (log) llamado %-.200s.(1-999)\n" - sw "Haiwezi kutengeneza jina la kipekee la faili la kumbukumbu (log-filename) %-.200s.(1-999)\n" - swe "Kan inte generera ett unikt filnamn %-.200s.(1-999)\n" - ukr "Не можу згенерувати унікальне ім'я log-файлу %-.200s.(1-999)\n" + chi "无法生成唯一的log-filename%-.200s.(1-999)" + cze "Nemohu vytvořit jednoznačné jméno logovacího souboru %-.200s.(1-999)" + dan "Kan ikke lave unikt log-filnavn %-.200s.(1-999)" + eng "Can't generate a unique log-filename %-.200s.(1-999)" + est "Ei suuda luua unikaalset logifaili nime %-.200s.(1-999)" + fre "Ne peut générer un unique nom de journal %-.200s.(1-999)" + ger "Kann keinen eindeutigen Dateinamen für die Logdatei %-.200s(1-999) erzeugen" + geo "უნიკალური ჟურნალის ფაილის სახელის %-.200s.(1-999) შექმნის შეცდომა" + greek "Αδύνατη η δημιουργία unique log-filename %-.200s.(1-999)" + hindi "एक अनूठा लॉग-फ़ाइल नाम %-.200s.(1-999) उत्पन्न नहीं कर सके" + hun "Egyedi log-filenev nem generalhato: %-.200s.(1-999)" + ita "Impossibile generare un nome del file log unico %-.200s.(1-999)" + jpn "一意なログファイル名 %-.200s.(1-999) を生成できません。" + kor "Unique 로그화일 '%-.200s'를 만들수 없습니다.(1-999)" + nla "Het is niet mogelijk een unieke naam te maken voor de logfile %-.200s.(1-999)" + nor "Kan ikke lage unikt loggfilnavn %-.200s.(1-999)" + norwegian-ny "Kan ikkje lage unikt loggfilnavn %-.200s.(1-999)" + pol "Nie można stworzyć unikalnej nazwy pliku z logiem %-.200s.(1-999)" + por "Não pode gerar um nome de arquivo de 'log' único '%-.200s'.(1-999)" + rum "Nu pot sa generez un nume de log unic %-.200s.(1-999)" + rus "Невозможно создать уникальное имя файла журнала %-.200s.(1-999)" + serbian "Ne mogu da generišem jedinstveno ime log-file-a: '%-.200s.(1-999)'" + slo "Nemôžem vytvoriť unikátne meno log-súboru %-.200s.(1-999)" + spa "No puedo generar un único fichero/archivo de historial (log) llamado %-.200s.(1-999)" + sw "Haiwezi kutengeneza jina la kipekee la faili la kumbukumbu (log-filename) %-.200s.(1-999)" + swe "Kan inte generera ett unikt filnamn %-.200s.(1-999)" + ukr "Не можу згенерувати унікальне ім'я log-файлу %-.200s.(1-999)" ER_TABLE_NOT_LOCKED_FOR_WRITE chi "表 '%-.192s' 有 READ 锁,无法更新" cze "Tabulka '%-.192s' byla zamčena s READ a nemůže být změněna" diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 96020c68b2b..b1c570ade03 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -76,12 +76,32 @@ static inline void output_core_info() if ((fd= open("/proc/self/limits", O_RDONLY)) >= 0) #endif { - my_safe_printf_stderr("Resource Limits:\n"); - while ((len= read(fd, (uchar*)buff, sizeof(buff))) > 0) - { - my_write_stderr(buff, len); - } + char *endline= buff; + ssize_t remain_len= len= read(fd, buff, sizeof(buff)); close(fd); + my_safe_printf_stderr("Resource Limits (excludes unlimited resources):\n"); + /* first line, header */ + endline= (char *) memchr(buff, '\n', remain_len); + if (endline) + { + endline++; + remain_len= buff + len - endline; + my_safe_printf_stderr("%.*s", (int) (endline - buff), buff); + + while (remain_len > 27) + { + char *newendline= (char *) memchr(endline, '\n', remain_len); + if (!newendline) + break; + *newendline= '\0'; + newendline++; + if (endline[26] != 'u') /* skip unlimited limits */ + my_safe_printf_stderr("%s\n", endline); + + remain_len-= newendline - endline; + endline= newendline; + } + } } #ifdef __linux__ if ((fd= open("/proc/sys/kernel/core_pattern", O_RDONLY)) >= 0) @@ -144,7 +164,6 @@ extern "C" sig_handler handle_fatal_signal(int sig) We will try and print the query at the end of the signal handler, in case we're wrong. */ - bool print_invalid_query_pointer= false; #endif if (segfaulted) @@ -174,57 +193,19 @@ extern "C" sig_handler handle_fatal_signal(int sig) goto end; } - my_safe_printf_stderr("[ERROR] mysqld got " SIGNAL_FMT " ;\n",sig); + my_safe_printf_stderr("[ERROR] %s got " SIGNAL_FMT " ;\n", my_progname, sig); my_safe_printf_stderr("%s", "Sorry, we probably made a mistake, and this is a bug.\n\n" "Your assistance in bug reporting will enable us to fix this for the next release.\n" - "To report this bug, see https://mariadb.com/kb/en/reporting-bugs\n\n"); - - my_safe_printf_stderr("%s", - "We will try our best to scrape up some info that will hopefully help\n" - "diagnose the problem, but since we have already crashed, \n" - "something is definitely wrong and this may fail.\n\n"); + "To report this bug, see https://mariadb.com/kb/en/reporting-bugs about how to report\n" + "a bug on https://jira.mariadb.org/.\n\n" + "Please include the information from the server start above, to the end of the\n" + "information below.\n\n"); set_server_version(server_version, sizeof(server_version)); - my_safe_printf_stderr("Server version: %s source revision: %s\n", - server_version, SOURCE_REVISION); - - if (dflt_key_cache) - my_safe_printf_stderr("key_buffer_size=%zu\n", - dflt_key_cache->key_cache_mem_size); - - my_safe_printf_stderr("read_buffer_size=%lu\n", - global_system_variables.read_buff_size); - - my_safe_printf_stderr("max_used_connections=%lu\n", - max_used_connections); - - if (thread_scheduler) - my_safe_printf_stderr("max_threads=%lu\n", - thread_scheduler->max_threads + - extra_max_connections); - - my_safe_printf_stderr("thread_count=%u\n", THD_count::value()); - - if (dflt_key_cache && thread_scheduler) - { - size_t used_mem= - (dflt_key_cache->key_cache_mem_size + - (global_system_variables.read_buff_size + - (size_t) global_system_variables.sortbuff_size) * - (thread_scheduler->max_threads + extra_max_connections) + - (max_connections + extra_max_connections) * sizeof(THD)) / 1024; - - my_safe_printf_stderr("It is possible that mysqld could use up to \n" - "key_buffer_size + " - "(read_buffer_size + sort_buffer_size)*max_threads = " - "%zu K bytes of memory\n", used_mem); - - my_safe_printf_stderr("%s", - "Hope that's ok; if not, decrease some variables in " - "the equation.\n\n"); - } + my_safe_printf_stderr("Server version: %s source revision: %s\n\n", + server_version, SOURCE_REVISION); #ifdef WITH_WSREP Wsrep_server_state::handle_fatal_signal(); @@ -235,12 +216,14 @@ extern "C" sig_handler handle_fatal_signal(int sig) if (opt_stack_trace) { - my_safe_printf_stderr("Thread pointer: %p\n", thd); my_safe_printf_stderr("%s", - "Attempting backtrace. You can use the following " - "information to find out\n" - "where mysqld died. If you see no messages after this, something went\n" - "terribly wrong...\n"); + "The information page at " + "https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/\n" + "contains instructions to obtain a better version of the backtrace below.\n" + "Following these instructions will help MariaDB developers provide a fix quicker.\n\n" + "Attempting backtrace. Include this in the bug report.\n" + "(note: Retrieving this information may fail)\n\n"); + my_safe_printf_stderr("Thread pointer: %p\n", thd); my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL, (ulong)my_thread_stack_size, 0); } @@ -288,20 +271,12 @@ extern "C" sig_handler handle_fatal_signal(int sig) kreason= "KILL_WAIT_TIMEOUT"; break; } - my_safe_printf_stderr("%s", "\n" - "Trying to get some variables.\n" - "Some pointers may be invalid and cause the dump to abort.\n"); - - my_safe_printf_stderr("Query (%p): ", thd->query()); - if (my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length()))) - { - // Query was found invalid. We will try to print it at the end. - print_invalid_query_pointer= true; - } my_safe_printf_stderr("\nConnection ID (thread ID): %lu\n", (ulong) thd->thread_id); - my_safe_printf_stderr("Status: %s\n\n", kreason); + my_safe_printf_stderr("Status: %s\n", kreason); + my_safe_printf_stderr("Query (%p): ", thd->query()); + my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length())); my_safe_printf_stderr("%s", "Optimizer switch: "); ulonglong optsw= thd->variables.optimizer_switch; for (uint i= 0; optimizer_switch_names[i+1]; i++, optsw >>= 1) @@ -313,52 +288,9 @@ extern "C" sig_handler handle_fatal_signal(int sig) } my_safe_printf_stderr("%s", "\n\n"); } - my_safe_printf_stderr("%s", - "The manual page at " - "https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/ contains\n" - "information that should help you find out what is causing the crash.\n"); #endif /* HAVE_STACKTRACE */ -#ifdef HAVE_INITGROUPS - if (calling_initgroups) - { - my_safe_printf_stderr("%s", "\n" - "This crash occurred while the server was calling initgroups(). This is\n" - "often due to the use of a mysqld that is statically linked against \n" - "glibc and configured to use LDAP in /etc/nsswitch.conf.\n" - "You will need to either upgrade to a version of glibc that does not\n" - "have this problem (2.3.4 or later when used with nscd),\n" - "disable LDAP in your nsswitch.conf, or use a " - "mysqld that is not statically linked.\n"); - } -#endif - - if (locked_in_memory) - { - my_safe_printf_stderr("%s", "\n" - "The \"--memlock\" argument, which was enabled, " - "uses system calls that are\n" - "unreliable and unstable on some operating systems and " - "operating-system versions (notably, some versions of Linux).\n" - "This crash could be due to use of those buggy OS calls.\n" - "You should consider whether you really need the " - "\"--memlock\" parameter and/or consult the OS distributer about " - "\"mlockall\" bugs.\n"); - } - -#ifdef HAVE_STACKTRACE - if (print_invalid_query_pointer) - { - my_safe_printf_stderr( - "\nWe think the query pointer is invalid, but we will try " - "to print it anyway. \n" - "Query: "); - my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length())); - my_safe_printf_stderr("\n\n"); - } -#endif - output_core_info(); #ifdef HAVE_WRITE_CORE if (test_flags & TEST_CORE_ON_SIGNAL) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 08858ea0e88..8610f985b94 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -4063,7 +4063,8 @@ bool acl_check_host(const char *host, const char *ip) return 0; mysql_mutex_lock(&acl_cache->lock); - if ((host && my_hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) || + if (allow_all_hosts || + (host && my_hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) || (ip && my_hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip)))) { mysql_mutex_unlock(&acl_cache->lock); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 3c0383ef87f..90844ac1824 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8147,39 +8147,6 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, DBUG_RETURN(thd->is_error()); } -/* - make list of leaves for a single TABLE_LIST - - SYNOPSIS - make_leaves_for_single_table() - thd Thread handler - leaves List of leaf tables to be filled - table TABLE_LIST object to process - full_table_list Whether to include tables from mergeable derived table/view -*/ -void make_leaves_for_single_table(THD *thd, List &leaves, - TABLE_LIST *table, bool& full_table_list, - TABLE_LIST *boundary) -{ - if (table == boundary) - full_table_list= !full_table_list; - if (full_table_list && table->is_merged_derived()) - { - SELECT_LEX *select_lex= table->get_single_select(); - /* - It's safe to use select_lex->leaf_tables because all derived - tables/views were already prepared and has their leaf_tables - set properly. - */ - make_leaves_list(thd, leaves, select_lex->get_table_list(), - full_table_list, boundary); - } - else - { - leaves.push_back(table, thd->mem_root); - } -} - /* Perform checks like all given fields exists, if exists fill struct with @@ -8206,78 +8173,40 @@ int setup_returning_fields(THD* thd, TABLE_LIST* table_list) SYNOPSIS make_leaves_list() - leaves List of leaf tables to be filled - tables Table list - full_table_list Whether to include tables from mergeable derived table/view. - We need them for checks for INSERT/UPDATE statements only. + list pointer to pointer on list first element + tables table list + full_table_list whether to include tables from mergeable derived table/view. + we need them for checks for INSERT/UPDATE statements only. + + RETURN pointer on pointer to next_leaf of last element */ -void make_leaves_list(THD *thd, List &leaves, TABLE_LIST *tables, +void make_leaves_list(THD *thd, List &list, TABLE_LIST *tables, bool full_table_list, TABLE_LIST *boundary) { for (TABLE_LIST *table= tables; table; table= table->next_local) { - make_leaves_for_single_table(thd, leaves, table, full_table_list, - boundary); + if (table == boundary) + full_table_list= !full_table_list; + if (full_table_list && table->is_merged_derived()) + { + SELECT_LEX *select_lex= table->get_single_select(); + /* + It's safe to use select_lex->leaf_tables because all derived + tables/views were already prepared and has their leaf_tables + set properly. + */ + make_leaves_list(thd, list, select_lex->get_table_list(), + full_table_list, boundary); + } + else + { + list.push_back(table, thd->mem_root); + } } } - -/* - Setup the map and other attributes for a single TABLE_LIST object - - SYNOPSIS - setup_table_attributes() - thd Thread handler - table_list TABLE_LIST object to process - first_select_table First table participating in SELECT for INSERT..SELECT - statements, NULL for other cases - tablenr Serial number of the table in the SQL statement - - RETURN - false Success - true Failure -*/ -bool setup_table_attributes(THD *thd, TABLE_LIST *table_list, - TABLE_LIST *first_select_table, - uint &tablenr) -{ - TABLE *table= table_list->table; - if (table && !table->pos_in_table_list) - table->pos_in_table_list= table_list; - if (first_select_table && table_list->top_table() == first_select_table) - { - /* new counting for SELECT of INSERT ... SELECT command */ - first_select_table= 0; - thd->lex->first_select_lex()->insert_tables= tablenr; - tablenr= 0; - } - if (table_list->jtbm_subselect) - { - table_list->jtbm_table_no= tablenr; - } - else if (table) - { - setup_table_map(table, table_list, tablenr); - - if (table_list->process_index_hints(table)) - return true; - } - tablenr++; - /* - We test the max tables here as we setup_table_map() should not be called - with tablenr >= 64 - */ - if (tablenr > MAX_TABLES) - { - my_error(ER_TOO_MANY_TABLES, MYF(0), static_cast(MAX_TABLES)); - return true; - } - return false; -} - - /* prepare tables @@ -8334,14 +8263,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context, leaves.empty(); if (select_lex->prep_leaf_list_state != SELECT_LEX::SAVED) { - /* - For INSERT ... SELECT statements we must not include the first table - (where the data is being inserted into) in the list of leaves - */ - TABLE_LIST *tables_for_leaves= - select_insert ? first_select_table : tables; - make_leaves_list(thd, leaves, tables_for_leaves, full_table_list, - first_select_table); + make_leaves_list(thd, leaves, tables, full_table_list, first_select_table); select_lex->prep_leaf_list_state= SELECT_LEX::READY; select_lex->leaf_tables_exec.empty(); } @@ -8351,35 +8273,51 @@ bool setup_tables(THD *thd, Name_resolution_context *context, while ((table_list= ti++)) leaves.push_back(table_list, thd->mem_root); } - - List_iterator ti(leaves); + + bool is_insert_tables_num_set= false; while ((table_list= ti++)) { - if (setup_table_attributes(thd, table_list, first_select_table, tablenr)) - DBUG_RETURN(1); - } - - if (select_insert) - { - /* - The table/view in which the data is inserted must not be included into - the leaf_tables list. But we need this table/view to setup attributes - for it. So build a temporary list of leaves and setup attributes for - the tables included - */ - List leaves; - TABLE_LIST *table= tables; - - make_leaves_for_single_table(thd, leaves, table, full_table_list, - first_select_table); - - List_iterator ti(leaves); - while ((table_list= ti++)) + TABLE *table= table_list->table; + if (table && !table->pos_in_table_list) + table->pos_in_table_list= table_list; + if (select_insert && !is_insert_tables_num_set && + table_list->top_table() == first_select_table) { - if (setup_table_attributes(thd, table_list, first_select_table, - tablenr)) + /* new counting for SELECT of INSERT ... SELECT command */ + thd->lex->first_select_lex()->insert_tables= tablenr; + is_insert_tables_num_set= true; + tablenr= 0; + } + if(table_list->jtbm_subselect) + { + table_list->jtbm_table_no= tablenr; + } + else if (table) + { + setup_table_map(table, table_list, tablenr); + + if (table_list->process_index_hints(table)) DBUG_RETURN(1); } + tablenr++; + /* + Test MAX_TABLES overflow here inside the loop as setup_table_map() + called in each iteration is sensitive for this + */ + if (tablenr > MAX_TABLES) + { + my_error(ER_TOO_MANY_TABLES, MYF(0), static_cast(MAX_TABLES)); + DBUG_RETURN(1); + } + } + if (select_insert && !is_insert_tables_num_set) + { + /* + This happens for statements like `INSERT INTO t1 SELECT 1`, + when there are no tables in the SELECT part. + In this case all leaf tables belong to the INSERT part + */ + thd->lex->first_select_lex()->insert_tables= tablenr; } } else @@ -9258,22 +9196,13 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, if (!result && triggers) { - void *save_bulk_param= thd->bulk_param; - /* - Reset the sentinel thd->bulk_param in order not to consume the next - values of a bound array in case one of statement executed by - the trigger's body is INSERT statement. - */ - thd->bulk_param= nullptr; if (triggers->process_triggers(thd, event, TRG_ACTION_BEFORE, TRUE) || not_null_fields_have_null_values(table)) { - thd->bulk_param= save_bulk_param; return TRUE; } - thd->bulk_param= save_bulk_param; /* Re-calculate virtual fields to cater for cases when base columns are diff --git a/sql/sql_base.h b/sql/sql_base.h index 24b939a1467..f813833aa5c 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -364,6 +364,7 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr) table->maybe_null= embedding->outer_join; embedding= embedding->embedding; } + DBUG_ASSERT(tablenr <= MAX_TABLES); table->tablenr= tablenr; table->map= (table_map) 1 << tablenr; table->force_index= table->force_index_join= 0; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 08354e0fa2d..175f6ee0861 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -804,9 +804,11 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) Pass nominal parameters to init_alloc_root only to ensure that the destructor works OK in case of an error. The main_mem_root will be re-initialized in init_for_queries(). + The base one will mainly be use to allocate memory during authentication. */ init_sql_alloc(key_memory_thd_main_mem_root, - &main_mem_root, 64, 0, MYF(MY_THREAD_SPECIFIC)); + &main_mem_root, DEFAULT_ROOT_BLOCK_SIZE, 0, + MYF(MY_THREAD_SPECIFIC)); /* Allocation of user variables for binary logging is always done with main @@ -1473,7 +1475,10 @@ void THD::update_stats(void) void THD::update_all_stats() { ulonglong end_cpu_time, end_utime; - double busy_time, cpu_time; + ulonglong busy_time, cpu_time; + + status_var_add(status_var.query_time, + (utime_after_query - utime_after_lock)); /* This is set at start of query if opt_userstat_running was set */ if (!userstat_running) @@ -1481,10 +1486,10 @@ void THD::update_all_stats() end_cpu_time= my_getcputime(); end_utime= microsecond_interval_timer(); - busy_time= (end_utime - start_utime) / 1000000.0; - cpu_time= (end_cpu_time - start_cpu_time) / 10000000.0; + busy_time= end_utime - start_utime; + cpu_time= end_cpu_time - start_cpu_time; /* In case there are bad values, 2629743 is the #seconds in a month. */ - if (cpu_time > 2629743.0) + if (cpu_time > 2629743000000ULL) cpu_time= 0; status_var_add(status_var.cpu_time, cpu_time); status_var_add(status_var.busy_time, busy_time); @@ -1909,6 +1914,7 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) to_var->table_open_cache_hits+= from_var->table_open_cache_hits; to_var->table_open_cache_misses+= from_var->table_open_cache_misses; to_var->table_open_cache_overflows+= from_var->table_open_cache_overflows; + to_var->query_time+= from_var->query_time; /* Update global_memory_used. We have to do this with atomic_add as the @@ -1966,6 +1972,7 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, dec_var->table_open_cache_misses; to_var->table_open_cache_overflows+= from_var->table_open_cache_overflows - dec_var->table_open_cache_overflows; + to_var->query_time+= from_var->query_time - dec_var->query_time; /* We don't need to accumulate memory_used as these are not reset or used by @@ -5888,6 +5895,20 @@ extern "C" void *thd_mdl_context(MYSQL_THD thd) return &thd->mdl_context; } + +/** + log_warnings accessor + @param thd the current session + + @return log warning level +*/ + +extern "C" int thd_log_warnings(const MYSQL_THD thd) +{ + return thd->variables.log_warnings; +} + + /** Send check/repair message to the user diff --git a/sql/sql_class.h b/sql/sql_class.h index c9e6d8d5f2d..16ce6aa0c20 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1052,9 +1052,8 @@ typedef struct system_status_var ulonglong table_open_cache_hits; ulonglong table_open_cache_misses; ulonglong table_open_cache_overflows; - ulonglong send_metadata_skips; + ulonglong cpu_time, busy_time, query_time; double last_query_cost; - double cpu_time, busy_time; uint32 threads_running; /* Don't initialize */ /* Memory used for thread local storage */ @@ -3413,8 +3412,8 @@ public: { bzero((char*)this, sizeof(*this)); implicit_xid.null(); - init_sql_alloc(key_memory_thd_transactions, &mem_root, 256, - 0, MYF(MY_THREAD_SPECIFIC)); + init_sql_alloc(key_memory_thd_transactions, &mem_root, + DEFAULT_ROOT_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC)); } } default_transaction, *transaction; Global_read_lock global_read_lock; diff --git a/sql/sql_const.h b/sql/sql_const.h index 1e5fef4af36..58e4a27dff8 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -180,21 +180,26 @@ #define MYSQLD_NET_RETRY_COUNT 10 ///< Abort read after this many int. #endif -#define QUERY_ALLOC_BLOCK_SIZE 16384 -#define QUERY_ALLOC_PREALLOC_SIZE 24576 +/* + Allocations with MEM_ROOT. We should try to keep these as powers of 2 + and not higher than 32768 to get full benefit of allocators like + tcmalloc that will for these use a local heap without locks. +*/ + +#define QUERY_ALLOC_BLOCK_SIZE 32768 +#define QUERY_ALLOC_PREALLOC_SIZE 32768 /* 65536 could be better */ #define TRANS_ALLOC_BLOCK_SIZE 8192 #define TRANS_ALLOC_PREALLOC_SIZE 4096 #define RANGE_ALLOC_BLOCK_SIZE 4096 #define ACL_ALLOC_BLOCK_SIZE 1024 #define UDF_ALLOC_BLOCK_SIZE 1024 -#define TABLE_ALLOC_BLOCK_SIZE 1024 +#define TABLE_PREALLOC_BLOCK_SIZE 8192 +#define TABLE_ALLOC_BLOCK_SIZE 4096 #define WARN_ALLOC_BLOCK_SIZE 2048 #define WARN_ALLOC_PREALLOC_SIZE 1024 -/* - Note that if we are using 32K or less, then TCmalloc will use a local - heap without locks! -*/ -#define SHOW_ALLOC_BLOCK_SIZE (32768-MALLOC_OVERHEAD) +#define TMP_TABLE_BLOCK_SIZE 16384 +#define TMP_TABLE_PREALLOC_SIZE 32768 +#define SHOW_ALLOC_BLOCK_SIZE 32768 /* The following parameters is to decide when to use an extra cache to diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 68598c0e8ee..dd842f0f1c0 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -822,17 +822,13 @@ bool Sql_cmd_delete::delete_from_single_table(THD *thd) delete_history); if (delete_record) { - void *save_bulk_param= thd->bulk_param; - thd->bulk_param= nullptr; if (!delete_history && table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_DELETE, TRG_ACTION_BEFORE, FALSE)) { error= 1; - thd->bulk_param= save_bulk_param; break; } - thd->bulk_param= save_bulk_param; // no LIMIT / OFFSET if (returning && result->send_data(returning->item_list) < 0) @@ -863,16 +859,13 @@ bool Sql_cmd_delete::delete_from_single_table(THD *thd) if (likely(!error)) { deleted++; - thd->bulk_param= nullptr; if (!delete_history && table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_DELETE, TRG_ACTION_AFTER, FALSE)) { error= 1; - thd->bulk_param= save_bulk_param; break; } - thd->bulk_param= save_bulk_param; if (!--limit && using_limit) { error= -1; diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 2fb1133892f..89dde3cf190 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -693,6 +693,7 @@ Sql_condition *Warning_info::push_warning(THD *thd, ulong current_row_number) { Sql_condition *cond= NULL; + DBUG_ASSERT(msg[strlen(msg)-1] != '\n'); if (! m_read_only) { diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index ff61626e744..aeec856bbc5 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -713,7 +713,7 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler, MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set); int res= item->save_in_field(key_part->field, 1); dbug_tmp_restore_column_map(&table->write_set, old_map); - if (res) + if (res < 0 || thd->is_error()) return 1; } key_len+= key_part->store_length; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 680097c8f56..28641ddf845 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1103,21 +1103,12 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, } table->reset_default_fields(); - /* - Reset the sentinel thd->bulk_param in order not to consume the next - values of a bound array in case one of statement executed by - the trigger's body is INSERT statement. - */ - void *save_bulk_param= thd->bulk_param; - thd->bulk_param= nullptr; - if (unlikely(fill_record_n_invoke_before_triggers(thd, table, table-> field_to_fill(), *values, 0, TRG_EVENT_INSERT))) { - thd->bulk_param= save_bulk_param; if (values_list.elements != 1 && ! thd->is_error()) { info.records++; @@ -1126,7 +1117,6 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, error=1; break; } - thd->bulk_param= save_bulk_param; } /* @@ -1633,7 +1623,8 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list, if (insert_into_view && !fields.elements) { thd->lex->empty_field_list_on_rset= 1; - if (!table_list->table || table_list->is_multitable()) + if (!thd->lex->first_select_lex()->leaf_tables.head()->table || + table_list->is_multitable()) { my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0), table_list->view_db.str, table_list->view_name.str); @@ -3943,6 +3934,7 @@ int mysql_insert_select_prepare(THD *thd, select_result *sel_res) if (sel_res) sel_res->prepare(lex->returning()->item_list, NULL); + DBUG_ASSERT(select_lex->leaf_tables.elements != 0); List_iterator ti(select_lex->leaf_tables); TABLE_LIST *table; uint insert_tables; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ca3a6f33b28..c147e3bc036 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1154,8 +1154,7 @@ static bool wsrep_command_no_result(char command) { return (command == COM_STMT_FETCH || command == COM_STMT_SEND_LONG_DATA || - command == COM_STMT_CLOSE || - command == COM_STMT_PREPARE); + command == COM_STMT_CLOSE); } #endif /* WITH_WSREP */ #ifndef EMBEDDED_LIBRARY @@ -2399,13 +2398,23 @@ resume: { DEBUG_SYNC(thd, "wsrep_at_dispatch_end_before_result"); } - wsrep_after_command_before_result(thd); - if (wsrep_current_error(thd) && !wsrep_command_no_result(command)) + if (thd->wsrep_cs().state() == wsrep::client_state::s_exec) { - /* todo: Pass wsrep client state current error to override */ - wsrep_override_error(thd, wsrep_current_error(thd), - wsrep_current_error_status(thd)); - WSREP_LOG_THD(thd, "leave"); + wsrep_after_command_before_result(thd); + if (wsrep_current_error(thd) && !wsrep_command_no_result(command)) + { + /* todo: Pass wsrep client state current error to override */ + wsrep_override_error(thd, wsrep_current_error(thd), + wsrep_current_error_status(thd)); + WSREP_LOG_THD(thd, "leave"); + } + } + else + { + /* wsrep_after_command_before_result() already called elsewhere + or not necessary to call it */ + assert(thd->wsrep_cs().state() == wsrep::client_state::s_none || + thd->wsrep_cs().state() == wsrep::client_state::s_result); } if (WSREP(thd)) { diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 0fa22875150..e004c240df4 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1615,9 +1615,9 @@ int plugin_init(int *argc, char **argv, int flags) init_plugin_psi_keys(); - init_alloc_root(key_memory_plugin_mem_root, &plugin_mem_root, 4096, 4096, MYF(0)); - init_alloc_root(key_memory_plugin_mem_root, &plugin_vars_mem_root, 4096, 4096, MYF(0)); - init_alloc_root(PSI_NOT_INSTRUMENTED, &tmp_root, 4096, 4096, MYF(0)); + init_alloc_root(key_memory_plugin_mem_root, &plugin_mem_root, 4096, 16384, MYF(0)); + init_alloc_root(key_memory_plugin_mem_root, &plugin_vars_mem_root, 4096, 32768, MYF(0)); + init_alloc_root(PSI_NOT_INSTRUMENTED, &tmp_root, 16384, 32768, MYF(0)); if (my_hash_init(key_memory_plugin_bookmark, &bookmark_hash, &my_charset_bin, 32, 0, 0, get_bookmark_hash_key, NULL, HASH_UNIQUE)) diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index d9e48ff64b1..60ff6859e4c 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -26,7 +26,7 @@ SHOW_LONG_NOFLUSH, SHOW_LEX_STRING, SHOW_ATOMIC_COUNTER_UINT32_T, \ /* SHOW_*_STATUS must be at the end, SHOW_LONG_STATUS being first */ \ SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, SHOW_LONGLONG_STATUS, \ - SHOW_UINT32_STATUS + SHOW_UINT32_STATUS, SHOW_MICROSECOND_STATUS, #include "mariadb.h" #undef SHOW_always_last diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 6fe5fde2a8c..ae1fa5ff38e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2267,6 +2267,16 @@ static bool check_prepared_statement(Prepared_statement *stmt) #ifdef WITH_WSREP if (wsrep_sync_wait(thd, sql_command)) goto error; + if (!stmt->is_sql_prepare()) + { + wsrep_after_command_before_result(thd); + if (wsrep_current_error(thd)) + { + wsrep_override_error(thd, wsrep_current_error(thd), + wsrep_current_error_status(thd)); + goto error; + } + } #endif switch (sql_command) { case SQLCOM_REPLACE: diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 22bc1befa6e..a2992c19dc6 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -436,7 +436,6 @@ static int send_file(THD *thd) Internal to mysql_binlog_send() routine that recalculates checksum for 1. FD event (asserted) that needs additional arrangement prior sending to slave. 2. Start_encryption_log_event whose Ignored flag is set -TODO DBUG_ASSERT can be removed if this function is used for more general cases */ inline void fix_checksum(enum_binlog_checksum_alg checksum_alg, String *packet, @@ -448,13 +447,6 @@ inline void fix_checksum(enum_binlog_checksum_alg checksum_alg, String *packet, /* recalculate the crc for this event */ uint data_len = uint4korr(packet->ptr() + ev_offset + EVENT_LEN_OFFSET); ha_checksum crc; - DBUG_ASSERT((data_len == - LOG_EVENT_MINIMAL_HEADER_LEN + FORMAT_DESCRIPTION_HEADER_LEN + - BINLOG_CHECKSUM_ALG_DESC_LEN + BINLOG_CHECKSUM_LEN) || - (data_len == - LOG_EVENT_MINIMAL_HEADER_LEN + BINLOG_CRYPTO_SCHEME_LENGTH + - BINLOG_KEY_VERSION_LENGTH + BINLOG_NONCE_LENGTH + - BINLOG_CHECKSUM_LEN)); crc= my_checksum(0, (uchar *)packet->ptr() + ev_offset, data_len - BINLOG_CHECKSUM_LEN); int4store(packet->ptr() + ev_offset + data_len - BINLOG_CHECKSUM_LEN, crc); @@ -4514,7 +4506,7 @@ bool mysql_show_binlog_events(THD* thd) if (lex_mi->pos > binlog_size) { snprintf(errmsg_buf, sizeof(errmsg_buf), "Invalid pos specified. Requested from pos:%llu is " - "greater than actual file size:%lu\n", lex_mi->pos, + "greater than actual file size:%lu", lex_mi->pos, (ulong)s.st_size); errmsg= errmsg_buf; goto err; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0324aeb5cd1..c3f50989e06 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2214,6 +2214,7 @@ JOIN::optimize_inner() /* Merge all mergeable derived tables/views in this SELECT. */ if (select_lex->handle_derived(thd->lex, DT_MERGE)) DBUG_RETURN(TRUE); + table_count= select_lex->leaf_tables.elements; } if (select_lex->first_cond_optimization && @@ -2261,6 +2262,8 @@ JOIN::optimize_inner() eval_select_list_used_tables(); + table_count= select_lex->leaf_tables.elements; + if (select_lex->options & OPTION_SCHEMA_TABLE && optimize_schema_tables_memory_usage(select_lex->leaf_tables)) DBUG_RETURN(1); @@ -16955,6 +16958,7 @@ void JOIN::cleanup(bool full) /* Free the original optimized join created for the group_by_handler */ join_tab= original_join_tab; original_join_tab= 0; + table_count= original_table_count; } if (join_tab) @@ -21700,8 +21704,8 @@ TABLE *Create_tmp_table::start(THD *thd, copy_func_count+= param->sum_func_count; param->copy_func_count= copy_func_count; - init_sql_alloc(key_memory_TABLE, &own_root, TABLE_ALLOC_BLOCK_SIZE, 0, - MYF(MY_THREAD_SPECIFIC)); + init_sql_alloc(key_memory_TABLE, &own_root, TMP_TABLE_BLOCK_SIZE, + TMP_TABLE_PREALLOC_SIZE, MYF(MY_THREAD_SPECIFIC)); if (!multi_alloc_root(&own_root, &table, sizeof(*table), @@ -22230,7 +22234,7 @@ bool Create_tmp_table::finalize(THD *thd, MY_MIN(thd->variables.tmp_memory_table_size, thd->variables.max_heap_table_size) : thd->variables.tmp_disk_table_size) / - share->reclength); + MY_ALIGN(share->reclength, sizeof(char*))); set_if_bigger(share->max_rows,1); // For dummy start options /* Push the LIMIT clause to the temporary table creation, so that we diff --git a/sql/sql_select.h b/sql/sql_select.h index faea74b6ce7..9f2cc464e2e 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1442,6 +1442,7 @@ public: Pushdown_query *pushdown_query; JOIN_TAB *original_join_tab; + uint original_table_count; uint sort_space; /******* Join optimization state members start *******/ diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 15fa00199f2..6d84d510c5e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3764,6 +3764,16 @@ const char* get_one_variable(THD *thd, case SHOW_SLONGLONG: end= longlong10_to_str(*value.as_longlong, buff, -10); break; + case SHOW_MICROSECOND_STATUS: + { + /* Show a long long as double in seconds */ + ulonglong microseconds; + value.as_char= status_var_value.as_char + value.as_intptr; + microseconds= *value.as_longlong; + /* 6 is the default precision for '%f' in sprintf() */ + end= buff + my_fcvt(microseconds / 1000000.0, 6, buff, NULL); + break; + } case SHOW_HAVE: { pos= show_comp_option_name[(int) *value.as_show_comp_options]; diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index e34e57ad7ef..68fc150b09c 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -2517,6 +2517,14 @@ bool Table_triggers_list::process_triggers(THD *thd, */ save_current_select= thd->lex->current_select; + /* + Reset the sentinel thd->bulk_param in order not to consume the next + values of a bound array in case one of statement executed by + the trigger's body is a DML statement. + */ + void *save_bulk_param= thd->bulk_param; + thd->bulk_param= nullptr; + do { thd->lex->current_select= NULL; err_status= @@ -2526,6 +2534,7 @@ bool Table_triggers_list::process_triggers(THD *thd, &trigger->subject_table_grants); status_var_increment(thd->status_var.executed_triggers); } while (!err_status && (trigger= trigger->next)); + thd->bulk_param= save_bulk_param; thd->lex->current_select= save_current_select; thd->restore_sub_statement_state(&statement_state); diff --git a/sql/sql_union.cc b/sql/sql_union.cc index eca490e83e5..ca067df03eb 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1024,7 +1024,8 @@ bool select_union_direct::send_eof() // Reset for each SELECT_LEX, so accumulate here limit_found_rows+= thd->limit_found_rows; - if (unit->thd->lex->current_select == last_select_lex) + if (unit->thd->lex->current_select == last_select_lex || + thd->killed == ABORT_QUERY) { thd->limit_found_rows= limit_found_rows; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index f54e094349f..1e425911de0 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1070,19 +1070,14 @@ error: rows_inserted++; } - void *save_bulk_param= thd->bulk_param; - thd->bulk_param= nullptr; - if (table->triggers && unlikely(table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE))) { error= 1; - thd->bulk_param= save_bulk_param; break; } - thd->bulk_param= save_bulk_param; if (!--limit && using_limit) { diff --git a/sql/sql_window.cc b/sql/sql_window.cc index a578fd6fcab..94b9f0467fb 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -2534,7 +2534,7 @@ Frame_cursor *get_frame_cursor(THD *thd, Window_spec *spec, bool is_top_bound) } static -void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, +bool add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, Item_window_func *window_func) { Window_spec *spec= window_func->window_spec; @@ -2621,7 +2621,9 @@ void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, Item *offset_func= new (thd->mem_root) Item_func_minus(thd, item_sum->get_arg(1), int_item); - offset_func->fix_fields(thd, &offset_func); + if (offset_func->fix_fields(thd, &offset_func)) + return true; + fc= new Frame_positional_cursor(*top_bound, *top_bound, *bottom_bound, *offset_func, false); @@ -2654,6 +2656,7 @@ void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, fc->add_sum_func(item_sum); cursor_manager->add_cursor(fc); } + return false; } @@ -2681,7 +2684,7 @@ static bool is_computed_with_remove(Item_sum::Sumfunctype sum_func) If the window functions share the same frame specification, those window functions will be registered to the same cursor. */ -void get_window_functions_required_cursors( +bool get_window_functions_required_cursors( THD *thd, List& window_functions, List *cursor_managers) @@ -2732,7 +2735,11 @@ void get_window_functions_required_cursors( if (item_win_func->is_frame_prohibited() || item_win_func->requires_special_cursors()) { - add_special_frame_cursors(thd, cursor_manager, item_win_func); + if (add_special_frame_cursors(thd, cursor_manager, item_win_func)) + { + delete cursor_manager; + return true; + } cursor_managers->push_back(cursor_manager); continue; } @@ -2766,6 +2773,7 @@ void get_window_functions_required_cursors( } cursor_managers->push_back(cursor_manager); } + return false; } /** @@ -3041,8 +3049,9 @@ bool Window_func_runner::exec(THD *thd, TABLE *tbl, SORT_INFO *filesort_result) it.rewind(); List cursor_managers; - get_window_functions_required_cursors(thd, window_functions, - &cursor_managers); + if (get_window_functions_required_cursors(thd, window_functions, + &cursor_managers)) + return true; /* Go through the sorted array and compute the window function */ bool is_error= compute_window_func(thd, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index dc97f505ae1..1f868846f00 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7356,6 +7356,7 @@ alter: { LEX *lex= Lex; lex->sql_command= SQLCOM_ALTER_SEQUENCE; + lex->create_info.init(); DBUG_ASSERT(!lex->m_sql_cmd); if (Lex->main_select_push()) MYSQL_YYABORT; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 633918c833b..f3cca3c1527 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3072,6 +3072,14 @@ static Sys_var_proxy_user Sys_proxy_user( static Sys_var_external_user Sys_exterenal_user( "external_user", "The external user account used when logging in"); + +static bool update_record_cache(sys_var *self, THD *thd, enum_var_type type) +{ + if (type == OPT_GLOBAL) + my_default_record_cache_size= global_system_variables.read_buff_size; + return false; +} + static Sys_var_ulong Sys_read_buff_size( "read_buffer_size", "Each thread that does a sequential scan allocates a buffer of " @@ -3079,7 +3087,8 @@ static Sys_var_ulong Sys_read_buff_size( "you may want to increase this value", SESSION_VAR(read_buff_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(128*1024), - BLOCK_SIZE(IO_SIZE)); + BLOCK_SIZE(IO_SIZE), NO_MUTEX_GUARD, NOT_IN_BINLOG, + ON_CHECK(0), ON_UPDATE(update_record_cache)); static bool check_read_only(sys_var *self, THD *thd, set_var *var) { @@ -4419,7 +4428,7 @@ static Sys_var_ulonglong Sys_tmp_table_size( "will automatically convert it to an on-disk MyISAM or Aria table.", SESSION_VAR(tmp_memory_table_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024), - BLOCK_SIZE(1)); + BLOCK_SIZE(16384)); static Sys_var_ulonglong Sys_tmp_memory_table_size( "tmp_memory_table_size", @@ -4428,7 +4437,7 @@ static Sys_var_ulonglong Sys_tmp_memory_table_size( "Same as tmp_table_size.", SESSION_VAR(tmp_memory_table_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024), - BLOCK_SIZE(1)); + BLOCK_SIZE(16384)); static Sys_var_ulonglong Sys_tmp_disk_table_size( "tmp_disk_table_size", diff --git a/sql/table.cc b/sql/table.cc index 7ad11749427..58de5076b69 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -352,8 +352,8 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, path_length= build_table_filename(path, sizeof(path) - 1, db, table_name, "", 0); - init_sql_alloc(key_memory_table_share, &mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, - MYF(0)); + init_sql_alloc(key_memory_table_share, &mem_root, TABLE_ALLOC_BLOCK_SIZE, + TABLE_PREALLOC_BLOCK_SIZE, MYF(0)); if (multi_alloc_root(&mem_root, &share, sizeof(*share), &key_buff, key_length, @@ -442,10 +442,12 @@ void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key, bzero((char*) share, sizeof(*share)); /* This can't be MY_THREAD_SPECIFIC for slaves as they are freed - during cleanup() from Relay_log_info::close_temporary_tables() + during cleanup() from Relay_log_info::close_temporary_tables(). + We can also not use pre-alloc here, as internal temporary tables + are not freeing table->share->mem_root */ init_sql_alloc(key_memory_table_share, &share->mem_root, - TABLE_ALLOC_BLOCK_SIZE, 0, + TABLE_PREALLOC_BLOCK_SIZE, 0, MYF(thd->slave_thread ? 0 : MY_THREAD_SPECIFIC)); share->table_category= TABLE_CATEGORY_TEMPORARY; share->tmp_table= INTERNAL_TMP_TABLE; @@ -4118,7 +4120,7 @@ static void print_long_unique_table(TABLE *table) "table->field[%u]->offset = %" PRIdPTR "\n" // `%td` not available "table->field[%u]->field_length = %d\n" "table->field[%u]->null_pos wrt to record 0 = %" PRIdPTR "\n" - "table->field[%u]->null_bit_pos = %d\n", + "table->field[%u]->null_bit_pos = %d", i, field->field_name.str, i, field->ptr- table->record[0], i, field->pack_length(), @@ -4269,7 +4271,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, goto err; } init_sql_alloc(key_memory_TABLE, &outparam->mem_root, TABLE_ALLOC_BLOCK_SIZE, - 0, MYF(0)); + TABLE_PREALLOC_BLOCK_SIZE, MYF(0)); /* We have to store the original alias in mem_root as constraints and virtual @@ -4647,8 +4649,8 @@ partititon_err: thd->lex->context_analysis_only= save_context_analysis_only; DBUG_EXECUTE_IF("print_long_unique_internal_state", - print_long_unique_table(outparam);); - DBUG_RETURN (OPEN_FRM_OK); + print_long_unique_table(outparam);); + DBUG_RETURN(OPEN_FRM_OK); err: if (! error_reported) @@ -10256,7 +10258,14 @@ bool TABLE_LIST::is_the_same_definition(THD* thd, TABLE_SHARE *s) tabledef_version.length= 0; } else + { set_tabledef_version(s); + if (m_table_ref_type == TABLE_REF_NULL) + { + set_table_ref_id(s); + return TRUE; + } + } return FALSE; } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index fc4905562c5..0bf5d083d26 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1608,35 +1608,7 @@ bool wsrep_sync_wait (THD* thd, uint mask) This allows autocommit SELECTs and a first SELECT after SET AUTOCOMMIT=0 TODO: modify to check if thd has locked any rows. */ - if (thd->wsrep_cs().sync_wait(-1)) - { - const char* msg; - int err; - - /* - Possibly relevant error codes: - ER_CHECKREAD, ER_ERROR_ON_READ, ER_INVALID_DEFAULT, ER_EMPTY_QUERY, - ER_FUNCTION_NOT_DEFINED, ER_NOT_ALLOWED_COMMAND, ER_NOT_SUPPORTED_YET, - ER_FEATURE_DISABLED, ER_QUERY_INTERRUPTED - */ - - switch (thd->wsrep_cs().current_error()) - { - case wsrep::e_not_supported_error: - msg= "synchronous reads by wsrep backend. " - "Please unset wsrep_sync_wait variable."; - err= ER_NOT_SUPPORTED_YET; - break; - default: - msg= "Synchronous wait failed."; - err= ER_LOCK_WAIT_TIMEOUT; // NOTE: the above msg won't be displayed - // with ER_LOCK_WAIT_TIMEOUT - } - - my_error(err, MYF(0), msg); - - return true; - } + return thd->wsrep_cs().sync_wait(-1); } return false; diff --git a/storage/connect/domdoc.cpp b/storage/connect/domdoc.cpp index b881a10628e..13f3180a59c 100644 --- a/storage/connect/domdoc.cpp +++ b/storage/connect/domdoc.cpp @@ -243,8 +243,10 @@ int DOMDOC::DumpDoc(PGLOBAL g, char *ofn) try { Docp->save(ofn); } catch(_com_error e) { - snprintf(g->Message, sizeof(g->Message), "%s: %s", MSG(COM_ERROR), - _com_util::ConvertBSTRToString(e.Description())); + int i = snprintf(g->Message, sizeof(g->Message), "%s: %s", MSG(COM_ERROR), + _com_util::ConvertBSTRToString(e.Description())); + for (i--; i >= 0 && g->Message[i] == '\n'; i--) + g->Message[i] = 0; rc = -1; } catch(...) {} diff --git a/storage/example/mysql-test/mtr/t/test2.rdiff b/storage/example/mysql-test/mtr/t/test2.rdiff index b0bf2fdfe4d..e0e67630df3 100644 --- a/storage/example/mysql-test/mtr/t/test2.rdiff +++ b/storage/example/mysql-test/mtr/t/test2.rdiff @@ -1,5 +1,5 @@ ---- /usr/home/serg/Abk/mysql/5.1/mysql-test/suite/mtr/t/test2.result 2012-02-04 21:15:14.000000000 +0100 -+++ /usr/home/serg/Abk/mysql/5.1/mysql-test/suite/mtr/t/test2.reject 2012-02-04 21:31:45.000000000 +0100 +--- /usr/home/serg/Abk/mysql/5.1/mysql-test/suite/mtr/t/test2.result ++++ /usr/home/serg/Abk/mysql/5.1/mysql-test/suite/mtr/t/test2.reject @@ -1,4 +1,4 @@ select @@local_infile; select @@max_error_count; diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 187d65b050e..08f235c843a 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -678,7 +678,7 @@ static int heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table, case HA_KEY_ALG_UNDEF: case HA_KEY_ALG_HASH: keydef[key].algorithm= HA_KEY_ALG_HASH; - mem_per_row+= sizeof(char*) * 2; // = sizeof(HASH_INFO) + mem_per_row+= sizeof(HASH_INFO); break; case HA_KEY_ALG_BTREE: keydef[key].algorithm= HA_KEY_ALG_BTREE; @@ -747,7 +747,6 @@ static int heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table, } } } - mem_per_row+= MY_ALIGN(MY_MAX(share->reclength, sizeof(char*)) + 1, sizeof(char*)); if (table_arg->found_next_number_field) { keydef[share->next_number_index].flag|= HA_AUTO_KEY; @@ -755,11 +754,18 @@ static int heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table, } hp_create_info->auto_key= auto_key; hp_create_info->auto_key_type= auto_key_type; - hp_create_info->max_table_size=current_thd->variables.max_heap_table_size; + hp_create_info->max_table_size= MY_MAX(current_thd->variables.max_heap_table_size, sizeof(HP_PTRS)); hp_create_info->with_auto_increment= found_real_auto_increment; hp_create_info->internal_table= internal_table; - max_rows= (ha_rows) (hp_create_info->max_table_size / mem_per_row); + max_rows= hp_rows_in_memory(share->reclength, mem_per_row, + hp_create_info->max_table_size); +#ifdef GIVE_ERROR_IF_NOT_MEMORY_TO_INSERT_ONE_ROW + /* We do not give the error now but instead give an error on first insert */ + if (!max_rows) + return HA_WRONG_CREATE_OPTION; +#endif + if (share->max_rows && share->max_rows < max_rows) max_rows= share->max_rows; diff --git a/storage/heap/heapdef.h b/storage/heap/heapdef.h index ffd5382b6f7..e51fe88d8e2 100644 --- a/storage/heap/heapdef.h +++ b/storage/heap/heapdef.h @@ -100,6 +100,9 @@ extern void hp_clear(HP_SHARE *info); extern void hp_clear_keys(HP_SHARE *info); extern uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, key_part_map keypart_map); +extern ha_rows hp_rows_in_memory(size_t reclength, size_t index_size, + size_t memory_limit); +extern size_t hp_memory_needed_per_row(size_t reclength); extern mysql_mutex_t THR_LOCK_heap; diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c index 324efc8b4af..44bca363746 100644 --- a/storage/heap/hp_block.c +++ b/storage/heap/hp_block.c @@ -75,9 +75,11 @@ int hp_get_new_block(HP_SHARE *info, HP_BLOCK *block, size_t *alloc_length) Next time we allocate data for X rows. When level 1 is full, we allocate data for HP_PTRS_IN_NOD at level 2 and 1 + X rows at level 0. - */ + */ *alloc_length= (sizeof(HP_PTRS) * ((i == block->levels) ? i : i - 1) + (ulonglong)block->records_in_block * block->recbuffer); + /* Alloc in blocks of powers of 2 */ + *alloc_length= MY_MAX(*alloc_length, block->alloc_size); if (!(root=(HP_PTRS*) my_malloc(hp_key_memory_HP_PTRS, *alloc_length, MYF(MY_WME | (info->internal ? diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index c07a1e968c4..f35e8e3fac9 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -15,11 +15,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ #include "heapdef.h" +#include static int keys_compare(void *heap_rb, const void *key1, const void *key2); -static void init_block(HP_BLOCK *block,uint reclength,ulong min_records, +static void init_block(HP_BLOCK *block, size_t reclength, ulong min_records, ulong max_records); + +/* + In how many parts are we going to do allocations of memory and indexes + If we assigne 1M to the heap table memory, we will allocate roughly + (1M/16) bytes per allocaiton +*/ +static const int heap_allocation_parts= 16; + +/* min block allocation */ +static const ulong heap_min_allocation_block= 16384; + /* Create a heap table */ int heap_create(const char *name, HP_CREATE_INFO *create_info, @@ -170,7 +182,8 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, share->keydef= (HP_KEYDEF*) (share + 1); share->key_stat_version= 1; keyseg= (HA_KEYSEG*) (share->keydef + keys); - init_block(&share->block, visible_offset + 1, min_records, max_records); + init_block(&share->block, hp_memory_needed_per_row(reclength), + min_records, max_records); /* Fix keys */ memcpy(share->keydef, keydef, (size_t) (sizeof(keydef[0]) * keys)); for (i= 0, keyinfo= share->keydef; i < keys; i++, keyinfo++) @@ -266,44 +279,90 @@ static int keys_compare(void *heap_rb_, const void *key1_, heap_rb->search_flag, not_used); } -static void init_block(HP_BLOCK *block, uint reclength, ulong min_records, + +/* + Calculate length needed for storing one row +*/ + +size_t hp_memory_needed_per_row(size_t reclength) +{ + /* Data needed for storing record + pointer to records */ + reclength= MY_MAX(reclength, sizeof(char*)); + /* The + 1 below is for the delete marker at the end of record*/ + reclength= MY_ALIGN(reclength+1, sizeof(char*)); + return reclength; +} + +/* + Calculate the number of rows that fits into a given memory size +*/ + +ha_rows hp_rows_in_memory(size_t reclength, size_t index_size, + size_t memory_limit) +{ + reclength= hp_memory_needed_per_row(reclength); + if ((memory_limit < index_size + reclength + sizeof(HP_PTRS))) + return 0; /* Wrong arguments */ + return (ha_rows) ((memory_limit - sizeof(HP_PTRS)) / + (index_size + reclength)); +} + + +static void init_block(HP_BLOCK *block, size_t reclength, ulong min_records, ulong max_records) { - ulong i,recbuffer,records_in_block; + ulong i,records_in_block; + ulong recbuffer= (ulong) MY_ALIGN(reclength, sizeof(uchar*)); + ulong extra; + ulonglong memory_needed; + size_t alloc_size; /* If not min_records and max_records are given, optimize for 1000 rows */ if (!min_records) - min_records= MY_MIN(1000, max_records); + min_records= MY_MIN(1000, max_records / heap_allocation_parts); if (!max_records) max_records= MY_MAX(min_records, 1000); + min_records= MY_MIN(min_records, max_records); - /* + /* We don't want too few records_in_block as otherwise the overhead of of the HP_PTRS block will be too notable */ - records_in_block= MY_MAX(1000, min_records); - records_in_block= MY_MIN(records_in_block, max_records); - /* If big max_records is given, allocate bigger blocks */ - records_in_block= MY_MAX(records_in_block, max_records / 10); + records_in_block= MY_MAX(min_records, max_records / heap_allocation_parts); + + /* + Align allocation sizes to power of 2 to get less memory fragmentation from + system alloc(). + As long as we have less than 128 allocations, all but one of the + allocations will have an extra HP_PTRS size structure at the start + of the block. + + We ensure that the block is not smaller than heap_min_allocation_block + as otherwise we get strange results when max_records < + heap_allocation_parts) + */ + extra= sizeof(HP_PTRS) + MALLOC_OVERHEAD; + /* We don't want too few blocks per row either */ if (records_in_block < 10) - records_in_block= 10; + records_in_block= MY_MIN(10, max_records); + memory_needed= MY_MAX(((ulonglong) records_in_block * recbuffer + extra), + (ulonglong) heap_min_allocation_block); + + /* We have to limit memory to INT_MAX32 as my_round_up_to_next_power() is 32 bit */ + memory_needed= MY_MIN(memory_needed, (ulonglong) INT_MAX32); + alloc_size= my_round_up_to_next_power((uint32)memory_needed); + records_in_block= (ulong) ((alloc_size - extra)/ recbuffer); + + DBUG_PRINT("info", ("records_in_block: %lu" ,records_in_block)); - recbuffer= (uint) (reclength + sizeof(uchar**) - 1) & ~(sizeof(uchar**) - 1); - /* - Don't allocate more than my_default_record_cache_size per level. - The + 1 is there to ensure that we get at least 1 row per level (for - the exceptional case of very long rows) - */ - if ((ulonglong) records_in_block*recbuffer > - (my_default_record_cache_size-sizeof(HP_PTRS)*HP_MAX_LEVELS)) - records_in_block= (my_default_record_cache_size - sizeof(HP_PTRS) * - HP_MAX_LEVELS) / recbuffer + 1; block->records_in_block= records_in_block; block->recbuffer= recbuffer; block->last_allocated= 0L; + /* All alloctions are done with this size, if possible */ + block->alloc_size= alloc_size - MALLOC_OVERHEAD; for (i= 0; i <= HP_MAX_LEVELS; i++) block->level_info[i].records_under_level= diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c index 5469784c8c1..cb079eac757 100644 --- a/storage/heap/hp_write.c +++ b/storage/heap/hp_write.c @@ -145,21 +145,22 @@ static uchar *next_free_record_pos(HP_SHARE *info) DBUG_PRINT("exit",("Used old position: %p", pos)); DBUG_RETURN(pos); } - if ((info->records > info->max_records && info->max_records) || - (info->data_length + info->index_length >= info->max_table_size)) - { - DBUG_PRINT("error", - ("record file full. records: %lu max_records: %lu " - "data_length: %llu index_length: %llu " - "max_table_size: %llu", - info->records, info->max_records, - info->data_length, info->index_length, - info->max_table_size)); - my_errno=HA_ERR_RECORD_FILE_FULL; - DBUG_RETURN(NULL); - } if (!(block_pos=(info->records % info->block.records_in_block))) { + if ((info->records > info->max_records && info->max_records) || + (info->data_length + info->index_length >= info->max_table_size)) + { + DBUG_PRINT("error", + ("record file full. records: %lu max_records: %lu " + "data_length: %llu index_length: %llu " + "max_table_size: %llu", + info->records, info->max_records, + info->data_length, info->index_length, + info->max_table_size)); + my_errno=HA_ERR_RECORD_FILE_FULL; + DBUG_RETURN(NULL); + } + if (hp_get_new_block(info, &info->block,&length)) DBUG_RETURN(NULL); info->data_length+=length; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 5343e01cafb..70614750684 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1736,7 +1736,7 @@ struct find_interesting_trx { void operator()(const trx_t &trx) { - if (trx.state == TRX_STATE_NOT_STARTED) + if (!trx.is_started()) return; if (trx.mysql_thd == nullptr) return; @@ -1745,12 +1745,12 @@ struct find_interesting_trx if (!found) { - ib::warn() << "The following trx might hold " + sql_print_warning("InnoDB: The following trx might hold " "the blocks in buffer pool to " "be withdrawn. Buffer pool " "resizing can complete only " "after all the transactions " - "below release the blocks."; + "below release the blocks."); found= true; } @@ -3228,6 +3228,8 @@ retry: ut_ad(!bpage->is_io_fixed(state)); ut_ad(bpage->buf_fix_count(state)); } + else + state= bpage->state(); ut_ad(state >= buf_page_t::FREED); ut_ad(state < buf_page_t::READ_FIX); @@ -3248,21 +3250,12 @@ retry: } else { - auto state= bpage->state(); - ut_ad(state >= buf_page_t::FREED); - ut_ad(state < buf_page_t::READ_FIX); - page_hash_latch &hash_lock= buf_pool.page_hash.lock_get(chain); /* It does not make sense to use transactional_lock_guard here, because buf_relocate() would likely make the memory transaction too large. */ hash_lock.lock(); - if (state < buf_page_t::UNFIXED) - bpage->set_reinit(buf_page_t::FREED); - else - bpage->set_reinit(state & buf_page_t::LRU_MASK); - mysql_mutex_lock(&buf_pool.flush_list_mutex); buf_relocate(bpage, &free_block->page); free_block->page.lock.x_lock(); @@ -3508,8 +3501,7 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, const bool seems_encrypted = !node.space->full_crc32() && key_version && node.space->crypt_data && node.space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED; - ut_ad(node.space->purpose != FIL_TYPE_TEMPORARY || - node.space->full_crc32()); + ut_ad(!node.space->is_temporary() || node.space->full_crc32()); /* If traditional checksums match, we assume that page is not anymore encrypted. */ @@ -3517,7 +3509,7 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, && !buf_is_zeroes(span(dst_frame, node.space->physical_size())) && (key_version || node.space->is_compressed() - || node.space->purpose == FIL_TYPE_TEMPORARY)) { + || node.space->is_temporary())) { if (buf_page_full_crc32_is_corrupted( bpage->id().space(), dst_frame, node.space->is_compressed())) { @@ -3642,6 +3634,16 @@ database_corrupted_compressed: if (err == DB_PAGE_CORRUPTED || err == DB_DECRYPTION_FAILED) { release_page: + if (node.space->full_crc32() && node.space->crypt_data && + recv_recovery_is_on() && + recv_sys.dblwr.find_encrypted_page(node, id().page_no(), + const_cast(read_frame))) + { + /* Recover from doublewrite buffer */ + err= DB_SUCCESS; + goto success_page; + } + if (recv_sys.free_corrupted_page(expected_id, node)); else if (err == DB_FAIL) err= DB_PAGE_CORRUPTED; @@ -3664,6 +3666,7 @@ release_page: return err; } } +success_page: const bool recovery= frame && recv_recovery_is_on(); diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 5583c3fe604..e9021afd644 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -366,6 +366,7 @@ void buf_dblwr_t::recover() srv_page_size)); byte *const buf= read_buf + srv_page_size; + std::deque encrypted_pages; for (recv_dblwr_t::list::iterator i= recv_sys.dblwr.pages.begin(); i != recv_sys.dblwr.pages.end(); ++i, ++page_no_dblwr) { @@ -381,8 +382,16 @@ void buf_dblwr_t::recover() fil_space_t *space= fil_space_t::get(space_id); if (!space) - /* The tablespace that this page once belonged to does not exist */ + { + /* These pages does not appear to belong to any tablespace. + There is a possibility that this page could be + encrypted using full_crc32 format. If innodb encounters + any corrupted encrypted page during recovery then + InnoDB should use this page to find the valid page. + See find_encrypted_page() */ + encrypted_pages.push_back(*i); continue; + } if (UNIV_UNLIKELY(page_no >= space->get_size())) { @@ -461,6 +470,8 @@ next_page: } recv_sys.dblwr.pages.clear(); + for (byte *page : encrypted_pages) + recv_sys.dblwr.pages.push_back(page); fil_flush_file_spaces(); aligned_free(read_buf); } @@ -749,7 +760,8 @@ void buf_dblwr_t::add_to_batch(const IORequest &request, size_t size) ut_ad(request.bpage); ut_ad(request.bpage->in_file()); ut_ad(request.node); - ut_ad(request.node->space->purpose == FIL_TYPE_TABLESPACE); + ut_ad(!request.node->space->is_temporary()); + ut_ad(!request.node->space->is_being_imported()); ut_ad(request.node->space->id == request.bpage->id().space()); ut_ad(request.node->space->referenced()); ut_ad(!srv_read_only_mode); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 3d2536b7a07..fc3d26783e8 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -601,7 +601,7 @@ static byte *buf_page_encrypt(fil_space_t* space, buf_page_t* bpage, byte* s, fil_space_crypt_t *crypt_data= space->crypt_data; bool encrypted, page_compressed; - if (space->purpose == FIL_TYPE_TEMPORARY) + if (space->is_temporary()) { ut_ad(!crypt_data); encrypted= innodb_encrypt_temporary_tables; @@ -647,13 +647,13 @@ static byte *buf_page_encrypt(fil_space_t* space, buf_page_t* bpage, byte* s, if (!page_compressed) { not_compressed: - d= space->purpose == FIL_TYPE_TEMPORARY + d= space->is_temporary() ? buf_tmp_page_encrypt(page_no, s, d) : fil_space_encrypt(space, page_no, s, d); } else { - ut_ad(space->purpose != FIL_TYPE_TEMPORARY); + ut_ad(!space->is_temporary()); /* First we compress the page content */ buf_tmp_reserve_compression_buf(*slot); byte *tmp= (*slot)->comp_buf; @@ -730,8 +730,7 @@ bool buf_page_t::flush(fil_space_t *space) mysql_mutex_assert_not_owner(&buf_pool.flush_list_mutex); ut_ad(in_file()); ut_ad(in_LRU_list); - ut_ad((space->purpose == FIL_TYPE_TEMPORARY) == - (space == fil_system.temp_space)); + ut_ad((space->is_temporary()) == (space == fil_system.temp_space)); ut_ad(space->referenced()); const auto s= state(); @@ -741,12 +740,12 @@ bool buf_page_t::flush(fil_space_t *space) (FIL_PAGE_LSN + (zip.data ? zip.data : frame))); ut_ad(lsn ? lsn >= oldest_modification() || oldest_modification() == 2 - : space->purpose != FIL_TYPE_TABLESPACE); + : (space->is_temporary() || space->is_being_imported())); if (s < UNFIXED) { ut_a(s >= FREED); - if (UNIV_LIKELY(space->purpose == FIL_TYPE_TABLESPACE)) + if (!space->is_temporary() && !space->is_being_imported()) { freed: if (lsn > log_sys.get_flushed_lsn()) @@ -762,7 +761,8 @@ bool buf_page_t::flush(fil_space_t *space) if (UNIV_UNLIKELY(lsn < space->get_create_lsn())) { - ut_ad(space->purpose == FIL_TYPE_TABLESPACE); + ut_ad(!space->is_temporary()); + ut_ad(!space->is_being_imported()); goto freed; } @@ -846,7 +846,7 @@ bool buf_page_t::flush(fil_space_t *space) if ((s & LRU_MASK) == REINIT || !space->use_doublewrite()) { - if (UNIV_LIKELY(space->purpose == FIL_TYPE_TABLESPACE) && + if (!space->is_temporary() && !space->is_being_imported() && lsn > log_sys.get_flushed_lsn()) log_write_up_to(lsn, true); space->io(IORequest{type, this, slot}, physical_offset(), size, @@ -1695,7 +1695,7 @@ done: if (acquired) space->release(); - if (space->purpose == FIL_TYPE_IMPORT) + if (space->is_being_imported()) os_aio_wait_until_no_pending_writes(true); else buf_dblwr.flush_buffered_writes(); @@ -1838,6 +1838,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept if (resizing > 1 && resizing <= checkpoint_lsn) { ut_ad(is_mmap() == !resize_flush_buf); + ut_ad(is_mmap() == !resize_log.is_opened()); if (!is_mmap()) { @@ -1903,6 +1904,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept resize_flush_buf= nullptr; resize_target= 0; resize_lsn.store(0, std::memory_order_relaxed); + writer_update(); } log_resize_release(); diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index 4ac53071282..070a07f128f 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -957,8 +957,10 @@ void dict_load_tablespaces(const std::set *spaces, bool upgrade) const bool not_dropped{!rec_get_deleted_flag(rec, 0)}; /* Check that the .ibd file exists. */ - if (fil_ibd_open(not_dropped, FIL_TYPE_TABLESPACE, - space_id, dict_tf_to_fsp_flags(flags), + if (fil_ibd_open(space_id, dict_tf_to_fsp_flags(flags), + not_dropped + ? fil_space_t::VALIDATE_NOTHING + : fil_space_t::MAYBE_MISSING, name, filepath)) { } else if (!not_dropped) { } else if (srv_operation == SRV_OPERATION_NORMAL @@ -2274,8 +2276,8 @@ dict_load_tablespace( } table->space = fil_ibd_open( - 2, FIL_TYPE_TABLESPACE, table->space_id, - dict_tf_to_fsp_flags(table->flags), + table->space_id, dict_tf_to_fsp_flags(table->flags), + fil_space_t::VALIDATE_SPACE_ID, {table->name.m_name, strlen(table->name.m_name)}, filepath); if (!table->space) { diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index b8b2d583c24..d47914cf888 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -136,9 +136,6 @@ dict_table_t *dict_table_t::create(const span &name, ulint n_cols, ulint n_v_cols, ulint flags, ulint flags2) { - ut_ad(!space || space->purpose == FIL_TYPE_TABLESPACE || - space->purpose == FIL_TYPE_TEMPORARY || - space->purpose == FIL_TYPE_IMPORT); ut_a(dict_tf2_is_valid(flags, flags2)); ut_a(!(flags2 & DICT_TF2_UNUSED_BIT_MASK)); diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 41d6648fd01..35c6f65ddef 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1068,7 +1068,8 @@ default_encrypt_list only when default encrypt */ static bool fil_crypt_must_remove(const fil_space_t &space) { - ut_ad(space.purpose == FIL_TYPE_TABLESPACE); + ut_ad(!space.is_temporary()); + ut_ad(!space.is_being_imported()); fil_space_crypt_t *crypt_data = space.crypt_data; mysql_mutex_assert_owner(&fil_system.mutex); const ulong encrypt_tables= srv_encrypt_tables; @@ -1104,7 +1105,8 @@ fil_crypt_space_needs_rotation( fil_space_t* space = &*state->space; ut_ad(space->referenced()); - ut_ad(space->purpose == FIL_TYPE_TABLESPACE); + ut_ad(!space->is_temporary()); + ut_ad(!space->is_being_imported()); fil_space_crypt_t *crypt_data = space->crypt_data; @@ -1456,7 +1458,7 @@ space_list_t::iterator fil_space_t::next(space_list_t::iterator space, for (; space != fil_system.space_list.end(); ++space) { - if (space->purpose != FIL_TYPE_TABLESPACE) + if (space->is_temporary() || space->is_being_imported()) continue; const uint32_t n= space->acquire_low(); if (UNIV_LIKELY(!(n & (STOPPING | CLOSING)))) @@ -2138,9 +2140,9 @@ static void fil_crypt_default_encrypt_tables_fill() mysql_mutex_assert_owner(&fil_system.mutex); for (fil_space_t& space : fil_system.space_list) { - if (space.purpose != FIL_TYPE_TABLESPACE - || space.is_in_default_encrypt + if (space.is_in_default_encrypt || UT_LIST_GET_LEN(space.chain) == 0 + || space.is_temporary() || space.is_being_imported() || !space.acquire_if_not_stopped()) { continue; } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index e32e54abded..7a0338ab26e 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -78,17 +78,11 @@ bool fil_space_t::try_to_close(fil_space_t *ignore_space, bool print_info) mysql_mutex_assert_owner(&fil_system.mutex); for (fil_space_t &space : fil_system.space_list) { - if (&space == ignore_space) + if (&space == ignore_space || space.is_being_imported() || + space.id == TRX_SYS_SPACE || space.id == SRV_TMP_SPACE_ID || + srv_is_undo_tablespace(space.id)) continue; - switch (space.purpose) { - case FIL_TYPE_TEMPORARY: - continue; - case FIL_TYPE_IMPORT: - break; - case FIL_TYPE_TABLESPACE: - if (space.id == TRX_SYS_SPACE || srv_is_undo_tablespace(space.id)) - continue; - } + ut_ad(!space.is_temporary()); /* We are using an approximation of LRU replacement policy. In fil_node_open_file_low(), newly opened files are moved to the end @@ -435,7 +429,7 @@ static bool fil_node_open_file(fil_node_t *node, const byte *page, bool no_lsn) srv_operation == SRV_OPERATION_BACKUP || srv_operation == SRV_OPERATION_RESTORE || srv_operation == SRV_OPERATION_RESTORE_DELTA); - ut_ad(node->space->purpose != FIL_TYPE_TEMPORARY); + ut_ad(!node->space->is_temporary()); ut_ad(node->space->referenced()); const auto old_time= fil_system.n_open_exceeded_time; @@ -496,7 +490,7 @@ void fil_node_t::prepare_to_close_or_detach() srv_operation == SRV_OPERATION_RESTORE_DELTA); ut_a(is_open()); ut_a(!being_extended); - ut_a(space->is_ready_to_close() || space->purpose == FIL_TYPE_TEMPORARY || + ut_a(space->is_ready_to_close() || space->is_temporary() || srv_fast_shutdown == 2 || !srv_was_started); ut_a(fil_system.n_open > 0); @@ -657,14 +651,13 @@ fil_space_extend_must_retry( mysql_mutex_lock(&fil_system.mutex); break; default: - ut_ad(space->purpose == FIL_TYPE_TABLESPACE - || space->purpose == FIL_TYPE_IMPORT); - if (space->purpose == FIL_TYPE_TABLESPACE) { + ut_ad(!space->is_temporary()); + if (!space->is_being_imported()) { goto do_flush; } break; case SRV_TMP_SPACE_ID: - ut_ad(space->purpose == FIL_TYPE_TEMPORARY); + ut_ad(space->is_temporary()); srv_tmp_space.set_last_file_size(pages_in_MiB); break; } @@ -691,8 +684,7 @@ ATTRIBUTE_COLD bool fil_space_t::prepare_acquired() ut_ad(referenced()); mysql_mutex_assert_owner(&fil_system.mutex); fil_node_t *node= UT_LIST_GET_LAST(chain); - ut_ad(!id || purpose == FIL_TYPE_TEMPORARY || - node == UT_LIST_GET_FIRST(chain)); + ut_ad(!id || is_temporary() || node == UT_LIST_GET_FIRST(chain)); const bool is_open= node && (node->is_open() || fil_node_open_file(node, nullptr, false)); @@ -756,7 +748,7 @@ ATTRIBUTE_COLD bool fil_space_t::acquire_and_prepare() @return whether the tablespace is at least as big as requested */ bool fil_space_extend(fil_space_t *space, uint32_t size) { - ut_ad(!srv_read_only_mode || space->purpose == FIL_TYPE_TEMPORARY); + ut_ad(!srv_read_only_mode || space->is_temporary()); bool success= false; const bool acquired= space->acquire(); mysql_mutex_lock(&fil_system.mutex); @@ -961,111 +953,85 @@ bool fil_space_free(uint32_t id, bool x_latched) return(space != NULL); } -/** Create a tablespace in fil_system. -@param name tablespace name -@param id tablespace identifier -@param flags tablespace flags -@param purpose tablespace purpose -@param crypt_data encryption information -@param mode encryption mode -@param opened true if space files are opened -@return pointer to created tablespace, to be filled in with add() -@retval nullptr on failure (such as when the same tablespace exists) */ -fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags, - fil_type_t purpose, - fil_space_crypt_t *crypt_data, - fil_encryption_t mode, - bool opened) +fil_space_t::fil_space_t(uint32_t id, uint32_t flags, bool being_imported, + fil_space_crypt_t *crypt_data) noexcept : + id(id), crypt_data(crypt_data), being_imported(being_imported), flags(flags) { - fil_space_t* space; + UT_LIST_INIT(chain, &fil_node_t::chain); + memset((void*) &latch, 0, sizeof latch); + latch.SRW_LOCK_INIT(fil_space_latch_key); +} - mysql_mutex_assert_owner(&fil_system.mutex); - ut_ad(fil_system.is_initialised()); - ut_ad(fil_space_t::is_valid_flags(flags & ~FSP_FLAGS_MEM_MASK, id)); - ut_ad(srv_page_size == UNIV_PAGE_SIZE_ORIG || flags != 0); +fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags, + bool being_imported, + fil_space_crypt_t *crypt_data, + fil_encryption_t mode, + bool opened) noexcept +{ + mysql_mutex_assert_owner(&fil_system.mutex); + ut_ad(fil_system.is_initialised()); + ut_ad(fil_space_t::is_valid_flags(flags & ~FSP_FLAGS_MEM_MASK, id)); + ut_ad(srv_page_size == UNIV_PAGE_SIZE_ORIG || flags != 0); - DBUG_EXECUTE_IF("fil_space_create_failure", return(NULL);); + DBUG_EXECUTE_IF("fil_space_create_failure", return nullptr;); - fil_space_t** after = reinterpret_cast( - &fil_system.spaces.cell_get(id)->node); - for (; *after; after = &(*after)->hash) { - ut_a((*after)->id != id); - } + fil_space_t** after= fil_system.spaces.cell_get(id)->search + (&fil_space_t::hash, [id](const fil_space_t *space) + { return !space || space->id == id; }); + ut_a(!*after); + fil_space_t *space= new (ut_malloc_nokey(sizeof(*space))) + fil_space_t(id, flags, being_imported, crypt_data); + *after= space; - /* FIXME: if calloc() is defined as an inline function that calls - memset() or bzero(), then GCC 6 -flifetime-dse can optimize it away */ - *after = space = new (ut_zalloc_nokey(sizeof(*space))) fil_space_t; + if (crypt_data) + DBUG_PRINT("crypt", ("Tablespace %" PRIu32 " encryption %d key id %" PRIu32 + ":%s %s", + id, crypt_data->encryption, crypt_data->key_id, + fil_crypt_get_mode(crypt_data), + fil_crypt_get_type(crypt_data))); - space->id = id; + if (opened) + fil_system.add_opened_last_to_space_list(space); + else + fil_system.space_list.push_back(*space); - UT_LIST_INIT(space->chain, &fil_node_t::chain); + switch (id) { + case 0: + ut_ad(!fil_system.sys_space); + fil_system.sys_space= space; + break; + case SRV_TMP_SPACE_ID: + ut_ad(!fil_system.temp_space); + fil_system.temp_space= space; + return space; + default: + if (UNIV_LIKELY(id <= fil_system.max_assigned_id)) + break; + if (UNIV_UNLIKELY(srv_operation == SRV_OPERATION_BACKUP)) + break; + if (!fil_system.space_id_reuse_warned) + sql_print_warning("InnoDB: Allocated tablespace ID %" PRIu32 + ", old maximum was %" PRIu32, + id, fil_system.max_assigned_id); + fil_system.max_assigned_id = id; + } - space->purpose = purpose; - space->flags = flags; + if ((mode == FIL_ENCRYPTION_ON || + (mode == FIL_ENCRYPTION_OFF || srv_encrypt_tables)) && + !space->is_being_imported() && fil_crypt_must_default_encrypt()) + { + fil_system.default_encrypt_tables.push_back(*space); + space->is_in_default_encrypt= true; - space->crypt_data = crypt_data; - space->n_pending.store(CLOSING, std::memory_order_relaxed); + if (srv_n_fil_crypt_threads_started) + { + mysql_mutex_unlock(&fil_system.mutex); + fil_crypt_threads_signal(); + mysql_mutex_lock(&fil_system.mutex); + } + } - DBUG_LOG("tablespace", "Created metadata for " << id); - if (crypt_data) { - DBUG_LOG("crypt", - "Tablespace " << id - << " encryption " << crypt_data->encryption - << " key id " << crypt_data->key_id - << ":" << fil_crypt_get_mode(crypt_data) - << " " << fil_crypt_get_type(crypt_data)); - } - - space->latch.SRW_LOCK_INIT(fil_space_latch_key); - - if (opened) - fil_system.add_opened_last_to_space_list(space); - else - fil_system.space_list.push_back(*space); - - switch (id) { - case 0: - ut_ad(!fil_system.sys_space); - fil_system.sys_space = space; - break; - case SRV_TMP_SPACE_ID: - ut_ad(!fil_system.temp_space); - fil_system.temp_space = space; - break; - default: - ut_ad(purpose != FIL_TYPE_TEMPORARY); - if (UNIV_LIKELY(id <= fil_system.max_assigned_id)) { - break; - } - if (UNIV_UNLIKELY(srv_operation == SRV_OPERATION_BACKUP)) { - break; - } - if (!fil_system.space_id_reuse_warned) { - ib::warn() << "Allocated tablespace ID " << id - << ", old maximum was " - << fil_system.max_assigned_id; - } - - fil_system.max_assigned_id = id; - } - - const bool rotate = purpose == FIL_TYPE_TABLESPACE - && (mode == FIL_ENCRYPTION_ON || mode == FIL_ENCRYPTION_OFF - || srv_encrypt_tables) - && fil_crypt_must_default_encrypt(); - - if (rotate) { - fil_system.default_encrypt_tables.push_back(*space); - space->is_in_default_encrypt = true; - - if (srv_n_fil_crypt_threads_started) { - mysql_mutex_unlock(&fil_system.mutex); - fil_crypt_threads_signal(); - mysql_mutex_lock(&fil_system.mutex); - } - } - - return(space); + return space; } /*******************************************************************//** @@ -1660,6 +1626,7 @@ static void fil_name_write(uint32_t space_id, const char *name, fil_space_t *fil_space_t::drop(uint32_t id, pfs_os_file_t *detached_handle) { ut_a(!is_system_tablespace(id)); + ut_ad(id != SRV_TMP_SPACE_ID); mysql_mutex_lock(&fil_system.mutex); fil_space_t *space= fil_space_get_by_id(id); @@ -1702,7 +1669,7 @@ fil_space_t *fil_space_t::drop(uint32_t id, pfs_os_file_t *detached_handle) if (space->crypt_data) fil_space_crypt_close_tablespace(space); - if (space->purpose == FIL_TYPE_TABLESPACE) + if (!space->is_being_imported()) { if (id >= srv_undo_space_id_start && id < srv_undo_space_id_start + srv_undo_tablespaces_open) @@ -1722,8 +1689,6 @@ fil_space_t *fil_space_t::drop(uint32_t id, pfs_os_file_t *detached_handle) os_file_delete(innodb_data_file_key, space->chain.start->name); } - else - ut_ad(space->purpose == FIL_TYPE_IMPORT); if (char *cfg_name= fil_make_filepath(space->chain.start->name, fil_space_t::name_type{}, CFG, false)) @@ -2023,7 +1988,7 @@ fil_ibd_create( uint32_t size, fil_encryption_t mode, uint32_t key_id, - dberr_t* err) + dberr_t* err) noexcept { pfs_os_file_t file; bool success; @@ -2146,8 +2111,8 @@ err_exit: log_make_checkpoint();); mysql_mutex_lock(&fil_system.mutex); - if (fil_space_t* space = fil_space_t::create(space_id, flags, - FIL_TYPE_TABLESPACE, + if (fil_space_t* space = fil_space_t::create(space_id, + flags, false, crypt_data, mode, true)) { fil_node_t* node = space->add(path, file, size, false, true); node->find_metadata(IF_WIN(,true)); @@ -2169,51 +2134,17 @@ err_exit: goto err_exit; } -/** Try to open a single-table tablespace and optionally check that the -space id in it is correct. If this does not succeed, print an error message -to the .err log. This function is used to open a tablespace when we start -mysqld after the dictionary has been booted, and also in IMPORT TABLESPACE. - -NOTE that we assume this operation is used either at the database startup -or under the protection of dict_sys.latch, so that two users cannot -race here. This operation does not leave the file associated with the -tablespace open, but closes it after we have looked at the space id in it. - -If the validate boolean is set, we read the first page of the file and -check that the space id in the file is what we expect. We assume that -this function runs much faster if no check is made, since accessing the -file inode probably is much faster (the OS caches them) than accessing -the first page of the file. This boolean may be initially false, but if -a remote tablespace is found it will be changed to true. - -If the fix_dict boolean is set, then it is safe to use an internal SQL -statement to update the dictionary tables if they are incorrect. - -@param[in] validate 0=maybe missing, 1=do not validate, 2=validate -@param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_TEMPORARY -@param[in] id tablespace ID -@param[in] flags expected FSP_SPACE_FLAGS -@param[in] name table name -If file-per-table, it is the table name in the databasename/tablename format -@param[in] path_in expected filepath, usually read from dictionary -@param[out] err DB_SUCCESS or error code -@return tablespace -@retval NULL if the tablespace could not be opened */ -fil_space_t* -fil_ibd_open( - unsigned validate, - fil_type_t purpose, - uint32_t id, - uint32_t flags, - fil_space_t::name_type name, - const char* path_in, - dberr_t* err) +fil_space_t *fil_ibd_open(uint32_t id, uint32_t flags, + fil_space_t::validate validate, + fil_space_t::name_type name, + const char *path_in, dberr_t *err) noexcept { mysql_mutex_lock(&fil_system.mutex); fil_space_t* space = fil_space_get_by_id(id); mysql_mutex_unlock(&fil_system.mutex); if (space) { - if (validate > 1 && !srv_read_only_mode) { + if (validate == fil_space_t::VALIDATE_SPACE_ID + && !srv_read_only_mode) { fsp_flags_try_adjust(space, flags & ~FSP_FLAGS_MEM_MASK); } @@ -2269,7 +2200,7 @@ func_exit: /* Dict path is not the default path. Always validate remote files. If default is opened, it was moved. */ must_validate = true; - } else if (validate > 1) { + } else if (validate >= fil_space_t::VALIDATE_SPACE_ID) { must_validate = true; } @@ -2286,7 +2217,8 @@ func_exit: the first server startup. The tables ought to be dropped by drop_garbage_tables_after_restore() a little later. */ - const bool strict = validate && !tablespaces_found + const bool strict = (validate != fil_space_t::MAYBE_MISSING) + && !tablespaces_found && operation_not_for_export && !(srv_operation == SRV_OPERATION_NORMAL && srv_start_after_restore @@ -2417,7 +2349,9 @@ skip_validate: : NULL; mysql_mutex_lock(&fil_system.mutex); - space = fil_space_t::create(id, flags, purpose, crypt_data); + space = fil_space_t::create(id, flags, + validate == fil_space_t::VALIDATE_IMPORT, + crypt_data); if (!space) { mysql_mutex_unlock(&fil_system.mutex); goto error; @@ -2435,7 +2369,7 @@ skip_validate: df_remote.close(); df_default.close(); if (space->acquire()) { - if (purpose != FIL_TYPE_IMPORT) { + if (validate < fil_space_t::VALIDATE_IMPORT) { fsp_flags_try_adjust(space, flags & ~FSP_FLAGS_MEM_MASK); } @@ -2720,8 +2654,8 @@ tablespace_check: mysql_mutex_lock(&fil_system.mutex); - space = fil_space_t::create( - space_id, flags, FIL_TYPE_TABLESPACE, crypt_data); + space = fil_space_t::create(uint32_t(space_id), flags, false, + crypt_data); if (space == NULL) { mysql_mutex_unlock(&fil_system.mutex); @@ -2749,16 +2683,14 @@ void fsp_flags_try_adjust(fil_space_t *space, uint32_t flags) { ut_ad(!srv_read_only_mode); ut_ad(fil_space_t::is_valid_flags(flags, space->id)); + ut_ad(!space->is_being_imported()); + ut_ad(!space->is_temporary()); if (space->full_crc32() || fil_space_t::full_crc32(flags)) { return; } - if (!space->size && (space->purpose != FIL_TYPE_TABLESPACE - || !space->get_size())) { + if (!space->size || !space->get_size()) { return; } - /* This code is executed during server startup while no - connections are allowed. We do not need to protect against - DROP TABLE by fil_space_acquire(). */ mtr_t mtr; mtr.start(); if (buf_block_t* b = buf_page_get( @@ -2849,7 +2781,7 @@ void fil_space_t::complete_write() { mysql_mutex_assert_not_owner(&fil_system.mutex); - if (purpose != FIL_TYPE_TEMPORARY && + if (!is_temporary() && fil_system.use_unflushed_spaces() && set_needs_flush()) { mysql_mutex_lock(&fil_system.mutex); @@ -3157,8 +3089,8 @@ fil_space_validate_for_mtr_commit( { mysql_mutex_assert_not_owner(&fil_system.mutex); ut_ad(space != NULL); - ut_ad(space->purpose == FIL_TYPE_TABLESPACE); ut_ad(!is_predefined_tablespace(space->id)); + ut_ad(!space->is_being_imported()); /* We are serving mtr_commit(). While there is an active mini-transaction, we should have !space->is_stopping(). This is @@ -3341,7 +3273,7 @@ fil_space_t::name_type fil_space_t::name() const if (!UT_LIST_GET_FIRST(chain) || srv_is_undo_tablespace(id)) return name_type{}; - ut_ad(purpose != FIL_TYPE_TEMPORARY); + ut_ad(!is_temporary()); ut_ad(UT_LIST_GET_LEN(chain) == 1); const char *path= UT_LIST_GET_FIRST(chain)->name; diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 97a3ca33b4d..fd0d547cee7 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -353,7 +353,7 @@ xdes_get_descriptor_with_space_hdr( ut_ad(limit == space->free_limit || (space->free_limit == 0 && (init_space - || space->purpose == FIL_TYPE_TEMPORARY + || space->is_temporary() || (srv_startup_is_before_trx_rollback_phase && (space->id == TRX_SYS_SPACE || srv_is_undo_tablespace(space->id)))))); @@ -489,14 +489,15 @@ void fil_space_t::modify_check(const mtr_t& mtr) const case MTR_LOG_NONE: /* These modes are only allowed within a non-bitmap page when there is a higher-level redo log record written. */ - ut_ad(purpose == FIL_TYPE_TABLESPACE || purpose == FIL_TYPE_TEMPORARY); + ut_ad(!is_being_imported()); break; case MTR_LOG_NO_REDO: - ut_ad(purpose == FIL_TYPE_TEMPORARY || purpose == FIL_TYPE_IMPORT); + ut_ad(is_temporary() || is_being_imported()); break; default: /* We may only write redo log for a persistent tablespace. */ - ut_ad(purpose == FIL_TYPE_TABLESPACE); + ut_ad(!is_temporary()); + ut_ad(!is_being_imported()); ut_ad(mtr.is_named_space(id)); } } @@ -855,7 +856,7 @@ fsp_fill_free_list( FIL_PAGE_TYPE_XDES); } - if (space->purpose != FIL_TYPE_TEMPORARY) + if (!space->is_temporary()) { buf_block_t *f= buf_LRU_get_free_block(have_no_mutex); buf_block_t *block= diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc index c2152b08590..6c00d26b9bb 100644 --- a/storage/innobase/fsp/fsp0space.cc +++ b/storage/innobase/fsp/fsp0space.cc @@ -132,10 +132,8 @@ Tablespace::open_or_create(bool is_temp) mysql_mutex_lock(&fil_system.mutex); space = fil_space_t::create( - m_space_id, fsp_flags, - is_temp - ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, - NULL); + uint32_t(m_space_id), fsp_flags, + false, nullptr); if (!space) { mysql_mutex_unlock(&fil_system.mutex); return DB_ERROR; diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index 6bd2627ea85..7548ac97edc 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -966,8 +966,7 @@ SysTablespace::open_or_create( } else if (is_temp) { ut_ad(space_id() == SRV_TMP_SPACE_ID); space = fil_space_t::create( - SRV_TMP_SPACE_ID, flags(), - FIL_TYPE_TEMPORARY, NULL); + SRV_TMP_SPACE_ID, flags(), false, nullptr); ut_ad(space == fil_system.temp_space); if (!space) { err = DB_ERROR; @@ -978,8 +977,7 @@ SysTablespace::open_or_create( } else { ut_ad(space_id() == TRX_SYS_SPACE); space = fil_space_t::create( - TRX_SYS_SPACE, it->flags(), - FIL_TYPE_TABLESPACE, NULL); + TRX_SYS_SPACE, it->flags(), false, nullptr); ut_ad(space == fil_system.sys_space); if (!space) { err = DB_ERROR; diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 5c291b068ff..a00cd6ea9ae 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -2211,7 +2211,7 @@ fts_savepoint_t* fts_savepoint_create( /*=================*/ ib_vector_t* savepoints, /*!< out: InnoDB transaction */ - const char* name, /*!< in: savepoint name */ + const void* name, /*!< in: savepoint */ mem_heap_t* heap) /*!< in: heap */ { fts_savepoint_t* savepoint; @@ -2220,11 +2220,7 @@ fts_savepoint_create( ib_vector_push(savepoints, NULL)); memset(savepoint, 0x0, sizeof(*savepoint)); - - if (name) { - savepoint->name = mem_heap_strdup(heap, name); - } - + savepoint->name = name; static_assert(!offsetof(fts_trx_table_t, table), "ABI"); savepoint->tables = rbt_create(sizeof(fts_trx_table_t*), fts_ptr2_cmp); @@ -2243,7 +2239,6 @@ fts_trx_create( fts_trx_t* ftt; ib_alloc_t* heap_alloc; mem_heap_t* heap = mem_heap_create(1024); - trx_named_savept_t* savep; ut_a(trx->fts_trx == NULL); @@ -2263,14 +2258,6 @@ fts_trx_create( fts_savepoint_create(ftt->savepoints, NULL, NULL); fts_savepoint_create(ftt->last_stmt, NULL, NULL); - /* Copy savepoints that already set before. */ - for (savep = UT_LIST_GET_FIRST(trx->trx_savepoints); - savep != NULL; - savep = UT_LIST_GET_NEXT(trx_savepoints, savep)) { - - fts_savepoint_take(ftt, savep->name); - } - return(ftt); } @@ -5410,7 +5397,7 @@ void fts_savepoint_take( /*===============*/ fts_trx_t* fts_trx, /*!< in: fts transaction */ - const char* name) /*!< in: savepoint name */ + const void* name) /*!< in: savepoint */ { mem_heap_t* heap; fts_savepoint_t* savepoint; @@ -5433,31 +5420,21 @@ fts_savepoint_take( } /*********************************************************************//** -Lookup a savepoint instance by name. -@return ULINT_UNDEFINED if not found */ -UNIV_INLINE +Lookup a savepoint instance. +@return 0 if not found */ +static ulint fts_savepoint_lookup( /*==================*/ ib_vector_t* savepoints, /*!< in: savepoints */ - const char* name) /*!< in: savepoint name */ + const void* name) /*!< in: savepoint */ { - ulint i; - - ut_a(ib_vector_size(savepoints) > 0); - - for (i = 1; i < ib_vector_size(savepoints); ++i) { - fts_savepoint_t* savepoint; - - savepoint = static_cast( - ib_vector_get(savepoints, i)); - - if (strcmp(name, savepoint->name) == 0) { - return(i); - } - } - - return(ULINT_UNDEFINED); + ut_a(ib_vector_size(savepoints) > 0); + for (ulint i= 1; i < ib_vector_size(savepoints); ++i) + if (name == static_cast + (ib_vector_get(savepoints, i))->name) + return i; + return 0; } /*********************************************************************//** @@ -5468,7 +5445,7 @@ void fts_savepoint_release( /*==================*/ trx_t* trx, /*!< in: transaction */ - const char* name) /*!< in: savepoint name */ + const void* name) /*!< in: savepoint name */ { ut_a(name != NULL); @@ -5476,10 +5453,7 @@ fts_savepoint_release( ut_a(ib_vector_size(savepoints) > 0); - ulint i = fts_savepoint_lookup(savepoints, name); - if (i != ULINT_UNDEFINED) { - ut_a(i >= 1); - + if (ulint i = fts_savepoint_lookup(savepoints, name)) { fts_savepoint_t* savepoint; savepoint = static_cast( ib_vector_get(savepoints, i)); @@ -5634,9 +5608,8 @@ void fts_savepoint_rollback( /*===================*/ trx_t* trx, /*!< in: transaction */ - const char* name) /*!< in: savepoint name */ + const void* name) /*!< in: savepoint */ { - ulint i; ib_vector_t* savepoints; ut_a(name != NULL); @@ -5645,16 +5618,19 @@ fts_savepoint_rollback( /* We pop all savepoints from the the top of the stack up to and including the instance that was found. */ - i = fts_savepoint_lookup(savepoints, name); + ulint i = fts_savepoint_lookup(savepoints, name); - if (i != ULINT_UNDEFINED) { + if (i == 0) { + /* fts_trx_create() must have been invoked after + this savepoint had been created, and we must roll back + everything. */ + i = 1; + } + + { fts_savepoint_t* savepoint; - ut_a(i > 0); - while (ib_vector_size(savepoints) > i) { - fts_savepoint_t* savepoint; - savepoint = static_cast( ib_vector_pop(savepoints)); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ce209c1c73e..13074f77993 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -48,6 +48,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include "sql_type_geom.h" #include "scope.h" #include "srv0srv.h" @@ -1064,17 +1065,6 @@ static SHOW_VAR innodb_status_variables[]= { {NullS, NullS, SHOW_LONG} }; -/*****************************************************************//** -Frees a possible InnoDB trx object associated with the current THD. -@return 0 or error number */ -static -int -innobase_close_connection( -/*======================*/ - handlerton* hton, /*!< in/out: InnoDB handlerton */ - THD* thd); /*!< in: MySQL thread handle for - which to close the connection */ - /** Cancel any pending lock request associated with the current THD. @sa THD::awake() @sa ha_kill_query() */ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels); @@ -1139,33 +1129,6 @@ innobase_rollback_to_savepoint_can_release_mdl( the user whose XA transaction should be rolled back to savepoint */ -/*****************************************************************//** -Sets a transaction savepoint. -@return always 0, that is, always succeeds */ -static -int -innobase_savepoint( -/*===============*/ - handlerton* hton, /*!< in/out: InnoDB handlerton */ - THD* thd, /*!< in: handle to the MySQL thread of - the user's XA transaction for which - we need to take a savepoint */ - void* savepoint); /*!< in: savepoint data */ - -/*****************************************************************//** -Release transaction savepoint name. -@return 0 if success, HA_ERR_NO_SAVEPOINT if no savepoint with the -given name */ -static -int -innobase_release_savepoint( -/*=======================*/ - handlerton* hton, /*!< in/out: handlerton for InnoDB */ - THD* thd, /*!< in: handle to the MySQL thread - of the user whose transaction's - savepoint should be released */ - void* savepoint); /*!< in: savepoint data */ - /** Request notification of log writes */ static void innodb_log_flush_request(void *cookie); @@ -2076,6 +2039,26 @@ static int innodb_ddl_recovery_done(handlerton*) return 0; } +/** Report an aborted transaction or statement. +@param thd execution context +@param all true=transaction, false=statement +@param err InnoDB error code */ +static void innodb_transaction_abort(THD *thd, bool all, dberr_t err) noexcept +{ + if (!thd) + return; + if (!all); + else if (trx_t *trx = thd_to_trx(thd)) + { + ut_ad(trx->state == TRX_STATE_NOT_STARTED); + trx->state= TRX_STATE_ABORTED; + if (thd_log_warnings(thd) >= 4) + sql_print_error("InnoDB: Transaction was aborted due to %s", + ut_strerr(err)); + } + thd_mark_transaction_to_rollback(thd, all); +} + /********************************************************************//** Converts an InnoDB error code to a MySQL error code and also tells to MySQL about a possible transaction rollback inside InnoDB caused by a lock wait @@ -2138,14 +2121,9 @@ convert_error_code_to_mysql( case DB_DEADLOCK: case DB_RECORD_CHANGED: - /* Since we rolled back the whole transaction, we must - tell it also to MySQL so that MySQL knows to empty the - cached binlog for this transaction */ - - if (thd != NULL) { - thd_mark_transaction_to_rollback(thd, 1); - } - + /* Since we rolled back the whole transaction, the + cached binlog must be emptied. */ + innodb_transaction_abort(thd, true, error); return error == DB_DEADLOCK ? HA_ERR_LOCK_DEADLOCK : HA_ERR_RECORD_CHANGED; @@ -2154,11 +2132,8 @@ convert_error_code_to_mysql( latest SQL statement in a lock wait timeout. Previously, we rolled back the whole transaction. */ - if (thd) { - thd_mark_transaction_to_rollback( - thd, innobase_rollback_on_timeout); - } - + innodb_transaction_abort(thd, innobase_rollback_on_timeout, + error); return(HA_ERR_LOCK_WAIT_TIMEOUT); case DB_NO_REFERENCED_ROW: @@ -2237,9 +2212,6 @@ convert_error_code_to_mysql( (ulong) DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(flags)); return(HA_ERR_INDEX_COL_TOO_LONG); - case DB_NO_SAVEPOINT: - return(HA_ERR_NO_SAVEPOINT); - case DB_LOCK_TABLE_FULL: /* Since we rolled back the whole transaction, we must tell it also to MySQL so that MySQL knows to empty the @@ -2825,7 +2797,7 @@ Gets the InnoDB transaction handle for a MySQL handler object, creates an InnoDB transaction struct if the corresponding MySQL thread struct still lacks one. @return InnoDB transaction handle */ -static inline +static trx_t* check_trx_exists( /*=============*/ @@ -2883,6 +2855,140 @@ trx_deregister_from_2pc( trx->active_commit_ordered= false; } +/** + Set a transaction savepoint. + + @param thd server thread descriptor + @param savepoint transaction savepoint storage area + + @retval 0 on success + @retval HA_ERR_NO_SAVEPOINT if the transaction is in an inconsistent state +*/ +static int innobase_savepoint(handlerton*, THD *thd, void *savepoint) noexcept +{ + DBUG_ENTER("innobase_savepoint"); + + /* In the autocommit mode there is no sense to set a savepoint + (unless we are in sub-statement), so SQL layer ensures that + this method is never called in such situation. */ + trx_t *trx= check_trx_exists(thd); + + /* Cannot happen outside of transaction */ + DBUG_ASSERT(trx_is_registered_for_2pc(trx)); + + switch (UNIV_EXPECT(trx->state, TRX_STATE_ACTIVE)) { + default: + ut_ad("invalid state" == 0); + DBUG_RETURN(HA_ERR_NO_SAVEPOINT); + case TRX_STATE_NOT_STARTED: + trx_start_if_not_started_xa(trx, false); + /* fall through */ + case TRX_STATE_ACTIVE: + const undo_no_t savept{trx->undo_no}; + *static_cast(savepoint)= savept; + trx->last_stmt_start= savept; + trx->end_bulk_insert(); + + if (trx->fts_trx) + fts_savepoint_take(trx->fts_trx, savepoint); + + DBUG_RETURN(0); + } +} + +/** + Releases a transaction savepoint. + + @param thd server thread descriptor + @param savepoint transaction savepoint to be released + + @return 0 always +*/ +static int innobase_release_savepoint(handlerton*, THD *thd, void *savepoint) + noexcept +{ + DBUG_ENTER("innobase_release_savepoint"); + trx_t *trx= check_trx_exists(thd); + ut_ad(trx->mysql_thd == thd); + if (trx->fts_trx) + fts_savepoint_release(trx, savepoint); + DBUG_RETURN(0); +} + +/** + Frees a possible InnoDB trx object associated with the current THD. + + @param thd server thread descriptor, which resources should be free'd + + @return 0 always +*/ +static int innobase_close_connection(handlerton *, THD *thd) noexcept +{ + if (auto trx= thd_to_trx(thd)) + { + thd_set_ha_data(thd, innodb_hton_ptr, nullptr); + switch (trx->state) { + case TRX_STATE_ABORTED: + trx->state= TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: + ut_ad(!trx->id); + trx->will_lock= false; + break; + default: + ut_ad("invalid state" == 0); + return 0; + case TRX_STATE_PREPARED: + if (trx->has_logged_persistent()) + { + trx_disconnect_prepared(trx); + return 0; + } + /* fall through */ + case TRX_STATE_ACTIVE: + /* If we had reserved the auto-inc lock for some table (if + we come here to roll back the latest SQL statement) we + release it now before a possibly lengthy rollback */ + lock_unlock_table_autoinc(trx); + trx_rollback_for_mysql(trx); + } + trx_deregister_from_2pc(trx); + trx->free(); + DEBUG_SYNC(thd, "innobase_connection_closed"); + } + return 0; +} + +/** + XA ROLLBACK after XA PREPARE + + @param xid X/Open XA transaction identification + + @retval 0 if the transaction was found and rolled back + @retval XAER_NOTA if no such transaction exists + @retval XAER_RMFAIL if InnoDB is in read-only mode +*/ +static int innobase_rollback_by_xid(handlerton*, XID *xid) noexcept +{ + DBUG_EXECUTE_IF("innobase_xa_fail", return XAER_RMFAIL;); + if (high_level_read_only) + return XAER_RMFAIL; + if (trx_t *trx= trx_get_trx_by_xid(xid)) + { + /* Lookup by xid clears the transaction xid. + For wsrep we clear it below. */ + ut_ad(trx->xid.is_null() || wsrep_is_wsrep_xid(&trx->xid)); + trx->xid.null(); + trx_deregister_from_2pc(trx); + THD* thd= trx->mysql_thd; + dberr_t err= trx_rollback_for_mysql(trx); + ut_ad(!trx->will_lock); + trx->free(); + return convert_error_code_to_mysql(err, 0, thd); + } + return XAER_NOTA; +} + /*********************************************************************//** Copy table flags from MySQL's HA_CREATE_INFO into an InnoDB table object. Those flags are stored in .frm file and end up in the MySQL table object, @@ -4090,7 +4196,7 @@ static int innodb_init(void* p) innodb_hton_ptr = innobase_hton; innobase_hton->db_type = DB_TYPE_INNODB; - innobase_hton->savepoint_offset = sizeof(trx_named_savept_t); + innobase_hton->savepoint_offset = sizeof(undo_no_t); innobase_hton->close_connection = innobase_close_connection; innobase_hton->kill_query = innobase_kill_query; innobase_hton->savepoint_set = innobase_savepoint; @@ -4168,8 +4274,6 @@ static int innodb_init(void* p) test_filename)); #endif /* DBUG_OFF */ - os_file_set_umask(my_umask); - /* Setup the memory alloc/free tracing mechanisms before calling any functions that could possibly allocate memory. */ ut_new_boot(); @@ -4310,12 +4414,7 @@ innobase_commit_low( tmp = thd_proc_info(trx->mysql_thd, "innobase_commit_low()"); } #endif /* WITH_WSREP */ - if (trx_is_started(trx)) { - trx_commit_for_mysql(trx); - } else { - trx->will_lock = false; - } - + trx_commit_for_mysql(trx); #ifdef WITH_WSREP if (is_wsrep) { thd_proc_info(trx->mysql_thd, tmp); @@ -4346,7 +4445,7 @@ innobase_start_trx_and_assign_read_view( /* The transaction should not be active yet, start it */ - ut_ad(!trx_is_started(trx)); + ut_ad(!trx->is_started()); trx_start_if_not_started_xa(trx, false); @@ -4369,7 +4468,7 @@ innobase_start_trx_and_assign_read_view( /* Set the MySQL flag to mark that there is an active transaction */ - innobase_register_trx(hton, current_thd, trx); + innobase_register_trx(hton, thd, trx); DBUG_RETURN(0); } @@ -4447,7 +4546,7 @@ innobase_commit_ordered( trx = check_trx_exists(thd); - if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { + if (!trx_is_registered_for_2pc(trx) && trx->is_started()) { /* We cannot throw error here; instead we will catch this error again in innobase_commit() and report it from there. */ DBUG_VOID_RETURN; @@ -4467,19 +4566,36 @@ innobase_commit_ordered( /** Mark the end of a statement. @param trx transaction @return whether an error occurred */ -static bool end_of_statement(trx_t *trx) +static bool end_of_statement(trx_t *trx) noexcept { - trx_mark_sql_stat_end(trx); + ut_d(const trx_state_t trx_state{trx->state}); + ut_ad(trx_state == TRX_STATE_ACTIVE || trx_state == TRX_STATE_NOT_STARTED); + + if (trx->fts_trx) + fts_savepoint_laststmt_refresh(trx); + if (trx->is_bulk_insert()) + { + /* Allow a subsequent INSERT into an empty table + if !unique_checks && !foreign_key_checks. */ + + /* MDEV-25036 FIXME: we support buffered insert only for the first + insert statement */ + trx->error_state= trx->bulk_insert_apply(); + } + else + { + trx->last_stmt_start= trx->undo_no; + trx->end_bulk_insert(); + } + if (UNIV_LIKELY(trx->error_state == DB_SUCCESS)) return false; - trx_savept_t savept; - savept.least_undo_no= 0; + undo_no_t savept= 0; trx->rollback(&savept); /* MariaDB will roll back the entire transaction. */ trx->bulk_insert= false; - trx->last_sql_stat_start.least_undo_no= 0; - trx->savepoints_discard(); + trx->last_stmt_start= 0; return true; } @@ -4510,20 +4626,36 @@ innobase_commit( ut_ad(!trx->dict_operation_lock_mode); ut_ad(!trx->dict_operation); - /* Transaction is deregistered only in a commit or a rollback. If - it is deregistered we know there cannot be resources to be freed - and we could return immediately. For the time being, we play safe - and do the cleanup though there should be nothing to clean up. */ - - if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { - - sql_print_error("Transaction not registered for MariaDB 2PC," - " but transaction is active"); + switch (UNIV_EXPECT(trx->state, TRX_STATE_ACTIVE)) { + case TRX_STATE_ABORTED: + trx->state = TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: + break; + default: + case TRX_STATE_COMMITTED_IN_MEMORY: + case TRX_STATE_PREPARED_RECOVERED: + ut_ad("invalid state" == 0); + /* fall through */ + case TRX_STATE_PREPARED: + ut_ad(commit_trx); + ut_ad(thd_test_options(thd, OPTION_NOT_AUTOCOMMIT + | OPTION_BEGIN)); + /* fall through */ + case TRX_STATE_ACTIVE: + /* Transaction is deregistered only in a commit or a + rollback. If it is deregistered we know there cannot + be resources to be freed and we could return + immediately. For the time being, we play safe and do + the cleanup though there should be nothing to clean + up. */ + if (!trx_is_registered_for_2pc(trx)) { + sql_print_error("Transaction not registered" + " for MariaDB 2PC," + " but transaction is active"); + } } - bool read_only = trx->read_only || trx->id == 0; - DBUG_PRINT("info", ("readonly: %d", read_only)); - if (commit_trx || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { @@ -4548,17 +4680,7 @@ innobase_commit( } else { /* We just mark the SQL statement ended and do not do a transaction commit */ - - /* If we had reserved the auto-inc lock for some - table in this SQL statement we release it now */ - - if (!read_only) { - lock_unlock_table_autoinc(trx); - } - - /* Store the current undo_no of the transaction so that we - know where to roll back if we have to roll back the next - SQL statement */ + lock_unlock_table_autoinc(trx); if (UNIV_UNLIKELY(end_of_statement(trx))) { DBUG_RETURN(1); } @@ -4580,7 +4702,7 @@ static int innobase_rollback( /*==============*/ - handlerton* hton, /*!< in: InnoDB handlerton */ + handlerton*, THD* thd, /*!< in: handle to the MySQL thread of the user whose transaction should be rolled back */ @@ -4588,74 +4710,79 @@ innobase_rollback( transaction FALSE - rollback the current statement only */ { - DBUG_ENTER("innobase_rollback"); - DBUG_ASSERT(hton == innodb_hton_ptr); - DBUG_PRINT("trans", ("aborting transaction")); + DBUG_ENTER("innobase_rollback"); + DBUG_PRINT("trans", ("aborting transaction")); - trx_t* trx = check_trx_exists(thd); + if (!rollback_trx) + rollback_trx= !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN); - ut_ad(!trx->dict_operation_lock_mode); - ut_ad(!trx->dict_operation); + trx_t *trx= check_trx_exists(thd); - /* Reset the number AUTO-INC rows required */ + ut_ad(trx->mysql_thd == thd); + ut_ad(!trx->is_recovered); + ut_ad(!trx->dict_operation_lock_mode); + ut_ad(!trx->dict_operation); - trx->n_autoinc_rows = 0; + /* Reset the number AUTO-INC rows required */ + trx->n_autoinc_rows= 0; + /* This is a statement level variable. */ + trx->fts_next_doc_id= 0; - /* If we had reserved the auto-inc lock for some table (if - we come here to roll back the latest SQL statement) we - release it now before a possibly lengthy rollback */ - lock_unlock_table_autoinc(trx); - - /* This is a statement level variable. */ - - trx->fts_next_doc_id = 0; - - dberr_t error; + const trx_state_t trx_state{trx->state}; + switch (UNIV_EXPECT(trx_state, TRX_STATE_ACTIVE)) { + case TRX_STATE_ABORTED: + if (rollback_trx) + trx->state= TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: + ut_ad(!trx->id); + trx->will_lock= false; + if (rollback_trx) + trx_deregister_from_2pc(trx); + DBUG_RETURN(0); + default: + case TRX_STATE_COMMITTED_IN_MEMORY: + case TRX_STATE_PREPARED_RECOVERED: + ut_ad("invalid state" == 0); + /* fall through */ + case TRX_STATE_PREPARED: + ut_ad(rollback_trx); + /* fall through */ + case TRX_STATE_ACTIVE: + /* If we had reserved the auto-inc lock for some table (if + we come here to roll back the latest SQL statement) we + release it now before a possibly lengthy rollback */ + lock_unlock_table_autoinc(trx); #ifdef WITH_WSREP - /* If trx was assigned wsrep XID in prepare phase and the - trx is being rolled back due to BF abort, clear XID in order - to avoid writing it to rollback segment out of order. The XID - will be reassigned when the transaction is replayed. */ - if (trx->state != TRX_STATE_NOT_STARTED - && wsrep_is_wsrep_xid(&trx->xid)) { - trx->xid.null(); - } + /* If trx was assigned wsrep XID in prepare phase and the + trx is being rolled back due to BF abort, clear XID in order + to avoid writing it to rollback segment out of order. The XID + will be reassigned when the transaction is replayed. */ + if (rollback_trx || wsrep_is_wsrep_xid(&trx->xid)) + trx->xid.null(); #endif /* WITH_WSREP */ - if (rollback_trx - || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { - - error = trx_rollback_for_mysql(trx); - - trx_deregister_from_2pc(trx); - } else { - - error = trx_rollback_last_sql_stat_for_mysql(trx); - } - - DBUG_RETURN(convert_error_code_to_mysql(error, 0, trx->mysql_thd)); -} - -/*****************************************************************//** -Rolls back a transaction -@return 0 or error number */ -static -int -innobase_rollback_trx( -/*==================*/ - trx_t* trx) /*!< in: transaction */ -{ - DBUG_ENTER("innobase_rollback_trx"); - DBUG_PRINT("trans", ("aborting transaction")); - - /* If we had reserved the auto-inc lock for some table (if - we come here to roll back the latest SQL statement) we - release it now before a possibly lengthy rollback */ - lock_unlock_table_autoinc(trx); - trx_deregister_from_2pc(trx); - - DBUG_RETURN(convert_error_code_to_mysql(trx_rollback_for_mysql(trx), - 0, trx->mysql_thd)); + dberr_t error; + if (rollback_trx) + { + error= trx_rollback_for_mysql(trx); + trx_deregister_from_2pc(trx); + } + else + { + ut_a(trx_state == TRX_STATE_ACTIVE); + ut_ad(!trx->is_autocommit_non_locking() || trx->read_only); + error= trx->rollback(&trx->last_stmt_start); + if (trx->fts_trx) + { + fts_savepoint_rollback_last_stmt(trx); + fts_savepoint_laststmt_refresh(trx); + } + trx->last_stmt_start= trx->undo_no; + trx->end_bulk_insert(); + } + DBUG_RETURN(convert_error_code_to_mysql(error, 0, trx->mysql_thd)); + } } /** Invoke commit_checkpoint_notify_ha() on completed log flush requests. @@ -4792,34 +4919,43 @@ static int innobase_rollback_to_savepoint( /*===========================*/ - handlerton* hton, /*!< in: InnoDB handlerton */ + handlerton*, THD* thd, /*!< in: handle to the MySQL thread of the user whose transaction should be rolled back to savepoint */ void* savepoint) /*!< in: savepoint data */ { + DBUG_ENTER("innobase_rollback_to_savepoint"); + trx_t *trx= check_trx_exists(thd); - DBUG_ENTER("innobase_rollback_to_savepoint"); - DBUG_ASSERT(hton == innodb_hton_ptr); + /* We are reading trx->state without holding trx->mutex here, + because the savepoint rollback should be invoked for a running + active transaction that is associated with the current thread. */ + ut_ad(trx->mysql_thd); - trx_t* trx = check_trx_exists(thd); + if (UNIV_UNLIKELY(trx->state != TRX_STATE_ACTIVE)) + { + ut_ad("invalid state" == 0); + DBUG_RETURN(HA_ERR_NO_SAVEPOINT); + } - /* TODO: use provided savepoint data area to store savepoint data */ + const undo_no_t *savept= static_cast(savepoint); - char name[64]; + if (UNIV_UNLIKELY(*savept > trx->undo_no)) + /* row_mysql_handle_errors() should have invoked rollback during + a bulk insert into an empty table. */ + DBUG_RETURN(HA_ERR_NO_SAVEPOINT); - longlong2str(longlong(savepoint), name, 36); - - int64_t mysql_binlog_cache_pos; - - dberr_t error = trx_rollback_to_savepoint_for_mysql( - trx, name, &mysql_binlog_cache_pos); - - if (error == DB_SUCCESS && trx->fts_trx != NULL) { - fts_savepoint_rollback(trx, name); - } - - DBUG_RETURN(convert_error_code_to_mysql(error, 0, NULL)); + dberr_t error= trx->rollback(savept); + /* Store the position for rolling back the next SQL statement */ + if (trx->fts_trx) + { + fts_savepoint_laststmt_refresh(trx); + fts_savepoint_rollback(trx, savept); + } + trx->last_stmt_start= trx->undo_no; + trx->end_bulk_insert(); + DBUG_RETURN(convert_error_code_to_mysql(error, 0, nullptr)); } /*****************************************************************//** @@ -4852,106 +4988,6 @@ innobase_rollback_to_savepoint_can_release_mdl( DBUG_RETURN(false); } -/*****************************************************************//** -Release transaction savepoint name. -@return 0 if success, HA_ERR_NO_SAVEPOINT if no savepoint with the -given name */ -static -int -innobase_release_savepoint( -/*=======================*/ - handlerton* hton, /*!< in: handlerton for InnoDB */ - THD* thd, /*!< in: handle to the MySQL thread - of the user whose transaction's - savepoint should be released */ - void* savepoint) /*!< in: savepoint data */ -{ - dberr_t error; - trx_t* trx; - char name[64]; - - DBUG_ENTER("innobase_release_savepoint"); - DBUG_ASSERT(hton == innodb_hton_ptr); - - trx = check_trx_exists(thd); - - /* TODO: use provided savepoint data area to store savepoint data */ - - longlong2str(longlong(savepoint), name, 36); - - error = trx_release_savepoint_for_mysql(trx, name); - - if (error == DB_SUCCESS && trx->fts_trx != NULL) { - fts_savepoint_release(trx, name); - } - - DBUG_RETURN(convert_error_code_to_mysql(error, 0, NULL)); -} - -/*****************************************************************//** -Sets a transaction savepoint. -@return always 0, that is, always succeeds */ -static -int -innobase_savepoint( -/*===============*/ - handlerton* hton, /*!< in: handle to the InnoDB handlerton */ - THD* thd, /*!< in: handle to the MySQL thread */ - void* savepoint)/*!< in: savepoint data */ -{ - DBUG_ENTER("innobase_savepoint"); - DBUG_ASSERT(hton == innodb_hton_ptr); - - /* In the autocommit mode there is no sense to set a savepoint - (unless we are in sub-statement), so SQL layer ensures that - this method is never called in such situation. */ - - trx_t* trx = check_trx_exists(thd); - - /* Cannot happen outside of transaction */ - DBUG_ASSERT(trx_is_registered_for_2pc(trx)); - - /* TODO: use provided savepoint data area to store savepoint data */ - char name[64]; - - longlong2str(longlong(savepoint), name, 36); - - dberr_t error = trx_savepoint_for_mysql(trx, name, 0); - - if (error == DB_SUCCESS && trx->fts_trx != NULL) { - fts_savepoint_take(trx->fts_trx, name); - } - - DBUG_RETURN(convert_error_code_to_mysql(error, 0, NULL)); -} - - -/** - Frees a possible InnoDB trx object associated with the current THD. - - @param hton innobase handlerton - @param thd server thread descriptor, which resources should be free'd - - @return 0 always -*/ -static int innobase_close_connection(handlerton *hton, THD *thd) -{ - DBUG_ASSERT(hton == innodb_hton_ptr); - if (auto trx= thd_to_trx(thd)) - { - thd_set_ha_data(thd, innodb_hton_ptr, NULL); - if (trx->state == TRX_STATE_PREPARED && trx->has_logged_persistent()) - { - trx_disconnect_prepared(trx); - return 0; - } - innobase_rollback_trx(trx); - trx->free(); - DEBUG_SYNC(thd, "innobase_connection_closed"); - } - return 0; -} - /** Cancel any pending lock request associated with the current THD. @sa THD::awake() @sa ha_kill_query() */ static void innobase_kill_query(handlerton*, THD *thd, enum thd_kill_levels) @@ -7740,26 +7776,35 @@ ha_innobase::innobase_set_max_autoinc( return(error); } -/** @return whether the table is read-only */ -bool ha_innobase::is_read_only(bool altering_to_supported) const +int ha_innobase::is_valid_trx(bool altering_to_supported) const noexcept { ut_ad(m_prebuilt->trx == thd_to_trx(m_user_thd)); if (high_level_read_only) { ib_senderrf(m_user_thd, IB_LOG_LEVEL_WARN, ER_READ_ONLY_MODE); - return true; + return HA_ERR_TABLE_READONLY; } - if (altering_to_supported) - return false; + switch (UNIV_EXPECT(m_prebuilt->trx->state, TRX_STATE_ACTIVE)) { + default: + ut_ad("invalid state" == 0); + /* fall through */ + case TRX_STATE_ABORTED: + break; + case TRX_STATE_NOT_STARTED: + m_prebuilt->trx->will_lock= true; + /* fall through */ + case TRX_STATE_ACTIVE: + if (altering_to_supported || + !DICT_TF_GET_ZIP_SSIZE(m_prebuilt->table->flags) || + !innodb_read_only_compressed) + return 0; - if (!DICT_TF_GET_ZIP_SSIZE(m_prebuilt->table->flags) || - !innodb_read_only_compressed) - return false; - - ib_senderrf(m_user_thd, IB_LOG_LEVEL_WARN, ER_UNSUPPORTED_COMPRESSED_TABLE); - return true; + ib_senderrf(m_user_thd, IB_LOG_LEVEL_WARN, ER_UNSUPPORTED_COMPRESSED_TABLE); + return HA_ERR_TABLE_READONLY; + } + return HA_ERR_ROLLBACK; } /********************************************************************//** @@ -7785,12 +7830,8 @@ ha_innobase::write_row( trx_t* trx = thd_to_trx(m_user_thd); /* Validation checks before we commence write_row operation. */ - if (is_read_only()) { - DBUG_RETURN(HA_ERR_TABLE_READONLY); - } - - if (!trx_is_started(trx)) { - trx->will_lock = true; + if (int err = is_valid_trx()) { + DBUG_RETURN(err); } ins_mode_t vers_set_fields; @@ -8559,10 +8600,8 @@ ha_innobase::update_row( DBUG_ENTER("ha_innobase::update_row"); - if (is_read_only()) { - DBUG_RETURN(HA_ERR_TABLE_READONLY); - } else if (!trx_is_started(trx)) { - trx->will_lock = true; + if (int err = is_valid_trx()) { + DBUG_RETURN(err); } if (m_upd_buf == NULL) { @@ -8680,7 +8719,8 @@ func_exit: if (error == DB_SUCCESS && /* For sequences, InnoDB transaction may not have been started yet. Check THD-level wsrep state in that case. */ - (trx->is_wsrep() || (!trx_is_started(trx) && wsrep_on(m_user_thd))) + (trx->is_wsrep() + || (trx->state == TRX_STATE_NOT_STARTED && wsrep_on(m_user_thd))) && wsrep_thd_is_local(m_user_thd) && !wsrep_thd_ignore_table(m_user_thd) && (thd_sql_command(m_user_thd) != SQLCOM_CREATE_TABLE) @@ -8724,12 +8764,9 @@ ha_innobase::delete_row( DBUG_ENTER("ha_innobase::delete_row"); - if (is_read_only()) { - DBUG_RETURN(HA_ERR_TABLE_READONLY); - } else if (!trx_is_started(trx)) { - trx->will_lock = true; + if (int err = is_valid_trx()) { + DBUG_RETURN(err); } - if (!m_prebuilt->upd_node) { row_get_prebuilt_update_vector(m_prebuilt); } @@ -9006,10 +9043,15 @@ ha_innobase::index_read( DBUG_RETURN(HA_ERR_KEY_NOT_FOUND); } + const trx_state_t trx_state{m_prebuilt->trx->state}; + if (trx_state == TRX_STATE_ABORTED) { + DBUG_RETURN(HA_ERR_ROLLBACK); + } + /* For R-Tree index, we will always place the page lock to pages being searched */ if (index->is_spatial() && !m_prebuilt->trx->will_lock) { - if (trx_is_started(m_prebuilt->trx)) { + if (trx_state != TRX_STATE_NOT_STARTED) { DBUG_RETURN(HA_ERR_READ_ONLY_TRANSACTION); } else { m_prebuilt->trx->will_lock = true; @@ -9283,6 +9325,17 @@ ha_innobase::general_fetch( ut_ad(trx == thd_to_trx(m_user_thd)); + switch (UNIV_EXPECT(trx->state, TRX_STATE_ACTIVE)) { + default: + ut_ad("invalid state" == 0); + /* fall through */ + case TRX_STATE_ABORTED: + DBUG_RETURN(HA_ERR_ROLLBACK); + case TRX_STATE_ACTIVE: + case TRX_STATE_NOT_STARTED: + break; + } + if (m_prebuilt->table->is_readable()) { } else if (m_prebuilt->table->corrupted) { DBUG_RETURN(HA_ERR_CRASHED); @@ -9541,9 +9594,7 @@ ha_innobase::rnd_pos( Initialize FT index scan @return 0 or error number */ -int -ha_innobase::ft_init() -/*==================*/ +int ha_innobase::ft_init() { DBUG_ENTER("ft_init"); @@ -9553,9 +9604,14 @@ ha_innobase::ft_init() This is because the FTS implementation can acquire locks behind the scenes. This has not been verified but it is safer to treat them as regular read only transactions for now. */ - - if (!trx_is_started(trx)) { + switch (trx->state) { + default: + DBUG_RETURN(HA_ERR_ROLLBACK); + case TRX_STATE_ACTIVE: + break; + case TRX_STATE_NOT_STARTED: trx->will_lock = true; + break; } /* If there is an FTS scan in progress, stop it */ @@ -9594,11 +9650,9 @@ ha_innobase::ft_init_ext( out.write(key->ptr(), key->length()); } - if (flags & FT_BOOL) { - ib::info() << "BOOL search"; - } else { - ib::info() << "NL search"; - } + sql_print_information((flags & FT_BOOL) + ? "InnoDB: BOOL search" + : "InnoDB: NL search"); } /* Multi byte character sets like utf32 and utf16 are not @@ -9623,8 +9677,17 @@ ha_innobase::ft_init_ext( the scenes. This has not been verified but it is safer to treat them as regular read only transactions for now. */ - if (!trx_is_started(trx)) { + switch (trx->state) { + default: + ut_ad("invalid state" == 0); + my_printf_error(HA_ERR_ROLLBACK, "Invalid tansaction state", + ME_ERROR_LOG); + return nullptr; + case TRX_STATE_ACTIVE: + break; + case TRX_STATE_NOT_STARTED: trx->will_lock = true; + break; } dict_table_t* ft_table = m_prebuilt->table; @@ -12807,7 +12870,7 @@ int create_table_info_t::create_table(bool create_fk) " on table %s. Please check" " the index definition to" " make sure it is of correct" - " type\n", + " type", FTS_DOC_ID_INDEX_NAME, m_table->name.m_name); @@ -12880,7 +12943,7 @@ int create_table_info_t::create_table(bool create_fk) "Create table '%s' with foreign key constraint" " failed. There is no index in the referenced" " table where the referenced columns appear" - " as the first columns.\n", m_table_name); + " as the first columns.", m_table_name); break; case DB_CHILD_NO_INDEX: @@ -12890,7 +12953,7 @@ int create_table_info_t::create_table(bool create_fk) "Create table '%s' with foreign key constraint" " failed. There is no index in the referencing" " table where referencing columns appear" - " as the first columns.\n", m_table_name); + " as the first columns.", m_table_name); break; case DB_NO_FK_ON_S_BASE_COL: push_warning_printf( @@ -12899,7 +12962,7 @@ int create_table_info_t::create_table(bool create_fk) "Create table '%s' with foreign key constraint" " failed. Cannot add foreign key constraint" " placed on the base column of stored" - " column. \n", + " column. ", m_table_name); default: break; @@ -13324,12 +13387,8 @@ ha_innobase::discard_or_import_tablespace( DBUG_ENTER("ha_innobase::discard_or_import_tablespace"); - ut_a(m_prebuilt->trx != NULL); - ut_a(m_prebuilt->trx->magic_n == TRX_MAGIC_N); - ut_a(m_prebuilt->trx == thd_to_trx(ha_thd())); - - if (is_read_only()) { - DBUG_RETURN(HA_ERR_TABLE_READONLY); + if (int err = is_valid_trx()) { + DBUG_RETURN(err); } if (m_prebuilt->table->is_temporary()) { @@ -13877,8 +13936,8 @@ int ha_innobase::truncate() } #endif - if (is_read_only()) - DBUG_RETURN(HA_ERR_TABLE_READONLY); + if (int err= is_valid_trx()) + DBUG_RETURN(err); HA_CREATE_INFO info; dict_table_t *ib_table= m_prebuilt->table; @@ -15897,6 +15956,16 @@ ha_innobase::start_stmt( trx = m_prebuilt->trx; + switch (trx->state) { + default: + DBUG_RETURN(HA_ERR_ROLLBACK); + case TRX_STATE_ACTIVE: + break; + case TRX_STATE_NOT_STARTED: + trx->will_lock = true; + break; + } + /* Reset the AUTOINC statement level counter for multi-row INSERTs. */ trx->n_autoinc_rows = 0; @@ -15923,7 +15992,7 @@ ha_innobase::start_stmt( } trx->bulk_insert = false; - trx->last_sql_stat_start.least_undo_no = trx->undo_no; + trx->last_stmt_start = trx->undo_no; } m_prebuilt->sql_stat_start = TRUE; @@ -15981,10 +16050,6 @@ ha_innobase::start_stmt( innobase_register_trx(ht, thd, trx); - if (!trx_is_started(trx)) { - trx->will_lock = true; - } - DBUG_RETURN(0); } @@ -16036,6 +16101,28 @@ ha_innobase::external_lock( trx_t* trx = m_prebuilt->trx; ut_ad(m_prebuilt->table); + const bool not_autocommit = thd_test_options(thd, OPTION_NOT_AUTOCOMMIT + | OPTION_BEGIN); + bool not_started = false; + switch (trx->state) { + default: + case TRX_STATE_PREPARED: + ut_ad("invalid state" == 0); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + case TRX_STATE_ABORTED: + if (lock_type != F_UNLCK && not_autocommit) { + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } + /* Reset the state if the transaction had been aborted. */ + trx->state = TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: + not_started = true; + break; + case TRX_STATE_ACTIVE: + break; + } + /* Statement based binlogging does not work in isolation level READ UNCOMMITTED and READ COMMITTED since the necessary locks cannot be taken. In this case, we print an @@ -16113,7 +16200,7 @@ ha_innobase::external_lock( break; } trx->bulk_insert = false; - trx->last_sql_stat_start.least_undo_no = trx->undo_no; + trx->last_stmt_start = trx->undo_no; } switch (m_prebuilt->table->quiesce) { @@ -16159,25 +16246,47 @@ ha_innobase::external_lock( break; } - if (lock_type == F_WRLCK) { + switch (lock_type) { + case F_UNLCK: + DEBUG_SYNC_C("ha_innobase_end_statement"); + m_mysql_has_locked = false; + if (--trx->n_mysql_tables_in_use) { + break; + } + + /* If the lock count drops to zero we know that the + current SQL statement has ended */ + trx->mysql_n_tables_locked = 0; + m_prebuilt->used_in_HANDLER = FALSE; + + if (!not_autocommit) { + if (!not_started) { + innobase_commit(ht, thd, TRUE); + } + } else if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) { + trx->read_view.close(); + } + break; + case F_WRLCK: /* If this is a SELECT, then it is in UPDATE TABLE ... or SELECT ... FOR UPDATE */ m_prebuilt->select_lock_type = LOCK_X; m_prebuilt->stored_select_lock_type = LOCK_X; - } - - if (lock_type != F_UNLCK) { - /* MySQL is setting a new table lock */ - + goto set_lock; + case F_RDLCK: + /* Ensure that trx->lock.trx_locks is empty for read-only + autocommit transactions */ + ut_ad(not_autocommit || trx->n_mysql_tables_in_use + || UT_LIST_GET_LEN(trx->lock.trx_locks) == 0); +set_lock: *trx->detailed_error = 0; innobase_register_trx(ht, thd, trx); - if (trx->isolation_level == TRX_ISO_SERIALIZABLE - && m_prebuilt->select_lock_type == LOCK_NONE - && thd_test_options( - thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { + if (not_autocommit + && trx->isolation_level == TRX_ISO_SERIALIZABLE + && m_prebuilt->select_lock_type == LOCK_NONE) { /* To get serializable execution, we let InnoDB conceptually add 'LOCK IN SHARE MODE' to all SELECTs @@ -16225,42 +16334,12 @@ ha_innobase::external_lock( trx->n_mysql_tables_in_use++; m_mysql_has_locked = true; - if (!trx_is_started(trx) + if (not_started && (m_prebuilt->select_lock_type != LOCK_NONE || m_prebuilt->stored_select_lock_type != LOCK_NONE)) { trx->will_lock = true; } - - DBUG_RETURN(0); - } - - DEBUG_SYNC_C("ha_innobase_end_statement"); - - /* MySQL is releasing a table lock */ - - trx->n_mysql_tables_in_use--; - m_mysql_has_locked = false; - - /* If the MySQL lock count drops to zero we know that the current SQL - statement has ended */ - - if (trx->n_mysql_tables_in_use == 0) { - - trx->mysql_n_tables_locked = 0; - m_prebuilt->used_in_HANDLER = FALSE; - - if (!thd_test_options( - thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { - - if (trx_is_started(trx)) { - - innobase_commit(ht, thd, TRUE); - } - - } else if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) { - trx->read_view.close(); - } } DBUG_RETURN(0); @@ -16604,14 +16683,6 @@ ha_innobase::store_lock( } m_prebuilt->skip_locked= (lock_type == TL_WRITE_SKIP_LOCKED || lock_type == TL_READ_SKIP_LOCKED); - - if (!trx_is_started(trx) - && (m_prebuilt->select_lock_type != LOCK_NONE - || m_prebuilt->stored_select_lock_type != LOCK_NONE)) { - - trx->will_lock = true; - } - return(to); } @@ -17086,7 +17157,7 @@ static int innobase_xa_prepare( /*================*/ - handlerton* hton, /*!< in: InnoDB handlerton */ + handlerton*, THD* thd, /*!< in: handle to the MySQL thread of the user whose XA transaction should be prepared */ @@ -17094,63 +17165,30 @@ innobase_xa_prepare( false - the current SQL statement ended */ { - trx_t* trx = check_trx_exists(thd); + trx_t *trx= check_trx_exists(thd); + ut_ad(trx_is_registered_for_2pc(trx)); + if (!prepare_trx) + prepare_trx= !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN); - DBUG_ASSERT(hton == innodb_hton_ptr); - - thd_get_xid(thd, &reinterpret_cast(trx->xid)); - - if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { - - sql_print_error("Transaction not registered for MariaDB 2PC," - " but transaction is active"); - } - - if (prepare_trx - || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { - - /* We were instructed to prepare the whole transaction, or - this is an SQL statement end and autocommit is on */ - - ut_ad(trx_is_registered_for_2pc(trx)); - - trx_prepare_for_mysql(trx); - } else { - /* We just mark the SQL statement ended and do not do a - transaction prepare */ - - /* If we had reserved the auto-inc lock for some - table in this SQL statement we release it now */ - - lock_unlock_table_autoinc(trx); - - /* Store the current undo_no of the transaction so that we - know where to roll back if we have to roll back the next - SQL statement */ - if (UNIV_UNLIKELY(end_of_statement(trx))) { - return 1; - } - } - - if (thd_sql_command(thd) != SQLCOM_XA_PREPARE - && (prepare_trx - || !thd_test_options( - thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { - - /* For mysqlbackup to work the order of transactions in binlog - and InnoDB must be the same. Consider the situation - - thread1> prepare; write to binlog; ... - - thread2> prepare; write to binlog; commit - thread1> ... commit - - The server guarantees that writes to the binary log - and commits are in the same order, so we do not have - to handle this case. */ - } - - return(0); + switch (UNIV_EXPECT(trx->state, TRX_STATE_ACTIVE)) { + default: + ut_ad("invalid state" == 0); + return HA_ERR_GENERIC; + case TRX_STATE_NOT_STARTED: + if (prepare_trx) + trx_start_if_not_started_xa(trx, false);; + /* fall through */ + case TRX_STATE_ACTIVE: + thd_get_xid(thd, &reinterpret_cast(trx->xid)); + if (prepare_trx) + trx_prepare_for_mysql(trx); + else + { + lock_unlock_table_autoinc(trx); + return end_of_statement(trx); + } + return 0; + } } /*******************************************************************//** @@ -17160,12 +17198,10 @@ static int innobase_xa_recover( /*================*/ - handlerton* hton, /*!< in: InnoDB handlerton */ + handlerton*, XID* xid_list,/*!< in/out: prepared transactions */ uint len) /*!< in: number of slots in xid_list */ { - DBUG_ASSERT(hton == innodb_hton_ptr); - if (len == 0 || xid_list == NULL) { return(0); @@ -17208,43 +17244,6 @@ innobase_commit_by_xid( } } -/** This function is used to rollback one X/Open XA distributed transaction -which is in the prepared state - -@param[in] hton InnoDB handlerton -@param[in] xid X/Open XA transaction identification - -@return 0 or error number */ -int innobase_rollback_by_xid(handlerton* hton, XID* xid) -{ - DBUG_ASSERT(hton == innodb_hton_ptr); - - DBUG_EXECUTE_IF("innobase_xa_fail", - return XAER_RMFAIL;); - - if (high_level_read_only) { - return(XAER_RMFAIL); - } - - if (trx_t* trx = trx_get_trx_by_xid(xid)) { -#ifdef WITH_WSREP - /* If a wsrep transaction is being rolled back during - the recovery, we must clear the xid in order to avoid - writing serialisation history for rolled back transaction. */ - if (wsrep_is_wsrep_xid(&trx->xid)) { - trx->xid.null(); - } -#endif /* WITH_WSREP */ - int ret = innobase_rollback_trx(trx); - ut_ad(!trx->will_lock); - trx->free(); - - return(ret); - } else { - return(XAER_NOTA); - } -} - bool ha_innobase::check_if_incompatible_data( /*====================================*/ diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 4f9a3c64665..2f81306bbea 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -465,8 +465,13 @@ protected: @see build_template() */ void reset_template(); - /** @return whether the table is read-only */ - bool is_read_only(bool altering_to_supported= false) const; + /** Check the transaction is valid. + @param altering_to_supported whether an ALTER TABLE is being run + to something else than ROW_FORMAT=COMPRESSED + @retval 0 if the transaction is valid for the current operation + @retval HA_ERR_TABLE_READONLY if the table is read-only + @retval HA_ERR_ROLLBACK if the transaction has been aborted */ + int is_valid_trx(bool altering_to_supported= false) const noexcept; inline void update_thd(THD* thd); void update_thd(); @@ -946,12 +951,3 @@ ib_push_frm_error( @return true if index column length exceeds limit */ MY_ATTRIBUTE((warn_unused_result)) bool too_big_key_part_length(size_t max_field_len, const KEY& key); - -/** This function is used to rollback one X/Open XA distributed transaction -which is in the prepared state - -@param[in] hton InnoDB handlerton -@param[in] xid X/Open XA transaction identification - -@return 0 or error number */ -int innobase_rollback_by_xid(handlerton* hton, XID* xid); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 6c9d9fc8eb3..a8c914ab1a8 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2248,7 +2248,7 @@ ha_innobase::check_if_supported_inplace_alter( table->s->table_name.str); } - if (is_read_only(!high_level_read_only + if (is_valid_trx(!high_level_read_only && (ha_alter_info->handler_flags & ALTER_OPTIONS) && ha_alter_info->create_info->key_block_size == 0 && ha_alter_info->create_info->row_type @@ -9170,7 +9170,7 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info, /* If we have not started a transaction yet, (almost) nothing has been or needs to be done. */ dict_sys.lock(SRW_LOCK_CALL); - else if (ctx->trx->state == TRX_STATE_NOT_STARTED) + else if (!ctx->trx->is_started()) goto free_and_exit; else if (ctx->new_table) { @@ -11412,7 +11412,7 @@ lock_fail: to remove the newly created table or index from data dictionary and table cache in rollback_inplace_alter_table() */ - if (trx->state == TRX_STATE_NOT_STARTED) { + if (!trx->is_started()) { trx_start_for_ddl(trx); } @@ -11579,7 +11579,7 @@ err_index: purge_sys.resume_FTS(); } - if (trx->state == TRX_STATE_NOT_STARTED) { + if (!trx->is_started()) { /* Transaction may have been rolled back due to a lock wait timeout, deadlock, or a KILL statement. So restart the diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index b27cfe5cc66..16ff1fd76de 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -6256,7 +6256,8 @@ static int i_s_sys_tablespaces_fill_table(THD *thd, TABLE_LIST *tables, Item*) for (fil_space_t &space : fil_system.space_list) { - if (space.purpose == FIL_TYPE_TABLESPACE && !space.is_stopping() && + if (!space.is_temporary() && !space.is_being_imported() && + !space.is_stopping() && space.chain.start) { space.reacquire(); @@ -6485,7 +6486,7 @@ i_s_tablespaces_encryption_fill_table( fil_system.freeze_space_list++; for (fil_space_t& space : fil_system.space_list) { - if (space.purpose == FIL_TYPE_TABLESPACE + if (!space.is_temporary() && !space.is_being_imported() && !space.is_stopping()) { space.reacquire(); mysql_mutex_unlock(&fil_system.mutex); diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index 960ec3905eb..921cc977e2e 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -68,8 +68,6 @@ enum dberr_t { noticed */ DB_CANNOT_DROP_CONSTRAINT, /*!< dropping a foreign key constraint from a table failed */ - DB_NO_SAVEPOINT, /*!< no savepoint exists with the given - name */ DB_TABLESPACE_EXISTS, /*!< we cannot create a new single-table tablespace because a file of the same name already exists */ diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 64ed03c0090..0b5630ed301 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1188,6 +1188,14 @@ public: | DICT_FTS | DICT_CORRUPT))); } + /** @return whether this is a normal, non-virtual B-tree index + (not SPATIAL or FULLTEXT) */ + bool is_normal_btree() const noexcept { + return UNIV_LIKELY(!(type & (DICT_SPATIAL + | DICT_FTS | DICT_CORRUPT + | DICT_VIRTUAL))); + } + /** @return whether the index includes virtual columns */ bool has_virtual() const { return type & DICT_VIRTUAL; } diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 585a18c8196..a25f535a072 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -68,16 +68,6 @@ class page_id_t; /** Structure containing encryption specification */ struct fil_space_crypt_t; -/** File types */ -enum fil_type_t { - /** temporary tablespace (temporary undo log or tables) */ - FIL_TYPE_TEMPORARY, - /** a tablespace that is being imported (no logging until finished) */ - FIL_TYPE_IMPORT, - /** persistent tablespace (for system, undo log or tables) */ - FIL_TYPE_TABLESPACE, -}; - struct fil_node_t; /** Structure to store first and last value of range */ @@ -312,39 +302,43 @@ struct fil_space_t final { #ifndef UNIV_INNOCHECKSUM friend fil_node_t; + + /** Constructor; see @fil_space_t::create() */ + inline explicit fil_space_t(uint32_t id, uint32_t flags, bool being_imported, + fil_space_crypt_t *crypt_data) noexcept; + ~fil_space_t() { ut_ad(!latch_owner); latch.destroy(); } - /** fil_system.spaces chain node */ - fil_space_t *hash; - /** LSN of the most recent fil_names_write_if_was_clean(). - Reset to 0 by fil_names_clear(). Protected by exclusive log_sys.latch. - If and only if max_lsn is nonzero, this is in fil_system.named_spaces. */ - lsn_t max_lsn; /** tablespace identifier */ uint32_t id; - fil_type_t purpose;/*!< purpose */ - UT_LIST_BASE_NODE_T(fil_node_t) chain; - /*!< base node for the file chain */ - uint32_t size; /*!< tablespace file size in pages; - 0 if not known yet */ - uint32_t size_in_header; - /* FSP_SIZE in the tablespace header; - 0 if not known yet */ - uint32_t free_len; - /*!< length of the FSP_FREE list */ - uint32_t free_limit; - /*!< contents of FSP_FREE_LIMIT */ - uint32_t recv_size; - /*!< recovered tablespace size in pages; - 0 if no size change was read from the redo log, - or if the size change was implemented */ - uint32_t n_reserved_extents; - /*!< number of reserved free extents for - ongoing operations like B-tree page split */ + + /** fil_system.spaces chain node */ + fil_space_t *hash= nullptr; + /** log_sys.get_lsn() of the most recent fil_names_write_if_was_clean(). + Reset to 0 by fil_names_clear(). Protected by log_sys.mutex. + If and only if this is nonzero, the tablespace will be in named_spaces. */ + lsn_t max_lsn= 0; + /** base node for the chain of data files; multiple entries are + only possible for is_temporary() or id==0 */ + UT_LIST_BASE_NODE_T(fil_node_t) chain; + /** tablespace size in pages; 0 if not determined yet */ + uint32_t size= 0; + /** FSP_SIZE in the tablespace header; 0 if not determined yet */ + uint32_t size_in_header= 0; + /** length of the FSP_FREE list */ + uint32_t free_len= 0; + /** contents of FSP_FREE_LIMIT */ + uint32_t free_limit= 0; + /** recovered tablespace size in pages; 0 if no size change was read + from the redo log, or if the size change was applied */ + uint32_t recv_size= 0; + /** number of reserved free extents for ongoing operations like + B-tree page split */ + uint32_t n_reserved_extents= 0; private: #ifdef UNIV_DEBUG fil_space_t *next_in_space_list(); @@ -355,10 +349,10 @@ private: #endif /** the committed size of the tablespace in pages */ - Atomic_relaxed committed_size; + Atomic_relaxed committed_size{0}; /** Number of pending operations on the file. The tablespace cannot be freed while (n_pending & PENDING) != 0. */ - std::atomic n_pending; + std::atomic n_pending{CLOSING}; /** Flag in n_pending that indicates that the tablespace is about to be deleted, and no further operations should be performed */ static constexpr uint32_t STOPPING_READS= 1U << 31; @@ -380,20 +374,23 @@ private: /** latch protecting all page allocation bitmap pages */ IF_DBUG(srw_lock_debug, srw_lock) latch; /** the thread that holds the exclusive latch, or 0 */ - pthread_t latch_owner; + pthread_t latch_owner= 0; public: /** MariaDB encryption data */ - fil_space_crypt_t *crypt_data; + fil_space_crypt_t *crypt_data= nullptr; /** Whether needs_flush(), or this is in fil_system.unflushed_spaces */ - bool is_in_unflushed_spaces; + bool is_in_unflushed_spaces= false; /** Whether this in fil_system.default_encrypt_tables (needs key rotation) */ - bool is_in_default_encrypt; + bool is_in_default_encrypt= false; private: + /** Whether the tablespace is being imported */ + bool being_imported= false; + /** Whether any corrupton of this tablespace has been reported */ - mutable std::atomic_flag is_corrupted; + mutable std::atomic_flag is_corrupted{false}; public: /** mutex to protect freed_ranges and last_freed_lsn */ @@ -403,11 +400,18 @@ private: range_set freed_ranges; /** LSN of freeing last page; protected by freed_range_mutex */ - lsn_t last_freed_lsn; + lsn_t last_freed_lsn= 0; /** LSN of undo tablespace creation or 0; protected by latch */ - lsn_t create_lsn; + lsn_t create_lsn= 0; public: + /** @return whether this is the temporary tablespace */ + bool is_temporary() const noexcept + { return UNIV_UNLIKELY(id == SRV_TMP_SPACE_ID); } + /** @return whether this tablespace is being imported */ + bool is_being_imported() const noexcept + { return UNIV_UNLIKELY(being_imported); } + /** @return whether doublewrite buffering is needed */ inline bool use_doublewrite() const; @@ -477,7 +481,7 @@ public: MY_ATTRIBUTE((nonnull)); /** Note that the tablespace has been imported. - Initially, purpose=FIL_TYPE_IMPORT so that no redo log is + Initially, purpose=IMPORT so that no redo log is written while the space ID is being updated in each page. */ inline void set_imported(); @@ -856,18 +860,18 @@ public: #ifndef UNIV_INNOCHECKSUM MY_ATTRIBUTE((warn_unused_result)) /** Create a tablespace in fil_system. - @param id tablespace identifier - @param flags tablespace flags - @param purpose tablespace purpose - @param crypt_data encryption information - @param mode encryption mode - @param opened true if space files are opened + @param id tablespace identifier + @param flags tablespace flags + @param being_imported whether this is IMPORT TABLESPACE + @param crypt_data encryption information + @param mode encryption mode + @param opened whether the tablespace files are open @return pointer to created tablespace, to be filled in with add() @retval nullptr on failure (such as when the same tablespace exists) */ - static fil_space_t *create(uint32_t id, uint32_t flags, - fil_type_t purpose, fil_space_crypt_t *crypt_data, + static fil_space_t *create(uint32_t id, uint32_t flags, bool being_imported, + fil_space_crypt_t *crypt_data, fil_encryption_t mode= FIL_ENCRYPTION_DEFAULT, - bool opened= false); + bool opened= false) noexcept; MY_ATTRIBUTE((warn_unused_result)) /** Acquire a tablespace reference. @@ -993,6 +997,18 @@ public: /** @return the tablespace name (databasename/tablename) */ name_type name() const; + /** How to validate tablespace files that are being opened */ + enum validate { + /** the file may be missing */ + MAYBE_MISSING= 0, + /** do not validate */ + VALIDATE_NOTHING, + /** validate the tablespace ID */ + VALIDATE_SPACE_ID, + /** opening a file for ALTER TABLE...IMPORT TABLESPACE */ + VALIDATE_IMPORT + }; + /** Update the data structures on write completion */ void complete_write(); @@ -1080,8 +1096,8 @@ inline bool fil_space_t::use_doublewrite() const inline void fil_space_t::set_imported() { - ut_ad(purpose == FIL_TYPE_IMPORT); - purpose= FIL_TYPE_TABLESPACE; + ut_ad(being_imported); + being_imported= false; UT_LIST_GET_FIRST(chain)->find_metadata(); } @@ -1418,7 +1434,8 @@ public: ulint n_open; /** last time we noted n_open exceeding the limit; protected by mutex */ time_t n_open_exceeded_time; - /** maximum persistent tablespace id that has ever been assigned */ + /** maximum space id in the existing tables; on InnoDB startup this is + initialized based on the data dictionary contents */ uint32_t max_assigned_id; /** nonzero if fil_node_open_file_low() should avoid moving the tablespace to the end of space_list, for FIFO policy of try_to_close() */ @@ -1521,7 +1538,7 @@ template inline void fil_space_t::flush() { mysql_mutex_assert_not_owner(&fil_system.mutex); ut_ad(!have_reference || (pending() & PENDING)); - ut_ad(purpose == FIL_TYPE_TABLESPACE || purpose == FIL_TYPE_IMPORT); + ut_ad(!is_temporary()); if (have_reference) flush_low(); else @@ -1639,7 +1656,7 @@ fil_ibd_create( uint32_t size, fil_encryption_t mode, uint32_t key_id, - dberr_t* err) + dberr_t* err) noexcept MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations. @@ -1648,43 +1665,28 @@ fil_ibd_create( @param[in] flags desired tablespace flags */ void fsp_flags_try_adjust(fil_space_t *space, uint32_t flags); -/********************************************************************//** +/** Tries to open a single-table tablespace and optionally checks the space id is right in it. If does not succeed, prints an error message to the .err log. This function is used to open a tablespace when we start up mysqld, and also in IMPORT TABLESPACE. -NOTE that we assume this operation is used either at the database startup -or under the protection of dict_sys.latch, so that two users cannot -race here. This operation does not leave the file associated with the -tablespace open, but closes it after we have looked at the space id in it. -If the validate boolean is set, we read the first page of the file and -check that the space id in the file is what we expect. We assume that -this function runs much faster if no check is made, since accessing the -file inode probably is much faster (the OS caches them) than accessing -the first page of the file. This boolean may be initially false, but if -a remote tablespace is found it will be changed to true. +NOTE that we assume this operation is used either at the database +startup or under the protection of MDL, to prevent concurrent access +to the same tablespace. -@param[in] validate 0=maybe missing, 1=do not validate, 2=validate -@param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_TEMPORARY -@param[in] id tablespace ID -@param[in] flags expected FSP_SPACE_FLAGS -@param[in] name table name -If file-per-table, it is the table name in the databasename/tablename format -@param[in] path_in expected filepath, usually read from dictionary -@param[out] err DB_SUCCESS or error code +@param id tablespace identifier +@param flags expected FSP_SPACE_FLAGS +@param validate how to validate files +@param name the table name in databasename/tablename format +@param path_in expected filepath, usually read from dictionary +@param err DB_SUCCESS or error code @return tablespace -@retval NULL if the tablespace could not be opened */ -fil_space_t* -fil_ibd_open( - unsigned validate, - fil_type_t purpose, - uint32_t id, - uint32_t flags, - fil_space_t::name_type name, - const char* path_in, - dberr_t* err = NULL) - MY_ATTRIBUTE((warn_unused_result)); +@retval nullptr if the tablespace could not be opened */ +fil_space_t *fil_ibd_open(uint32_t id, uint32_t flags, + fil_space_t::validate validate, + fil_space_t::name_type name, + const char *path_in, dberr_t *err= nullptr) noexcept; enum fil_load_status { /** The tablespace file(s) were found and valid. */ diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 1d2b409be01..810bfe6966b 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -201,9 +201,9 @@ struct fts_trx_t { /** Information required for transaction savepoint handling. */ struct fts_savepoint_t { - char* name; /*!< First entry is always NULL, the - default instance. Otherwise the name - of the savepoint */ + const void* name; /*!< First entry is always NULL, the + default instance. Otherwise the + savepoint */ ib_rbt_t* tables; /*!< Modified FTS tables */ }; @@ -666,7 +666,7 @@ void fts_savepoint_take( /*===============*/ fts_trx_t* fts_trx, /*!< in: fts transaction */ - const char* name); /*!< in: savepoint name */ + const void* name); /*!< in: savepoint */ /**********************************************************************//** Refresh last statement savepoint. */ @@ -681,7 +681,7 @@ void fts_savepoint_release( /*==================*/ trx_t* trx, /*!< in: transaction */ - const char* name); /*!< in: savepoint name */ + const void* name); /*!< in: savepoint */ /** Clear cache. @param[in,out] cache fts cache */ @@ -702,7 +702,7 @@ void fts_savepoint_rollback( /*===================*/ trx_t* trx, /*!< in: transaction */ - const char* name); /*!< in: savepoint name */ + const void* name); /*!< in: savepoint */ /*********************************************************************//** Rollback to and including savepoint indentified by name. */ diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 9d8705d8760..6840b27f5d7 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -60,7 +60,7 @@ wait and check if an already running write is covering the request. @param durable whether the write needs to be durable @param callback log write completion callback */ void log_write_up_to(lsn_t lsn, bool durable, - const completion_callback *callback= nullptr); + const completion_callback *callback= nullptr) noexcept; /** Write to the log file up to the last log entry. @param durable whether to wait for a durable write to complete */ @@ -249,6 +249,8 @@ public: /** latest completed checkpoint (protected by latch.wr_lock()) */ Atomic_relaxed last_checkpoint_lsn; + /** The log writer (protected by latch.wr_lock()) */ + lsn_t (*writer)() noexcept; /** next checkpoint LSN (protected by latch.wr_lock()) */ lsn_t next_checkpoint_lsn; @@ -270,7 +272,8 @@ private: @return the value of buf_free */ size_t lock_lsn() noexcept; - /** log sequence number when log resizing was initiated, or 0 */ + /** log sequence number when log resizing was initiated; + 0 if the log is not being resized, 1 if resize_start() is in progress */ std::atomic resize_lsn; /** the log sequence number at the start of the log file */ lsn_t first_lsn; @@ -360,7 +363,8 @@ public: inline lsn_t get_write_target() const; /** @return LSN at which log resizing was started and is still in progress - @retval 0 if no log resizing is in progress */ + @retval 0 if no log resizing is in progress + @retval 1 if resize_start() is in progress */ lsn_t resize_in_progress() const noexcept { return resize_lsn.load(std::memory_order_relaxed); } @@ -389,7 +393,6 @@ private: /** Write resize_buf to resize_log. @param b resize_buf or resize_flush_buf @param length the used length of b */ - ATTRIBUTE_COLD ATTRIBUTE_NOINLINE void resize_write_buf(const byte *b, size_t length) noexcept; public: @@ -493,6 +496,9 @@ public: #endif private: + /** Update writer and mtr_t::finisher */ + void writer_update() noexcept; + /** Wait in append_prepare() for buffer to become available @tparam spin whether to use the spin-only lock_lsn() @param b the value of buf_free @@ -555,10 +561,20 @@ public: @param end_lsn start LSN of the FILE_CHECKPOINT mini-transaction */ inline void write_checkpoint(lsn_t end_lsn) noexcept; - /** Write buf to ib_logfile0. - @tparam release_latch whether to invoke latch.wr_unlock() + /** Variations of write_buf() */ + enum resizing_and_latch { + /** skip latch.wr_unlock(); log resizing may or may not be in progress */ + RETAIN_LATCH, + /** invoke latch.wr_unlock(); !(resize_in_progress() > 1) */ + NOT_RESIZING, + /** invoke latch.wr_unlock(); resize_in_progress() > 1 */ + RESIZING + }; + + /** Write buf to ib_logfile0 and possibly ib_logfile101. + @tparam resizing whether to release latch and whether resize_in_progress()>1 @return the current log sequence number */ - template inline lsn_t write_buf() noexcept; + template inline lsn_t write_buf() noexcept; /** Create the log. */ void create(lsn_t lsn) noexcept; diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 6f6c9f07d37..6121951ad90 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -118,6 +118,16 @@ struct recv_dblwr_t const fil_space_t *space= nullptr, byte *tmp_buf= nullptr) const noexcept; + /** Find the doublewrite copy of an encrypted page with the + smallest FIL_PAGE_LSN that is large enough for recovery. + @param space tablespace object + @param page_no page number to find + @param buf buffer for unencrypted page + @return buf + @retval nullptr if the page was not found in doublewrite buffer */ + byte *find_encrypted_page(const fil_node_t &space, uint32_t page_no, + byte *buf) noexcept; + /** Restore the first page of the given tablespace from doublewrite buffer. 1) Find the page which has page_no as 0 @@ -216,8 +226,10 @@ public: /** @return maximum guaranteed size of a mini-transaction on recovery */ static constexpr size_t MTR_SIZE_MAX{1U << 20}; - /** whether we are applying redo log records during crash recovery */ - bool recovery_on; + /** whether we are applying redo log records during crash recovery. + This can be cleared when holding mutex, or when pages.empty() and + we are holding exclusive log_sys.latch. */ + Atomic_relaxed recovery_on= false; /** whether recv_recover_page(), invoked from buf_page_t::read_complete(), should apply log records*/ bool apply_log_recs; diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 77e21c27e2a..b2c324f47e4 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -1064,11 +1064,6 @@ os_file_get_status( bool check_rw_perm, bool read_only); -/** Set the file create umask -@param[in] umask The umask to use for file creation. */ -void -os_file_set_umask(ulint umask); - #ifdef _WIN32 /** diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 878d9c9f1a2..8cbeed7d297 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -172,7 +172,7 @@ row_mysql_handle_errors( during the function entry */ trx_t* trx, /*!< in: transaction */ que_thr_t* thr, /*!< in: query thread, or NULL */ - trx_savept_t* savept) /*!< in: savepoint, or NULL */ + const undo_no_t*savept) /*!< in: pointer to savepoint, or nullptr */ MY_ATTRIBUTE((nonnull(1,2))); /********************************************************************//** Create a prebuilt struct for a MySQL table handle. diff --git a/storage/innobase/include/trx0roll.h b/storage/innobase/include/trx0roll.h index 9ef9ebe93b2..dd21597b270 100644 --- a/storage/innobase/include/trx0roll.h +++ b/storage/innobase/include/trx0roll.h @@ -74,62 +74,6 @@ trx_rollback_for_mysql( /*===================*/ trx_t* trx) /*!< in/out: transaction */ MY_ATTRIBUTE((nonnull)); -/*******************************************************************//** -Rollback the latest SQL statement for MySQL. -@return error code or DB_SUCCESS */ -dberr_t -trx_rollback_last_sql_stat_for_mysql( -/*=================================*/ - trx_t* trx) /*!< in/out: transaction */ - MY_ATTRIBUTE((nonnull)); -/*******************************************************************//** -Rolls back a transaction back to a named savepoint. Modifications after the -savepoint are undone but InnoDB does NOT release the corresponding locks -which are stored in memory. If a lock is 'implicit', that is, a new inserted -row holds a lock where the lock information is carried by the trx id stored in -the row, these locks are naturally released in the rollback. Savepoints which -were set after this savepoint are deleted. -@return if no savepoint of the name found then DB_NO_SAVEPOINT, -otherwise DB_SUCCESS */ -dberr_t -trx_rollback_to_savepoint_for_mysql( -/*================================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name, /*!< in: savepoint name */ - int64_t* mysql_binlog_cache_pos) /*!< out: the MySQL binlog cache - position corresponding to this - savepoint; MySQL needs this - information to remove the - binlog entries of the queries - executed after the savepoint */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); -/*******************************************************************//** -Creates a named savepoint. If the transaction is not yet started, starts it. -If there is already a savepoint of the same name, this call erases that old -savepoint and replaces it with a new. Savepoints are deleted in a transaction -commit or rollback. -@return always DB_SUCCESS */ -dberr_t -trx_savepoint_for_mysql( -/*====================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name, /*!< in: savepoint name */ - int64_t binlog_cache_pos) /*!< in: MySQL binlog cache - position corresponding to this - connection at the time of the - savepoint */ - MY_ATTRIBUTE((nonnull)); -/*******************************************************************//** -Releases a named savepoint. Savepoints which -were set after this savepoint are deleted. -@return if no savepoint of the name found then DB_NO_SAVEPOINT, -otherwise DB_SUCCESS */ -dberr_t -trx_release_savepoint_for_mysql( -/*============================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name) /*!< in: savepoint name */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Rollback node states */ enum roll_node_state { @@ -144,25 +88,9 @@ enum roll_node_state { struct roll_node_t{ que_common_t common; /*!< node type: QUE_NODE_ROLLBACK */ enum roll_node_state state; /*!< node execution state */ - const trx_savept_t* savept; /*!< savepoint to which to - roll back, in the case of a - partial rollback */ + undo_no_t savept; /*!< savepoint to which to + roll back; 0=entire transaction */ que_thr_t* undo_thr;/*!< undo query graph */ }; -/** A savepoint set with SQL's "SAVEPOINT savepoint_id" command */ -struct trx_named_savept_t{ - char* name; /*!< savepoint name */ - trx_savept_t savept; /*!< the undo number corresponding to - the savepoint */ - int64_t mysql_binlog_cache_pos; - /*!< the MySQL binlog cache position - corresponding to this savepoint, not - defined if the MySQL binlogging is not - enabled */ - UT_LIST_NODE_T(trx_named_savept_t) - trx_savepoints; /*!< the list of savepoints of a - transaction */ -}; - #endif diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index 79d9d155fd0..7c2d471307c 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -495,19 +495,7 @@ class rw_trx_hash_t #ifdef UNIV_DEBUG - static void validate_element(trx_t *trx) - { - ut_ad(!trx->read_only || !trx->rsegs.m_redo.rseg); - ut_ad(!trx->is_autocommit_non_locking()); - /* trx->state can be anything except TRX_STATE_NOT_STARTED */ - ut_d(bool acquire_trx_mutex = !trx->mutex_is_owner()); - ut_d(if (acquire_trx_mutex) trx->mutex_lock()); - ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE) || - trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY) || - trx_state_eq(trx, TRX_STATE_PREPARED_RECOVERED) || - trx_state_eq(trx, TRX_STATE_PREPARED)); - ut_d(if (acquire_trx_mutex) trx->mutex_unlock()); - } + static void validate_element(trx_t *trx); struct debug_iterator_arg @@ -984,18 +972,23 @@ public: Our IA-32 target is not "i386" but at least "i686", that is, at least Pentium MMX, which has a 64-bit data bus and 64-bit XMM registers. */ + bool hot= false; trx->mutex_lock(); trx_id_t &max_inactive_id= trx->max_inactive_id; - const bool hot{max_inactive_id < id && find_same_or_older(trx, id)}; + if (max_inactive_id >= id); + else if (!find_same_or_older_low(trx, id)) + max_inactive_id= id; + else + hot= true; #else Atomic_relaxed &max_inactive_id= trx->max_inactive_id_atomic; if (max_inactive_id >= id) return false; trx->mutex_lock(); - const bool hot{find_same_or_older(trx, id)}; -#endif - if (hot) + const bool hot{find_same_or_older_low(trx, id)}; + if (!hot) max_inactive_id= id; +#endif trx->mutex_unlock(); return hot; } diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 508e7858362..c89509d7f92 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -150,19 +150,15 @@ void trx_start_for_ddl_low(trx_t *trx); ut_ad((t)->start_file == 0); \ (t)->start_line = __LINE__; \ (t)->start_file = __FILE__; \ + t->state= TRX_STATE_NOT_STARTED; \ trx_start_for_ddl_low(t); \ } while (0) #else # define trx_start_for_ddl(t) trx_start_for_ddl_low(t) #endif /* UNIV_DEBUG */ -/**********************************************************************//** -Does the transaction commit for MySQL. -@return DB_SUCCESS or error number */ -dberr_t -trx_commit_for_mysql( -/*=================*/ - trx_t* trx); /*!< in/out: transaction */ +/** Commit a transaction */ +void trx_commit_for_mysql(trx_t *trx) noexcept; /** XA PREPARE a transaction. @param[in,out] trx transaction to prepare */ void trx_prepare_for_mysql(trx_t* trx); @@ -185,12 +181,6 @@ trx_t* trx_get_trx_by_xid(const XID* xid); /** Durably write log until trx->commit_lsn (if trx_t::commit_in_memory() was invoked with flush_log_later=true). */ void trx_commit_complete_for_mysql(trx_t *trx); -/**********************************************************************//** -Marks the latest SQL statement ended. */ -void -trx_mark_sql_stat_end( -/*==================*/ - trx_t* trx); /*!< in: trx handle */ /****************************************************************//** Prepares a transaction for commit/rollback. */ void @@ -709,6 +699,7 @@ public: Possible states: TRX_STATE_NOT_STARTED + TRX_STATE_ABORTED TRX_STATE_ACTIVE TRX_STATE_PREPARED TRX_STATE_PREPARED_RECOVERED (special case of TRX_STATE_PREPARED) @@ -718,6 +709,8 @@ public: Regular transactions: * NOT_STARTED -> ACTIVE -> COMMITTED -> NOT_STARTED + * NOT_STARTED -> ABORTED (when thd_mark_transaction_to_rollback() is called) + * ABORTED -> NOT_STARTED (acknowledging the rollback of a transaction) Auto-commit non-locking read-only: * NOT_STARTED -> ACTIVE -> NOT_STARTED @@ -754,16 +747,18 @@ public: do we remove it from the read-only list and put it on the read-write list. During this switch we assign it a rollback segment. - When a transaction is NOT_STARTED, it can be in trx_list. It cannot be - in rw_trx_hash. + When a transaction is NOT_STARTED or ABORTED, it can be in trx_list. + It cannot be in rw_trx_hash. - ACTIVE->PREPARED->COMMITTED is only possible when trx is in rw_trx_hash. - The transition ACTIVE->PREPARED is protected by trx->mutex. + ACTIVE->PREPARED->COMMITTED and ACTIVE->COMMITTED is only possible when + trx is in rw_trx_hash. These transitions are protected by trx_t::mutex. - ACTIVE->COMMITTED is possible when the transaction is in - rw_trx_hash. + COMMITTED->NOT_STARTED is possible when trx_t::mutex is being held. + The transaction would already have been removed from rw_trx_hash by + trx_sys_t::deregister_rw() on the transition to COMMITTED. - Transitions to COMMITTED are protected by trx_t::mutex. */ + Transitions between NOT_STARTED and ABORTED can be performed at any time by + the thread that is associated with the transaction. */ Atomic_relaxed state; /** The locks of the transaction. Protected by lock_sys.latch @@ -779,6 +774,14 @@ public: bool is_wsrep() const { return false; } #endif /* WITH_WSREP */ + /** @return whether the transaction has been started */ + bool is_started() const noexcept + { + static_assert(TRX_STATE_NOT_STARTED == 0, ""); + static_assert(TRX_STATE_ABORTED == 1, ""); + return state > TRX_STATE_ABORTED; + } + /** Consistent read view of the transaction */ ReadView read_view; @@ -886,10 +889,6 @@ public: it is a stored procedure with a COMMIT WORK statement, for instance */ /*------------------------------*/ - UT_LIST_BASE_NODE_T(trx_named_savept_t) - trx_savepoints; /*!< savepoints set with SAVEPOINT ..., - oldest first */ - /*------------------------------*/ undo_no_t undo_no; /*!< next undo log record number to assign; since the undo log is private for a transaction, this @@ -897,7 +896,7 @@ public: with no gaps; thus it represents the number of modified/inserted rows in a transaction */ - trx_savept_t last_sql_stat_start; + undo_no_t last_stmt_start; /*!< undo_no when the last sql statement was started: in case of an error, trx is rolled back down to this number */ @@ -996,16 +995,17 @@ public: void evict_table(table_id_t table_id, bool reset_only= false); /** Initiate rollback. - @param savept savepoint to which to roll back + @param savept pointer to savepoint; nullptr=entire transaction @return error code or DB_SUCCESS */ - dberr_t rollback(trx_savept_t *savept= nullptr); + dberr_t rollback(const undo_no_t *savept= nullptr) noexcept; /** Roll back an active transaction. - @param savept savepoint to which to roll back */ - inline void rollback_low(trx_savept_t *savept= nullptr); + @param savept pointer to savepoint; nullptr=entire transaction + @return error code or DB_SUCCESS */ + dberr_t rollback_low(const undo_no_t *savept= nullptr) noexcept; /** Finish rollback. @return whether the rollback was completed normally @retval false if the rollback was aborted by shutdown */ - inline bool rollback_finish(); + bool rollback_finish() noexcept; private: /** Apply any changes to tables for which online DDL is in progress. */ ATTRIBUTE_COLD void apply_log(); @@ -1015,9 +1015,10 @@ private: @param mtr mini-transaction (if there are any persistent modifications) */ inline void commit_in_memory(const mtr_t *mtr); /** Write log for committing the transaction. */ - void commit_persist(); - /** Clean up the transaction after commit_in_memory() */ - void commit_cleanup(); + void commit_persist() noexcept; + /** Clean up the transaction after commit_in_memory() + @return false (always) */ + bool commit_cleanup() noexcept; /** Commit the transaction in a mini-transaction. @param mtr mini-transaction (if there are any persistent modifications) */ void commit_low(mtr_t *mtr= nullptr); @@ -1032,7 +1033,7 @@ private: inline void write_serialisation_history(mtr_t *mtr); public: /** Commit the transaction. */ - void commit(); + void commit() noexcept; /** Try to drop a persistent table. @param table persistent table @@ -1052,16 +1053,6 @@ public: void commit(std::vector &deleted); - /** Discard all savepoints */ - void savepoints_discard() - { savepoints_discard(UT_LIST_GET_FIRST(trx_savepoints)); } - - - /** Discard all savepoints starting from a particular savepoint. - @param savept first savepoint to discard */ - void savepoints_discard(trx_named_savept_t *savept); - - bool is_referenced() const { return (skip_lock_inheritance_and_n_ref & ~(1U << 31)) > 0; @@ -1202,15 +1193,6 @@ private: trx_rseg_t *assign_temp_rseg(); }; -/** -Check if transaction is started. -@param[in] trx Transaction whose state we need to check -@reutrn true if transaction is in state started */ -inline bool trx_is_started(const trx_t* trx) -{ - return trx->state != TRX_STATE_NOT_STARTED; -} - /* Transaction isolation levels (trx->isolation_level) */ #define TRX_ISO_READ_UNCOMMITTED 0 /* dirty read: non-locking SELECTs are performed so that diff --git a/storage/innobase/include/trx0trx.inl b/storage/innobase/include/trx0trx.inl index b063c920e2f..317f1f5cd0d 100644 --- a/storage/innobase/include/trx0trx.inl +++ b/storage/innobase/include/trx0trx.inl @@ -67,6 +67,8 @@ trx_state_eq( && thd_get_error_number(trx->mysql_thd))); return(true); + case TRX_STATE_ABORTED: + break; } ut_error; #endif /* UNIV_DEBUG */ diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h index bfa2adc0115..ecb8ecc023b 100644 --- a/storage/innobase/include/trx0types.h +++ b/storage/innobase/include/trx0types.h @@ -52,6 +52,8 @@ constexpr uint innodb_purge_batch_size_MAX= 5000; /** Transaction states (trx_t::state) */ enum trx_state_t { TRX_STATE_NOT_STARTED, + /** The transaction was aborted (rolled back) due to an error */ + TRX_STATE_ABORTED, TRX_STATE_ACTIVE, /** XA PREPARE has been executed; only XA COMMIT or XA ROLLBACK @@ -59,6 +61,7 @@ enum trx_state_t { TRX_STATE_PREPARED, /** XA PREPARE transaction that was returned to ha_recover() */ TRX_STATE_PREPARED_RECOVERED, + /** The transaction has been committed (or completely rolled back) */ TRX_STATE_COMMITTED_IN_MEMORY }; @@ -76,8 +79,6 @@ struct trx_undo_t; struct roll_node_t; /** Commit command node in a query graph */ struct commit_node_t; -/** SAVEPOINT command node in a query graph */ -struct trx_named_savept_t; /* @} */ /** Row identifier (DB_ROW_ID, DATA_ROW_ID) */ @@ -89,11 +90,6 @@ typedef ib_id_t roll_ptr_t; /** Undo number */ typedef ib_id_t undo_no_t; -/** Transaction savepoint */ -struct trx_savept_t{ - undo_no_t least_undo_no; /*!< least undo number to undo */ -}; - /** File objects */ /* @{ */ /** Undo segment header */ diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 5c11a83f886..1f5e9941fbb 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -6692,23 +6692,19 @@ lock_unlock_table_autoinc( /*======================*/ trx_t* trx) /*!< in/out: transaction */ { - lock_sys.assert_unlocked(); - ut_ad(!trx->mutex_is_owner()); - ut_ad(!trx->lock.wait_lock); + /* This function is invoked for a running transaction by the thread + that is serving the transaction. Therefore it is not necessary to + hold trx->mutex here. */ - /* This can be invoked on NOT_STARTED, ACTIVE, PREPARED, - but not COMMITTED transactions. */ + lock_sys.assert_unlocked(); + ut_ad(!trx->mutex_is_owner()); + ut_ad(!trx->lock.wait_lock); + ut_d(trx_state_t trx_state{trx->state}); + ut_ad(trx_state == TRX_STATE_ACTIVE || trx_state == TRX_STATE_PREPARED || + trx_state == TRX_STATE_NOT_STARTED); - ut_ad(trx_state_eq(trx, TRX_STATE_NOT_STARTED) - || !trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY)); - - /* This function is invoked for a running transaction by the - thread that is serving the transaction. Therefore it is not - necessary to hold trx->mutex here. */ - - if (lock_trx_holds_autoinc_locks(trx)) { - lock_release_autoinc_locks(trx); - } + if (lock_trx_holds_autoinc_locks(trx)) + lock_release_autoinc_locks(trx); } /** Handle a pending lock wait (DB_LOCK_WAIT) in a semi-consistent read diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index ee16c55a716..5b0761e8dbe 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -100,6 +100,7 @@ void log_t::create() ut_ad(!checkpoint_buf); ut_ad(!buf); ut_ad(!flush_buf); + ut_ad(!writer); max_buf_free= 1; latch.SRW_LOCK_INIT(log_latch_key); @@ -254,6 +255,10 @@ static void *log_mmap(os_file_t file, if (!read_only) # ifdef HAVE_PMEM prot= PROT_READ | PROT_WRITE; + +# ifdef __linux__ /* On Linux, we pretend that /dev/shm is PMEM */ +remap: +# endif # else return MAP_FAILED; # endif @@ -269,8 +274,9 @@ static void *log_mmap(os_file_t file, # ifdef HAVE_PMEM # ifdef __linux__ /* On Linux, we pretend that /dev/shm is PMEM */ - if (srv_operation < SRV_OPERATION_BACKUP) + if (flags != MAP_SHARED && srv_operation < SRV_OPERATION_BACKUP) { + flags= MAP_SHARED; struct stat st; if (!fstat(file, &st)) { @@ -282,6 +288,7 @@ static void *log_mmap(os_file_t file, is_pmem= st.st_dev == st_dev; if (!is_pmem) return ptr; /* MAP_FAILED */ + goto remap; } } } @@ -323,6 +330,7 @@ bool log_t::attach(log_file_t file, os_offset_t size) ut_ad(!buf); ut_ad(!flush_buf); + ut_ad(!writer); #ifdef HAVE_INNODB_MMAP if (size) { @@ -345,7 +353,7 @@ bool log_t::attach(log_file_t file, os_offset_t size) # endif buf= static_cast(ptr); max_buf_free= 1; - mtr_t::finisher_update(); + writer_update(); # ifdef HAVE_PMEM if (is_pmem) return true; @@ -388,7 +396,7 @@ bool log_t::attach(log_file_t file, os_offset_t size) TRASH_ALLOC(buf, buf_size); TRASH_ALLOC(flush_buf, buf_size); max_buf_free= buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; - mtr_t::finisher_update(); + writer_update(); memset_aligned<512>(checkpoint_buf, 0, write_size); #ifdef HAVE_INNODB_MMAP @@ -501,6 +509,8 @@ void log_t::close_file() checkpoint_buf= nullptr; } + writer= nullptr; + #ifdef HAVE_INNODB_MMAP if (really_close) #endif @@ -689,6 +699,8 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept (lsn_t{write_size - 1} + start_lsn - first_lsn)); else if (!is_opened()) resize_log.close(); + + writer_update(); } resize_lsn.store(start_lsn, std::memory_order_relaxed); status= success ? RESIZE_STARTED : RESIZE_FAILED; @@ -739,6 +751,7 @@ void log_t::resize_abort() noexcept resize_lsn.store(0, std::memory_order_relaxed); } + writer_update(); log_resize_release(); } @@ -942,7 +955,6 @@ void log_t::persist(lsn_t lsn, bool holding_latch) noexcept } #endif -ATTRIBUTE_COLD ATTRIBUTE_NOINLINE void log_t::resize_write_buf(const byte *b, size_t length) noexcept { const size_t block_size_1= write_size - 1; @@ -977,20 +989,24 @@ void log_t::resize_write_buf(const byte *b, size_t length) noexcept b, offset, length) == DB_SUCCESS); } -/** Write buf to ib_logfile0. -@tparam release_latch whether to invoke latch.wr_unlock() +/** Write buf to ib_logfile0 and possibly ib_logfile101. +@tparam resizing whether to release latch and whether resize_in_progress()>1 @return the current log sequence number */ -template inline lsn_t log_t::write_buf() noexcept +template +inline __attribute__((always_inline)) +lsn_t log_t::write_buf() noexcept { ut_ad(latch_have_wr()); ut_ad(!is_mmap()); ut_ad(!srv_read_only_mode); + ut_ad(resizing == RETAIN_LATCH || + (resizing == RESIZING) == (resize_in_progress() > 1)); const lsn_t lsn{get_lsn(std::memory_order_relaxed)}; if (write_lsn >= lsn) { - if (release_latch) + if (resizing != RETAIN_LATCH) latch.wr_unlock(); ut_ad(write_lsn == lsn); } @@ -1008,7 +1024,16 @@ template inline lsn_t log_t::write_buf() noexcept ut_ad(write_size_1 >= 511); const byte *const write_buf{buf}; - const byte *const re_write_buf{resize_buf}; + byte *const re_write_buf{resizing == NOT_RESIZING ? nullptr : resize_buf}; + ut_ad(resizing == RETAIN_LATCH || + (resizing == NOT_RESIZING) == !re_write_buf); + ut_ad(!re_write_buf == !resize_flush_buf); + if (resizing == RESIZING) +#ifdef _MSC_VER + __assume(re_write_buf != nullptr); +#else + if (!re_write_buf) __builtin_unreachable(); +#endif offset&= ~lsn_t{write_size_1}; if (length <= write_size_1) @@ -1020,13 +1045,14 @@ template inline lsn_t log_t::write_buf() noexcept buf + length, flush_buf); ... /* TODO: Update the LSN and adjust other code. */ #else -# ifdef HAVE_valgrind MEM_MAKE_DEFINED(buf + length, (write_size_1 + 1) - length); - if (UNIV_LIKELY_NULL(re_write_buf)) - MEM_MAKE_DEFINED(re_write_buf + length, (write_size_1 + 1) - length); -# endif - buf[length]= 0; /* allow recovery to catch EOF faster */ + buf[length]= 0; /* ensure that recovery catches EOF */ #endif + if (UNIV_LIKELY_NULL(re_write_buf)) + { + MEM_MAKE_DEFINED(re_write_buf + length, (write_size_1 + 1) - length); + re_write_buf[length]= 0; + } length= write_size_1 + 1; } else @@ -1041,27 +1067,28 @@ template inline lsn_t log_t::write_buf() noexcept (We want to avoid memset() while holding exclusive log_sys.latch) This block will be overwritten later, once records beyond the current LSN are generated. */ -#ifdef HAVE_valgrind - MEM_MAKE_DEFINED(buf + length, (write_size_1 + 1) - new_buf_free); - if (UNIV_LIKELY_NULL(re_write_buf)) - MEM_MAKE_DEFINED(re_write_buf + length, (write_size_1 + 1) - - new_buf_free); -#endif + MEM_MAKE_DEFINED(buf + length, (write_size_1 + 1) - new_buf_free); buf[length]= 0; /* allow recovery to catch EOF faster */ length&= ~write_size_1; memcpy_aligned<16>(flush_buf, buf + length, (new_buf_free + 15) & ~15); if (UNIV_LIKELY_NULL(re_write_buf)) + { + MEM_MAKE_DEFINED(re_write_buf + length, (write_size_1 + 1) - + new_buf_free); memcpy_aligned<16>(resize_flush_buf, re_write_buf + length, (new_buf_free + 15) & ~15); + re_write_buf[length + new_buf_free]= 0; + } length+= write_size_1 + 1; } std::swap(buf, flush_buf); - std::swap(resize_buf, resize_flush_buf); + if (UNIV_LIKELY_NULL(re_write_buf)) + std::swap(resize_buf, resize_flush_buf); } write_to_log++; - if (release_latch) + if (resizing != RETAIN_LATCH) latch.wr_unlock(); DBUG_PRINT("ib_log", ("write " LSN_PF " to " LSN_PF " at " LSN_PF, @@ -1121,7 +1148,7 @@ wait and check if an already running write is covering the request. @param durable whether the write needs to be durable @param callback log write completion callback */ void log_write_up_to(lsn_t lsn, bool durable, - const completion_callback *callback) + const completion_callback *callback) noexcept { ut_ad(!srv_read_only_mode || log_sys.buf_free_ok()); ut_ad(lsn != LSN_MAX); @@ -1159,7 +1186,7 @@ repeat: { ut_ad(!recv_no_log_write || srv_operation != SRV_OPERATION_NORMAL); log_sys.latch.wr_lock(SRW_LOCK_CALL); - pending_write_lsn= write_lock.release(log_sys.write_buf()); + pending_write_lsn= write_lock.release(log_sys.writer()); } if (durable) @@ -1176,6 +1203,23 @@ repeat: } } +static lsn_t log_writer() noexcept +{ + return log_sys.write_buf(); +} + +ATTRIBUTE_COLD static lsn_t log_writer_resizing() noexcept +{ + return log_sys.write_buf(); +} + +void log_t::writer_update() noexcept +{ + ut_ad(latch_have_wr()); + writer= resize_in_progress() ? log_writer_resizing : log_writer; + mtr_t::finisher_update(); +} + /** Write to the log file up to the last log entry. @param durable whether to wait for a durable write to complete */ void log_buffer_flush_to_disk(bool durable) @@ -1243,7 +1287,7 @@ ATTRIBUTE_COLD void log_write_and_flush() else #endif { - const lsn_t lsn{log_sys.write_buf()}; + const lsn_t lsn{log_sys.write_buf()}; write_lock.release(lsn); log_flush(lsn); } diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index b6ea209b203..e748eb35e9c 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -798,8 +798,8 @@ processed: if (crypt_data && !fil_crypt_check(crypt_data, name.c_str())) return nullptr; mysql_mutex_lock(&fil_system.mutex); - fil_space_t *space= fil_space_t::create(it->first, flags, - FIL_TYPE_TABLESPACE, crypt_data); + fil_space_t *space= fil_space_t::create(it->first, flags, false, + crypt_data); ut_ad(space); const char *filename= name.c_str(); if (srv_operation == SRV_OPERATION_RESTORE) @@ -905,8 +905,8 @@ deferred_spaces; @param[in] new_name new file name (NULL if not rename) @param[in] new_len length of new_name, in bytes (0 if NULL) */ void (*log_file_op)(uint32_t space_id, int type, - const byte* name, ulint len, - const byte* new_name, ulint new_len); + const byte* name, size_t len, + const byte* new_name, size_t new_len); void (*undo_space_trunc)(uint32_t space_id); @@ -3955,7 +3955,12 @@ void recv_sys_t::apply(bool last_batch) } } - if (!last_batch) + if (last_batch) + { + mlog_init.clear(); + dblwr.pages.clear(); + } + else log_sys.latch.wr_unlock(); mysql_mutex_unlock(&mutex); @@ -4286,7 +4291,7 @@ next: recv_spaces_t::iterator i = recv_spaces.find(space); ut_ad(i != recv_spaces.end()); - if (deferred_spaces.find(static_cast(space))) { + if (deferred_spaces.find(space)) { /* Skip redo logs belonging to incomplete tablespaces */ goto next; @@ -4322,7 +4327,7 @@ func_exit: continue; } - if (deferred_spaces.find(static_cast(rs.first))) { + if (deferred_spaces.find(rs.first)) { continue; } @@ -4493,6 +4498,7 @@ dberr_t recv_recovery_read_checkpoint() ut_ad(srv_operation <= SRV_OPERATION_EXPORT_RESTORED || srv_operation == SRV_OPERATION_RESTORE || srv_operation == SRV_OPERATION_RESTORE_EXPORT); + ut_ad(!recv_sys.recovery_on); ut_d(mysql_mutex_lock(&buf_pool.mutex)); ut_ad(UT_LIST_GET_LEN(buf_pool.LRU) == 0); ut_ad(UT_LIST_GET_LEN(buf_pool.unzip_LRU) == 0); @@ -4817,6 +4823,48 @@ bool recv_dblwr_t::validate_page(const page_id_t page_id, lsn_t max_lsn, goto check_if_corrupted; } +byte *recv_dblwr_t::find_encrypted_page(const fil_node_t &node, + uint32_t page_no, + byte *buf) noexcept +{ + ut_ad(node.space->crypt_data); + ut_ad(node.space->full_crc32()); + mysql_mutex_lock(&recv_sys.mutex); + byte *result_page= nullptr; + for (list::iterator page_it= pages.begin(); page_it != pages.end(); + page_it++) + { + if (page_get_page_no(*page_it) != page_no || + buf_page_is_corrupted(true, *page_it, node.space->flags)) + continue; + memcpy(buf, *page_it, node.space->physical_size()); + buf_tmp_buffer_t *slot= buf_pool.io_buf_reserve(false); + ut_a(slot); + slot->allocate(); + bool invalidate= + !fil_space_decrypt(node.space, slot->crypt_buf, buf) || + (node.space->is_compressed() && + !fil_page_decompress(slot->crypt_buf, buf, node.space->flags)); + slot->release(); + + if (invalidate || + mach_read_from_4(buf + FIL_PAGE_SPACE_ID) != node.space->id) + continue; + + result_page= *page_it; + pages.erase(page_it); + break; + } + mysql_mutex_unlock(&recv_sys.mutex); + if (result_page) + sql_print_information("InnoDB: Recovered page [page id: space=" + UINT32PF ", page number=" UINT32PF "] " + "to '%s' from the doublewrite buffer.", + node.space->id, page_no, + node.name); + return result_page; +} + const byte *recv_dblwr_t::find_page(const page_id_t page_id, lsn_t max_lsn, const fil_space_t *space, byte *tmp_buf) const noexcept diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 04aafa0e580..c48e0288a7d 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -836,8 +836,7 @@ fil_space_t *mtr_t::x_lock_space(uint32_t space_id) } else { space = fil_space_get(space_id); ut_ad(m_log_mode != MTR_LOG_NO_REDO - || space->purpose == FIL_TYPE_TEMPORARY - || space->purpose == FIL_TYPE_IMPORT); + || space->is_temporary() || space->is_being_imported()); } ut_ad(space); @@ -850,9 +849,6 @@ fil_space_t *mtr_t::x_lock_space(uint32_t space_id) @param space tablespace */ void mtr_t::x_lock_space(fil_space_t *space) { - ut_ad(space->purpose == FIL_TYPE_TEMPORARY || - space->purpose == FIL_TYPE_IMPORT || - space->purpose == FIL_TYPE_TABLESPACE); if (!memo_contains(*space)) { memo_push(space, MTR_MEMO_SPACE_X_LOCK); diff --git a/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff b/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff index 00cda7c4435..5f183c9216e 100644 --- a/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff +++ b/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/autoinc_secondary.result 2012-07-12 04:34:18.153885986 +0400 -+++ suite/storage_engine/autoinc_secondary.reject 2012-07-15 17:47:03.937703666 +0400 +--- suite/storage_engine/autoinc_secondary.result ++++ suite/storage_engine/autoinc_secondary.reject @@ -13,18 +13,15 @@ 5 a DROP TABLE t1; diff --git a/storage/innobase/mysql-test/storage_engine/cache_index.rdiff b/storage/innobase/mysql-test/storage_engine/cache_index.rdiff index e04df87aa34..7be04d3ec28 100644 --- a/storage/innobase/mysql-test/storage_engine/cache_index.rdiff +++ b/storage/innobase/mysql-test/storage_engine/cache_index.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/cache_index.result 2012-07-15 00:22:19.822493731 +0400 -+++ suite/storage_engine/cache_index.reject 2012-07-15 17:47:18.321522834 +0400 +--- suite/storage_engine/cache_index.result ++++ suite/storage_engine/cache_index.reject @@ -12,31 +12,31 @@ SET GLOBAL .key_buffer_size=128*1024; CACHE INDEX t1 INDEX (a), t2 IN ; diff --git a/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff b/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff index 71c782848a6..31a480f0585 100644 --- a/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff +++ b/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/checksum_table_live.result 2012-07-12 21:05:44.497062968 +0400 -+++ suite/storage_engine/checksum_table_live.reject 2012-07-15 17:47:28.105399836 +0400 +--- suite/storage_engine/checksum_table_live.result ++++ suite/storage_engine/checksum_table_live.reject @@ -11,8 +11,8 @@ test.t1 4272806499 CHECKSUM TABLE t1, t2 QUICK; diff --git a/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff b/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff index a68fe83070e..e35cd5dcfa1 100644 --- a/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff +++ b/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/fulltext_search.result 2013-11-27 18:50:16.000000000 +0400 -+++ suite/storage_engine/fulltext_search.reject 2014-02-05 15:33:26.000000000 +0400 +--- suite/storage_engine/fulltext_search.result ++++ suite/storage_engine/fulltext_search.reject @@ -52,15 +52,14 @@ INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test'); SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing'); diff --git a/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff b/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff index f8e812e7edb..b0e730205cd 100644 --- a/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff +++ b/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index_enable_disable.result 2012-07-15 00:30:05.296641931 +0400 -+++ suite/storage_engine/index_enable_disable.reject 2012-07-15 17:49:12.988081281 +0400 +--- suite/storage_engine/index_enable_disable.result ++++ suite/storage_engine/index_enable_disable.reject @@ -11,15 +11,19 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 1 a 1 a # # NULL NULL YES BTREE diff --git a/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff b/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff index 02f9d93588f..665b45c0274 100644 --- a/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff +++ b/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index_type_hash.result 2012-07-15 01:10:17.919128889 +0400 -+++ suite/storage_engine/index_type_hash.reject 2012-07-15 17:49:26.135915989 +0400 +--- suite/storage_engine/index_type_hash.result ++++ suite/storage_engine/index_type_hash.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff b/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff index 9e6cddf03f0..16252566fdb 100644 --- a/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff +++ b/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/insert_delayed.result 2013-01-23 01:23:49.461254916 +0400 -+++ suite/storage_engine/insert_delayed.reject 2013-01-23 01:47:05.975698364 +0400 +--- suite/storage_engine/insert_delayed.result ++++ suite/storage_engine/insert_delayed.reject @@ -5,7 +5,16 @@ connect con0,localhost,root,,; SET lock_wait_timeout = 1; diff --git a/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff b/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff index c76a5fe7f15..8b4452ea5ee 100644 --- a/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff +++ b/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/lock_concurrent.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/lock_concurrent.reject 2012-07-15 17:50:21.279222746 +0400 +--- suite/storage_engine/lock_concurrent.result ++++ suite/storage_engine/lock_concurrent.reject @@ -4,6 +4,14 @@ connect con1,localhost,root,,; SET lock_wait_timeout = 1; diff --git a/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff b/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff index 54d1f600516..14dbeaec3a2 100644 --- a/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/optimize_table.result 2012-07-12 19:13:53.741428591 +0400 -+++ suite/storage_engine/optimize_table.reject 2012-07-15 17:50:30.843102510 +0400 +--- suite/storage_engine/optimize_table.result ++++ suite/storage_engine/optimize_table.reject @@ -5,25 +5,32 @@ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); OPTIMIZE TABLE t1; diff --git a/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff index c8aabb787e9..660195498fa 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/parts/checksum_table.result 2013-11-08 22:30:34.000000000 +0400 -+++ suite/storage_engine/parts/checksum_table.reject 2013-11-08 22:32:30.000000000 +0400 +--- suite/storage_engine/parts/checksum_table.result ++++ suite/storage_engine/parts/checksum_table.reject @@ -31,8 +31,8 @@ test.t1 4272806499 CHECKSUM TABLE t1, t2 QUICK; diff --git a/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff index 0df91c6fc6e..4f4165b1143 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/parts/create_table.result 2012-07-12 21:56:38.618667460 +0400 -+++ suite/storage_engine/parts/create_table.reject 2012-07-15 20:06:43.496358345 +0400 +--- suite/storage_engine/parts/create_table.result ++++ suite/storage_engine/parts/create_table.reject @@ -65,7 +65,7 @@ 1 SIMPLE t1 abc,def # # # # # # # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100; diff --git a/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff index a35ba5167d9..0133a43088e 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/parts/optimize_table.result 2013-07-18 22:55:38.000000000 +0400 -+++ suite/storage_engine/parts/optimize_table.reject 2013-08-05 19:45:19.000000000 +0400 +--- suite/storage_engine/parts/optimize_table.result ++++ suite/storage_engine/parts/optimize_table.reject @@ -9,18 +9,22 @@ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); ALTER TABLE t1 OPTIMIZE PARTITION p1; diff --git a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff index 35b150e82d1..19d665ce93a 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/parts/repair_table.result 2013-07-18 22:55:38.000000000 +0400 -+++ suite/storage_engine/parts/repair_table.reject 2013-08-05 19:54:09.000000000 +0400 +--- suite/storage_engine/parts/repair_table.result ++++ suite/storage_engine/parts/repair_table.reject @@ -25,7 +25,7 @@ INSERT INTO t1 (a,b) VALUES (10,'j'); ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM; diff --git a/storage/innobase/mysql-test/storage_engine/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/repair_table.rdiff index e9c46b3a6c1..18852739d06 100644 --- a/storage/innobase/mysql-test/storage_engine/repair_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/repair_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/repair_table.result 2013-10-03 20:35:06.000000000 +0400 -+++ suite/storage_engine/repair_table.reject 2013-11-08 22:04:22.000000000 +0400 +--- suite/storage_engine/repair_table.result ++++ suite/storage_engine/repair_table.reject @@ -4,56 +4,57 @@ CREATE TABLE t2 (a , b ) ENGINE= ; REPAIR TABLE t1; diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_index_dir.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_index_dir.rdiff index e09e50b17ec..7d08e30a70b 100644 --- a/storage/innobase/mysql-test/storage_engine/tbl_opt_index_dir.rdiff +++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_index_dir.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_data_index_dir.result 2013-10-03 20:35:06.000000000 +0400 -+++ suite/storage_engine/tbl_opt_data_index_dir.reject 2013-11-08 22:06:54.000000000 +0400 +--- suite/storage_engine/tbl_opt_data_index_dir.result ++++ suite/storage_engine/tbl_opt_data_index_dir.reject @@ -1,10 +1,12 @@ DROP TABLE IF EXISTS t1; +Warnings: diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff index 468b82926f0..d94836573a8 100644 --- a/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff +++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_insert_method.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/tbl_opt_insert_method.reject 2012-07-15 17:51:09.978610512 +0400 +--- suite/storage_engine/tbl_opt_insert_method.result ++++ suite/storage_engine/tbl_opt_insert_method.reject @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff index daa5fc67dec..717ccf954cf 100644 --- a/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff +++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff @@ -1,5 +1,5 @@ ---- ../storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.result~ 2017-05-24 00:40:12.854181048 +0300 -+++ ../storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.reject 2017-05-24 00:49:06.578191030 +0300 +--- ../storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.result~ ++++ ../storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.reject @@ -7,19 +7,39 @@ `b` char(8) DEFAULT NULL ) ENGINE= DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff index cbdf5818022..bf30d718c56 100644 --- a/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff +++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_union.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/tbl_opt_union.reject 2012-07-15 17:51:31.014346053 +0400 +--- suite/storage_engine/tbl_opt_union.result ++++ suite/storage_engine/tbl_opt_union.reject @@ -4,11 +4,11 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff index e6149be58dc..2860d5cb0b8 100644 --- a/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff +++ b/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/cons_snapshot_serializable.result 2013-11-27 18:46:36.000000000 +0400 -+++ suite/storage_engine/trx/cons_snapshot_serializable.reject 2013-11-28 19:17:02.000000000 +0400 +--- suite/storage_engine/trx/cons_snapshot_serializable.result ++++ suite/storage_engine/trx/cons_snapshot_serializable.reject @@ -5,12 +5,15 @@ CREATE TABLE t1 (a ) ENGINE= ; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; diff --git a/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff index cb64d32138b..d0a846ee1f7 100644 --- a/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff +++ b/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_read_committed.result 2013-11-28 19:18:48.000000000 +0400 -+++ suite/storage_engine/trx/level_read_committed.reject 2013-11-28 19:18:59.000000000 +0400 +--- suite/storage_engine/trx/level_read_committed.result ++++ suite/storage_engine/trx/level_read_committed.reject @@ -77,6 +77,8 @@ CREATE TABLE t1 (a ) ENGINE= ; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; diff --git a/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff index 6a79abe3ca5..ee483dd64bb 100644 --- a/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff +++ b/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_read_uncommitted.result 2013-11-28 19:18:48.000000000 +0400 -+++ suite/storage_engine/trx/level_read_uncommitted.reject 2013-11-28 19:19:50.000000000 +0400 +--- suite/storage_engine/trx/level_read_uncommitted.result ++++ suite/storage_engine/trx/level_read_uncommitted.reject @@ -102,6 +102,8 @@ CREATE TABLE t1 (a ) ENGINE= ; SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; diff --git a/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff index 98e17f3c825..72f86c2af50 100644 --- a/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff +++ b/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_char_indexes.result 2014-10-12 14:22:11.000000000 +0400 -+++ suite/storage_engine/type_char_indexes.reject 2014-10-12 14:23:28.000000000 +0400 +--- suite/storage_engine/type_char_indexes.result ++++ suite/storage_engine/type_char_indexes.reject @@ -137,7 +137,7 @@ r3a EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; diff --git a/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff index 6ebfd61d876..79af0d9dd37 100644 --- a/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff +++ b/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_float_indexes.result 2012-07-12 19:37:27.031661128 +0400 -+++ suite/storage_engine/type_float_indexes.reject 2012-07-15 17:52:12.189828410 +0400 +--- suite/storage_engine/type_float_indexes.result ++++ suite/storage_engine/type_float_indexes.reject @@ -60,7 +60,7 @@ ALTER TABLE t1 ADD UNIQUE KEY(d); EXPLAIN SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d; diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 35f1c31d7b4..986f20080b3 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -154,18 +154,6 @@ static io_slots *write_slots; /** Number of retries for partial I/O's */ constexpr ulint NUM_RETRIES_ON_PARTIAL_IO = 10; -/* This specifies the file permissions InnoDB uses when it creates files in -Unix; the value of os_innodb_umask is initialized in ha_innodb.cc to -my_umask */ - -#ifndef _WIN32 -/** Umask for creating files */ -static ulint os_innodb_umask = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; -#else -/** Umask for creating files */ -static ulint os_innodb_umask = 0; -#endif /* _WIN32 */ - Atomic_counter os_n_file_reads; static ulint os_bytes_read_since_printout; Atomic_counter os_n_file_writes; @@ -1014,7 +1002,7 @@ os_file_create_simple_func( #endif for (;;) { - file = open(name, create_flag | direct_flag, os_innodb_umask); + file = open(name, create_flag | direct_flag, my_umask); if (file == -1) { #ifdef O_DIRECT @@ -1219,7 +1207,7 @@ skip_o_direct: os_file_t file; for (;;) { - file = open(name, create_flag | direct_flag, os_innodb_umask); + file = open(name, create_flag | direct_flag, my_umask); if (file == -1) { #ifdef O_DIRECT @@ -1339,7 +1327,7 @@ os_file_create_simple_no_error_handling_func( } } - file = open(name, create_flag, os_innodb_umask); + file = open(name, create_flag, my_umask); *success = (file != -1); @@ -3618,16 +3606,6 @@ os_aio_refresh_stats() os_last_printout = time(NULL); } - -/** -Set the file create umask -@param[in] umask The umask to use for file creation. */ -void -os_file_set_umask(ulint umask) -{ - os_innodb_umask = umask; -} - #ifdef _WIN32 /* Checks whether physical drive is on SSD.*/ @@ -3792,13 +3770,19 @@ void fil_node_t::find_metadata(IF_WIN(,bool create)) noexcept punch_hole= 2; else punch_hole= IF_WIN(, !create ||) os_is_sparse_file_supported(file); - if (space->purpose != FIL_TYPE_TABLESPACE) + /* For temporary tablespace or during IMPORT TABLESPACE, we + disable neighbour flushing and do not care about atomicity. */ + if (space->is_temporary()) { - /* For temporary tablespace or during IMPORT TABLESPACE, we - disable neighbour flushing and do not care about atomicity. */ on_ssd= true; atomic_write= true; - if (space->purpose == FIL_TYPE_TEMPORARY || !space->is_compressed()) + return; + } + if (space->is_being_imported()) + { + on_ssd= true; + atomic_write= true; + if (!space->is_compressed()) return; } #ifdef _WIN32 diff --git a/storage/innobase/pars/pars0opt.cc b/storage/innobase/pars/pars0opt.cc index 44949ad0dda..f229ae8df6c 100644 --- a/storage/innobase/pars/pars0opt.cc +++ b/storage/innobase/pars/pars0opt.cc @@ -340,9 +340,7 @@ opt_calc_index_goodness( ulint op; ulint j; - /* At least for now we don't support using FTS indexes for queries - done through InnoDB's own SQL parser. */ - if (dict_index_is_online_ddl(index) || (index->type & DICT_FTS)) { + if (!index->is_normal_btree() || !index->is_committed()) { return(0); } @@ -558,7 +556,8 @@ opt_search_plan_for_table( plan_t* plan; dict_index_t* index; ulint n_fields; - ulint best_last_op; + ulint best_goodness = 0; + ulint best_last_op = 0; que_node_t* index_plan[256]; que_node_t* best_index_plan[256]; @@ -572,14 +571,9 @@ opt_search_plan_for_table( /* Calculate goodness for each index of the table */ plan->index = index = dict_table_get_first_index(table); - ulint best_goodness = opt_calc_index_goodness( - index, sel_node, i, best_index_plan, &best_last_op); - while ((index = dict_table_get_next_index(index))) { - if (!index->is_btree()) { - continue; - } - ulint last_op; + do { + ulint last_op = 0; ulint goodness = opt_calc_index_goodness(index, sel_node, i, index_plan, &last_op); if (goodness > best_goodness) { @@ -591,7 +585,9 @@ opt_search_plan_for_table( n_fields * sizeof *index_plan); best_last_op = last_op; } - } + + index = dict_table_get_next_index(index); + } while (index); n_fields = opt_calc_n_fields_from_goodness(best_goodness); diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 5e1e0686c97..81d93505d70 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -514,8 +514,7 @@ que_thr_step( for_step(thr); } else if (type == QUE_NODE_PROC) { if (thr->prev_node == que_node_get_parent(node)) { - trx->last_sql_stat_start.least_undo_no - = trx->undo_no; + trx->last_stmt_start = trx->undo_no; } proc_step(thr); diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index deb76e5ce29..f4c37333473 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -4924,9 +4924,10 @@ import_error: we will not be writing any redo log for it before we have invoked fil_space_t::set_imported() to declare it a persistent tablespace. */ - table->space = fil_ibd_open( - 2, FIL_TYPE_IMPORT, table->space_id, - dict_tf_to_fsp_flags(table->flags), name, filepath, &err); + table->space = fil_ibd_open(table->space_id, + dict_tf_to_fsp_flags(table->flags), + fil_space_t::VALIDATE_IMPORT, + name, filepath, &err); ut_ad((table->space == NULL) == (err != DB_SUCCESS)); DBUG_EXECUTE_IF("ib_import_open_tablespace_failure", @@ -5015,8 +5016,6 @@ import_error: } ib::info() << "Phase IV - Flush complete"; - /* Set tablespace purpose as FIL_TYPE_TABLESPACE, - so that rollback can go ahead smoothly */ table->space->set_imported(); err = lock_sys_tables(trx); diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 7884d90be2a..7068888c716 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -2561,6 +2561,22 @@ row_ins_index_entry_big_rec( return(error); } +/** Check whether the executed sql command is from insert +statement +@param thd thread information +@return true if it is insert statement */ +static bool thd_sql_is_insert(const THD *thd) noexcept +{ + switch(thd_sql_command(thd)) + { + case SQLCOM_INSERT: + case SQLCOM_INSERT_SELECT: + return true; + default: + return false; + } +} + #if defined __aarch64__&&defined __GNUC__&&__GNUC__==4&&!defined __clang__ /* Avoid GCC 4.8.5 internal compiler error due to srw_mutex::wr_unlock(). We would only need this for row_ins_clust_index_entry_low(), @@ -2709,7 +2725,7 @@ err_exit: && block->page.id().page_no() == index->page && !index->table->is_native_online_ddl() && (!dict_table_is_partition(index->table) - || thd_sql_command(trx->mysql_thd) == SQLCOM_INSERT)) { + || thd_sql_is_insert(trx->mysql_thd))) { if (!index->table->n_rec_locks && !index->table->versioned() diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 4005c474772..92a41a3f335 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1059,7 +1059,8 @@ length in the field data @param heap heap to store the blob offset and length @return DB_SUCCESS if successful */ static dberr_t row_merge_write_blob_to_tmp_file( - dfield_t *field, merge_file_t *blob_file,mem_heap_t **heap) + dfield_t *field, uint32_t local_len, + merge_file_t *blob_file, mem_heap_t **heap) { if (blob_file->fd == OS_FILE_CLOSED) { @@ -1068,83 +1069,74 @@ static dberr_t row_merge_write_blob_to_tmp_file( return DB_OUT_OF_MEMORY; } uint64_t val= blob_file->offset; - uint32_t len= field->len; + uint32_t field_len= field->len; dberr_t err= os_file_write( IORequestWrite, "(bulk insert)", blob_file->fd, - field->data, blob_file->offset, len); + static_cast(field->data) + local_len, blob_file->offset, + field_len - local_len); if (err != DB_SUCCESS) return err; - byte *data= static_cast - (mem_heap_alloc(*heap, BTR_EXTERN_FIELD_REF_SIZE)); + byte *data= + static_cast(mem_heap_alloc(*heap, + local_len + BTR_EXTERN_FIELD_REF_SIZE)); + memcpy(data, field->data, local_len); + dfield_set_data(field, data, local_len + BTR_EXTERN_FIELD_REF_SIZE); + dfield_set_ext(field); + + data+= local_len; /* Write zeroes for first 8 bytes */ memset(data, 0, 8); /* Write offset for next 8 bytes */ mach_write_to_8(data + 8, val); /* Write length of the blob in 4 bytes */ - mach_write_to_4(data + 16, len); - blob_file->offset+= field->len; + mach_write_to_4(data + 16, field_len - local_len); + blob_file->offset+= (field_len - local_len); blob_file->n_rec++; - dfield_set_data(field, data, BTR_EXTERN_FIELD_REF_SIZE); - dfield_set_ext(field); return err; } -/** This function is invoked when tuple size is greater than -innodb_sort_buffer_size. Basically it recreates the tuple -by writing the blob field to the temporary file. -@param entry index fields to be encode the blob +/** Variable length field data or fixed length +character greater than 255 can be stored externally. Instead +of storing it externally, InnoDB should store it in temporary +file and write offset, length into the tuple field +@param fields index fields to be encode the blob @param blob_file file to store the blob data +@param index index for the tuple to be stored @param heap heap to store the blob offset and blob length -@return tuple which fits into sort_buffer_size */ -static dtuple_t* row_merge_buf_large_tuple(const dtuple_t &entry, - merge_file_t *blob_file, - mem_heap_t **heap) +@return error code */ +static +dberr_t row_merge_buf_blob(dfield_t *fields, + merge_file_t *blob_file, + const dict_index_t *index, + mem_heap_t **heap) { - if (!*heap) - *heap= mem_heap_create(DTUPLE_EST_ALLOC(entry.n_fields)); + const uint blob_prefix= dict_table_has_atomic_blobs(index->table) + ? 0 + : REC_ANTELOPE_MAX_INDEX_COL_LEN; + const uint min_local_len = blob_prefix + ? blob_prefix + FIELD_REF_SIZE + : 2 * FIELD_REF_SIZE; - dtuple_t *tuple= dtuple_copy(&entry, *heap); - for (ulint i= 0; i < tuple->n_fields; i++) + for (ulint i= index->first_user_field(); i < index->n_fields; i++) { - dfield_t *field= &tuple->fields[i]; - if (dfield_is_null(field) || field->len <= 2000) + dfield_t *field= &fields[i]; + if (dfield_is_null(field) || index->fields[i].fixed_len) continue; - dberr_t err= row_merge_write_blob_to_tmp_file(field, blob_file, heap); - if (err != DB_SUCCESS) - return nullptr; - } - - return tuple; -} - - -/** Write the field data whose length is more than 2000 bytes -into blob temporary file and write offset, length into the -tuple field -@param entry index fields to be encode the blob -@param n_fields number of fields in the entry -@param heap heap to store the blob offset and blob length -@param blob_file file to store the blob data */ -static dberr_t row_merge_buf_blob(const mtuple_t *entry, ulint n_fields, - mem_heap_t **heap, merge_file_t *blob_file) -{ - - if (!*heap) - *heap= mem_heap_create(100); - - for (ulint i= 0; i < n_fields; i++) - { - dfield_t *field= &entry->fields[i]; - if (dfield_is_null(field) || field->len <= 2000) - continue; - - dberr_t err= row_merge_write_blob_to_tmp_file(field, blob_file, heap); - if (err != DB_SUCCESS) - return err; + if (field->len > min_local_len && + DATA_BIG_COL(index->fields[i].col)) + { + if (*heap == nullptr) + *heap= mem_heap_create(256); + dberr_t err= + row_merge_write_blob_to_tmp_file(field, blob_prefix, + blob_file, heap); + if (err) + return err; + } } return DB_SUCCESS; @@ -1174,8 +1166,10 @@ dberr_t row_merge_buf_write(const row_merge_buf_t *buf, if (blob_file) { ut_ad(buf->index->is_primary()); - err = row_merge_buf_blob( - entry, n_fields, &blob_heap, blob_file); + + err = row_merge_buf_blob(entry->fields, + blob_file, buf->index, + &blob_heap); if (err != DB_SUCCESS) { goto func_exit; } @@ -1183,9 +1177,17 @@ dberr_t row_merge_buf_write(const row_merge_buf_t *buf, ulint rec_size= row_merge_buf_encode( &b, index, entry, n_fields); - if (blob_file && rec_size > srv_page_size) { - err = DB_TOO_BIG_RECORD; - goto func_exit; + if (blob_file) { + ulint rec_max_size = + (srv_page_size == UNIV_PAGE_SIZE_MAX) + ? REDUNDANT_REC_MAX_DATA_SIZE + : page_get_free_space_of_empty( + dict_table_is_comp( + index->table)) / 2; + if (rec_size > rec_max_size) { + err = DB_TOO_BIG_RECORD; + goto func_exit; + } } ut_ad(b < &block[srv_sort_buf_size]); @@ -3563,10 +3565,16 @@ in field data for the tuple @param tuple tuple to be inserted @param heap heap to allocate the memory for the blob storage @param blob_file file to handle blob data */ -static dberr_t row_merge_copy_blob_from_file(dtuple_t *tuple, mem_heap_t *heap, +static dberr_t row_merge_copy_blob_from_file(dtuple_t *tuple, + dict_index_t *index, + mem_heap_t *heap, merge_file_t *blob_file) { - for (ulint i = 0; i < dtuple_get_n_fields(tuple); i++) + ut_ad(tuple->n_fields == index->n_fields); + const uint blob_prefix= dict_table_has_atomic_blobs(index->table) + ? 0 + : REC_ANTELOPE_MAX_INDEX_COL_LEN; + for (ulint i = index->first_user_field(); i < tuple->n_fields; i++) { dfield_t *field= dtuple_get_nth_field(tuple, i); const byte *field_data= static_cast(dfield_get_data(field)); @@ -3577,15 +3585,18 @@ static dberr_t row_merge_copy_blob_from_file(dtuple_t *tuple, mem_heap_t *heap, ut_a(field_len >= BTR_EXTERN_FIELD_REF_SIZE); ut_ad(!dfield_is_null(field)); + field_data += blob_prefix; ut_ad(mach_read_from_8(field_data) == 0); uint64_t offset= mach_read_from_8(field_data + 8); uint32_t len= mach_read_from_4(field_data + 16); - byte *data= (byte*) mem_heap_alloc(heap, len); - if (dberr_t err= os_file_read(IORequestRead, blob_file->fd, data, + byte *data= (byte*) mem_heap_alloc(heap, blob_prefix + len); + memcpy(data, field->data, blob_prefix); + if (dberr_t err= os_file_read(IORequestRead, blob_file->fd, + data + blob_prefix, offset, len, nullptr)) return err; - dfield_set_data(field, data, len); + dfield_set_data(field, data, blob_prefix + len); } return DB_SUCCESS; @@ -3805,7 +3816,7 @@ row_merge_insert_index_tuples( if (!dtuple_get_n_ext(dtuple)) { } else if (blob_file) { error = row_merge_copy_blob_from_file( - dtuple, tuple_heap, blob_file); + dtuple, index, tuple_heap, blob_file); if (error != DB_SUCCESS) { break; } @@ -5172,6 +5183,7 @@ dberr_t row_merge_bulk_t::bulk_insert_buffered(const dtuple_t &row, const dict_index_t &ind, trx_t *trx) { + ut_ad(row.n_fields == ind.n_fields); dberr_t err= DB_SUCCESS; ulint i= 0; mem_heap_t *large_tuple_heap= nullptr; @@ -5197,8 +5209,16 @@ add_to_buf: if (buf->n_tuples == 0) { /* Tuple data size is greater than srv_sort_buf_size */ - dtuple_t *big_tuple= row_merge_buf_large_tuple( - row, &m_blob_file, &large_tuple_heap); + ut_ad(i == 0); + if (!large_tuple_heap) + large_tuple_heap= mem_heap_create(DTUPLE_EST_ALLOC(row.n_fields)); + + dtuple_t *big_tuple= dtuple_copy(&row, large_tuple_heap); + err= row_merge_buf_blob(big_tuple->fields, &m_blob_file, + &ind, &large_tuple_heap); + if (err) + goto func_exit; + if (row_merge_bulk_buf_add(buf, *ind.table, *big_tuple)) { i++; @@ -5354,8 +5374,7 @@ void trx_t::bulk_rollback_low() t.second.end_bulk_insert(); } } - trx_savept_t bulk_save{low_limit}; - rollback(&bulk_save); + rollback(&low_limit); } dberr_t trx_t::bulk_insert_apply_low() diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 74aec0aac8a..87fb2d1f23a 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -624,7 +624,7 @@ row_mysql_handle_errors( function */ trx_t* trx, /*!< in: transaction */ que_thr_t* thr, /*!< in: query thread, or NULL */ - trx_savept_t* savept) /*!< in: savepoint, or NULL */ + const undo_no_t*savept) /*!< in: pointer to savepoint, or nullptr */ { dberr_t err; @@ -680,8 +680,7 @@ handle_new_error: } /* MariaDB will roll back the entire transaction. */ trx->bulk_insert = false; - trx->last_sql_stat_start.least_undo_no = 0; - trx->savepoints_discard(); + trx->last_stmt_start = 0; break; case DB_LOCK_WAIT: err = lock_wait(thr); @@ -699,7 +698,6 @@ handle_new_error: rollback: /* Roll back the whole transaction; this resolution was added to version 3.23.43 */ - trx->rollback(); break; @@ -1136,7 +1134,7 @@ row_lock_table_autoinc_for_mysql( trx->error_state = err; } while (err != DB_SUCCESS - && row_mysql_handle_errors(&err, trx, thr, NULL)); + && row_mysql_handle_errors(&err, trx, thr, nullptr)); trx->op_info = ""; @@ -1178,7 +1176,7 @@ row_lock_table(row_prebuilt_t* prebuilt) prebuilt->select_lock_type), thr); trx->error_state = err; } while (err != DB_SUCCESS - && row_mysql_handle_errors(&err, trx, thr, NULL)); + && row_mysql_handle_errors(&err, trx, thr, nullptr)); trx->op_info = ""; @@ -1217,7 +1215,6 @@ row_insert_for_mysql( row_prebuilt_t* prebuilt, ins_mode_t ins_mode) { - trx_savept_t savept; que_thr_t* thr; dberr_t err; ibool was_lock_wait; @@ -1271,7 +1268,7 @@ row_insert_for_mysql( roll back to the start of the transaction. For correctness, it would suffice to roll back to the start of the first insert into this empty table, but we will keep it simple and efficient. */ - savept.least_undo_no = trx->bulk_insert ? 0 : trx->undo_no; + const undo_no_t savept{trx->bulk_insert ? 0 : trx->undo_no}; thr = que_fork_get_first_thr(prebuilt->ins_graph); @@ -1579,7 +1576,6 @@ init_fts_doc_id_for_ref( dberr_t row_update_for_mysql(row_prebuilt_t* prebuilt) { - trx_savept_t savept; dberr_t err; que_thr_t* thr; dict_index_t* clust_index; @@ -1636,7 +1632,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt) generated for the table: MySQL does not know anything about the row id used as the clustered index key */ - savept.least_undo_no = trx->undo_no; + undo_no_t savept = trx->undo_no; thr = que_fork_get_first_thr(prebuilt->upd_graph); diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index c865737c3df..27a40790a7d 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -1207,8 +1207,7 @@ re_scan: mtr->commit(); trx->error_state = err; thr->lock_state = QUE_THR_LOCK_ROW; - if (row_mysql_handle_errors( - &err, trx, thr, NULL)) { + if (row_mysql_handle_errors(&err, trx, thr, 0)) { thr->lock_state = QUE_THR_LOCK_NOLOCK; mtr->start(); @@ -5871,7 +5870,7 @@ lock_table_wait: trx->error_state = err; thr->lock_state = QUE_THR_LOCK_ROW; - if (row_mysql_handle_errors(&err, trx, thr, NULL)) { + if (row_mysql_handle_errors(&err, trx, thr, nullptr)) { /* It was a lock wait, and it ended */ thr->lock_state = QUE_THR_LOCK_NOLOCK; diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 9e00dc418dc..258598f45be 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -242,7 +242,16 @@ close_and_exit: srv_startup_is_before_trx_rollback_phase = false; } - /* Enable checkpoints in buf_flush_page_cleaner(). */ + /* Enable log_checkpoint() in buf_flush_page_cleaner(). + If we are upgrading or resizing the log at startup, we must not + write any FILE_MODIFY or FILE_CHECKPOINT records to the old log file + because the ib_logfile0 could be in an old format that we can only + check for emptiness, or the write could lead to an overflow. + + At this point, we are not holding recv_sys.mutex, but there are no + pending page reads, and buf_pool.flush_list is empty. Therefore, + we can clear the flag without risking any race condition with + buf_page_t::read_complete(). */ recv_sys.recovery_on = false; log_sys.latch.wr_unlock(); @@ -734,8 +743,7 @@ err_exit: fil_set_max_space_id_if_bigger(space_id); mysql_mutex_lock(&fil_system.mutex); - fil_space_t *space= fil_space_t::create(space_id, fsp_flags, - FIL_TYPE_TABLESPACE, nullptr, + fil_space_t *space= fil_space_t::create(space_id, fsp_flags, false, nullptr, FIL_ENCRYPTION_DEFAULT, true); ut_ad(space); fil_node_t *file= space->add(name, fh, 0, false, true); @@ -1568,8 +1576,6 @@ dberr_t srv_start(bool create_new_db) err = recv_recovery_from_checkpoint_start(); recv_sys.close_files(); - recv_sys.dblwr.pages.clear(); - bool must_upgrade_ibuf = false; switch (srv_operation) { diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc index 4a661c51183..c1784b94bb1 100644 --- a/storage/innobase/trx/trx0i_s.cc +++ b/storage/innobase/trx/trx0i_s.cc @@ -1054,7 +1054,7 @@ static void fetch_data_into_cache(trx_i_s_cache_t *cache) &trx != (purge_sys.query ? purge_sys.query->trx : nullptr)) { trx.mutex_lock(); - if (trx.state != TRX_STATE_NOT_STARTED) + if (trx.is_started()) fetch_data_into_cache_low(cache, &trx); trx.mutex_unlock(); } diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index fd88caa84d0..87d8e0c187f 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -43,6 +43,7 @@ Created 3/26/1996 Heikki Tuuri #include "trx0sys.h" #include "trx0trx.h" #include "trx0undo.h" +#include "log.h" #ifdef UNIV_PFS_THREAD mysql_pfs_key_t trx_rollback_clean_thread_key; @@ -54,10 +55,7 @@ bool trx_rollback_is_active; /** In crash recovery, the current trx to be rolled back; NULL otherwise */ const trx_t* trx_roll_crash_recv_trx; -/** Finish transaction rollback. -@return whether the rollback was completed normally -@retval false if the rollback was aborted by shutdown */ -inline bool trx_t::rollback_finish() +bool trx_t::rollback_finish() noexcept { apply_online_log= false; if (UNIV_LIKELY(error_state == DB_SUCCESS)) @@ -84,34 +82,28 @@ inline bool trx_t::rollback_finish() undo= nullptr; } commit_low(); - commit_cleanup(); - return false; + return commit_cleanup(); } -/** Roll back an active transaction. */ -inline void trx_t::rollback_low(trx_savept_t *savept) +dberr_t trx_t::rollback_low(const undo_no_t *savept) noexcept { + op_info= "rollback"; mem_heap_t *heap= mem_heap_create(512); roll_node_t *roll_node= roll_node_create(heap); - roll_node->savept= savept; + + roll_node->savept= savept ? *savept : 0; ut_ad(!in_rollback); #ifdef UNIV_DEBUG + if (savept) { - const auto s= state; - ut_ad(s == TRX_STATE_ACTIVE || - s == TRX_STATE_PREPARED || - s == TRX_STATE_PREPARED_RECOVERED); - if (savept) - { - ut_ad(s == TRX_STATE_ACTIVE); - ut_ad(mysql_thd); - ut_ad(!is_recovered); - } + ut_ad(state == TRX_STATE_ACTIVE); + ut_ad(mysql_thd); + ut_ad(!is_recovered); } #endif - error_state = DB_SUCCESS; + error_state= DB_SUCCESS; if (has_logged()) { @@ -138,7 +130,7 @@ inline void trx_t::rollback_low(trx_savept_t *savept) victim. Galera transaction abort can be invoked during partial rollback. */ ut_ad(!(lock.was_chosen_as_deadlock_victim & 1)); ut_a(error_state == DB_SUCCESS); - const undo_no_t limit= savept->least_undo_no; + const undo_no_t limit{*savept}; apply_online_log= false; for (trx_mod_tables_t::iterator i= mod_tables.begin(); i != mod_tables.end(); ) @@ -157,49 +149,34 @@ inline void trx_t::rollback_low(trx_savept_t *savept) } mem_heap_free(heap); + op_info= ""; + return error_state; } -/** Initiate rollback. -@param savept savepoint -@return error code or DB_SUCCESS */ -dberr_t trx_t::rollback(trx_savept_t *savept) +dberr_t trx_t::rollback(const undo_no_t *savept) noexcept { ut_ad(!mutex_is_owner()); - if (state == TRX_STATE_NOT_STARTED) - { + switch (state) { + case TRX_STATE_ABORTED: + ut_ad(!savept); + state= TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: error_state= DB_SUCCESS; return DB_SUCCESS; + case TRX_STATE_PREPARED: + case TRX_STATE_PREPARED_RECOVERED: + case TRX_STATE_COMMITTED_IN_MEMORY: + ut_ad("invalid state" == 0); + /* fall through */ + case TRX_STATE_ACTIVE: + break; } - ut_ad(state == TRX_STATE_ACTIVE); #ifdef WITH_WSREP if (!savept && is_wsrep() && wsrep_thd_is_SR(mysql_thd)) wsrep_handle_SR_rollback(nullptr, mysql_thd); #endif /* WITH_WSREP */ - rollback_low(savept); - return error_state; -} - -/*******************************************************************//** -Rollback a transaction used in MySQL. -@return error code or DB_SUCCESS */ -static -dberr_t -trx_rollback_for_mysql_low( -/*=======================*/ - trx_t* trx) /*!< in/out: transaction */ -{ - trx->op_info = "rollback"; - - /* If we are doing the XA recovery of prepared transactions, - then the transaction object does not have an InnoDB session - object, and we set a dummy session that we use for all MySQL - transactions. */ - - trx->rollback_low(); - - trx->op_info = ""; - - return(trx->error_state); + return rollback_low(savept); } /** Rollback a transaction used in MySQL @@ -213,6 +190,9 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) that is associated with the current thread. */ switch (trx->state) { + case TRX_STATE_ABORTED: + trx->state = TRX_STATE_NOT_STARTED; + /* fall through */ case TRX_STATE_NOT_STARTED: trx->will_lock = false; ut_ad(trx->mysql_thd); @@ -224,13 +204,13 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) ut_ad(!trx->is_wsrep()); trx->lock.was_chosen_as_deadlock_victim= false; #endif + ut_a(UT_LIST_GET_LEN(trx->lock.trx_locks) == 0); return(DB_SUCCESS); - case TRX_STATE_ACTIVE: ut_ad(trx->mysql_thd); ut_ad(!trx->is_recovered); ut_ad(!trx->is_autocommit_non_locking() || trx->read_only); - return(trx_rollback_for_mysql_low(trx)); + return trx->rollback_low(); case TRX_STATE_PREPARED: case TRX_STATE_PREPARED_RECOVERED: @@ -268,7 +248,7 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) mtr.commit(); ut_ad(mtr.commit_lsn() > 0); } - return(trx_rollback_for_mysql_low(trx)); + return trx->rollback_low(); case TRX_STATE_COMMITTED_IN_MEMORY: ut_ad(!trx->is_autocommit_non_locking()); @@ -279,296 +259,6 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) return(DB_CORRUPTION); } -/*******************************************************************//** -Rollback the latest SQL statement for MySQL. -@return error code or DB_SUCCESS */ -dberr_t -trx_rollback_last_sql_stat_for_mysql( -/*=================================*/ - trx_t* trx) /*!< in/out: transaction */ -{ - dberr_t err; - - /* We are reading trx->state without holding trx->mutex - here, because the statement rollback should be invoked for a - running active MySQL transaction that is associated with the - current thread. */ - ut_ad(trx->mysql_thd); - - switch (trx->state) { - case TRX_STATE_NOT_STARTED: - return(DB_SUCCESS); - - case TRX_STATE_ACTIVE: - ut_ad(trx->mysql_thd); - ut_ad(!trx->is_recovered); - ut_ad(!trx->is_autocommit_non_locking() || trx->read_only); - - trx->op_info = "rollback of SQL statement"; - - err = trx->rollback(&trx->last_sql_stat_start); - - if (trx->fts_trx != NULL) { - fts_savepoint_rollback_last_stmt(trx); - fts_savepoint_laststmt_refresh(trx); - } - - trx->last_sql_stat_start.least_undo_no = trx->undo_no; - trx->end_bulk_insert(); - - trx->op_info = ""; - - return(err); - - case TRX_STATE_PREPARED: - case TRX_STATE_PREPARED_RECOVERED: - case TRX_STATE_COMMITTED_IN_MEMORY: - /* The statement rollback is only allowed on an ACTIVE - transaction, not a PREPARED or COMMITTED one. */ - break; - } - - ut_error; - return(DB_CORRUPTION); -} - -/*******************************************************************//** -Search for a savepoint using name. -@return savepoint if found else NULL */ -static -trx_named_savept_t* -trx_savepoint_find( -/*===============*/ - trx_t* trx, /*!< in: transaction */ - const char* name) /*!< in: savepoint name */ -{ - trx_named_savept_t* savep; - - for (savep = UT_LIST_GET_FIRST(trx->trx_savepoints); - savep != NULL; - savep = UT_LIST_GET_NEXT(trx_savepoints, savep)) { - if (!strcmp(savep->name, name)) { - return(savep); - } - } - - return(NULL); -} - -/*******************************************************************//** -Frees a single savepoint struct. */ -static -void -trx_roll_savepoint_free( -/*=====================*/ - trx_t* trx, /*!< in: transaction handle */ - trx_named_savept_t* savep) /*!< in: savepoint to free */ -{ - UT_LIST_REMOVE(trx->trx_savepoints, savep); - - ut_free(savep->name); - ut_free(savep); -} - -/** Discard all savepoints starting from a particular savepoint. -@param savept first savepoint to discard */ -void trx_t::savepoints_discard(trx_named_savept_t *savept) -{ - while (savept) - { - auto next= UT_LIST_GET_NEXT(trx_savepoints, savept); - trx_roll_savepoint_free(this, savept); - savept= next; - } -} - -/*******************************************************************//** -Rolls back a transaction back to a named savepoint. Modifications after the -savepoint are undone but InnoDB does NOT release the corresponding locks -which are stored in memory. If a lock is 'implicit', that is, a new inserted -row holds a lock where the lock information is carried by the trx id stored in -the row, these locks are naturally released in the rollback. Savepoints which -were set after this savepoint are deleted. -@return if no savepoint of the name found then DB_NO_SAVEPOINT, -otherwise DB_SUCCESS */ -static MY_ATTRIBUTE((nonnull, warn_unused_result)) -dberr_t -trx_rollback_to_savepoint_for_mysql_low( -/*====================================*/ - trx_t* trx, /*!< in/out: transaction */ - trx_named_savept_t* savep, /*!< in/out: savepoint */ - int64_t* mysql_binlog_cache_pos) - /*!< out: the MySQL binlog - cache position corresponding - to this savepoint; MySQL needs - this information to remove the - binlog entries of the queries - executed after the savepoint */ -{ - dberr_t err; - - ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); - ut_ad(trx->mysql_thd); - - /* Free all savepoints strictly later than savep. */ - - trx->savepoints_discard(UT_LIST_GET_NEXT(trx_savepoints, savep)); - - *mysql_binlog_cache_pos = savep->mysql_binlog_cache_pos; - - trx->op_info = "rollback to a savepoint"; - - err = trx->rollback(&savep->savept); - - /* Store the current undo_no of the transaction so that - we know where to roll back if we have to roll back the - next SQL statement: */ - - trx_mark_sql_stat_end(trx); - - trx->op_info = ""; - return(err); -} - -/*******************************************************************//** -Rolls back a transaction back to a named savepoint. Modifications after the -savepoint are undone but InnoDB does NOT release the corresponding locks -which are stored in memory. If a lock is 'implicit', that is, a new inserted -row holds a lock where the lock information is carried by the trx id stored in -the row, these locks are naturally released in the rollback. Savepoints which -were set after this savepoint are deleted. -@return if no savepoint of the name found then DB_NO_SAVEPOINT, -otherwise DB_SUCCESS */ -dberr_t -trx_rollback_to_savepoint_for_mysql( -/*================================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name, /*!< in: savepoint name */ - int64_t* mysql_binlog_cache_pos) /*!< out: the MySQL binlog cache - position corresponding to this - savepoint; MySQL needs this - information to remove the - binlog entries of the queries - executed after the savepoint */ -{ - trx_named_savept_t* savep; - - /* We are reading trx->state without holding trx->mutex - here, because the savepoint rollback should be invoked for a - running active MySQL transaction that is associated with the - current thread. */ - ut_ad(trx->mysql_thd); - - savep = trx_savepoint_find(trx, savepoint_name); - - if (savep == NULL) { - return(DB_NO_SAVEPOINT); - } - - switch (trx->state) { - case TRX_STATE_NOT_STARTED: - ib::error() << "Transaction has a savepoint " - << savep->name - << " though it is not started"; - return(DB_ERROR); - - case TRX_STATE_ACTIVE: - - return(trx_rollback_to_savepoint_for_mysql_low( - trx, savep, mysql_binlog_cache_pos)); - - case TRX_STATE_PREPARED: - case TRX_STATE_PREPARED_RECOVERED: - case TRX_STATE_COMMITTED_IN_MEMORY: - /* The savepoint rollback is only allowed on an ACTIVE - transaction, not a PREPARED or COMMITTED one. */ - break; - } - - ut_error; - return(DB_CORRUPTION); -} - -/*******************************************************************//** -Creates a named savepoint. If the transaction is not yet started, starts it. -If there is already a savepoint of the same name, this call erases that old -savepoint and replaces it with a new. Savepoints are deleted in a transaction -commit or rollback. -@return always DB_SUCCESS */ -dberr_t -trx_savepoint_for_mysql( -/*====================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name, /*!< in: savepoint name */ - int64_t binlog_cache_pos) /*!< in: MySQL binlog cache - position corresponding to this - connection at the time of the - savepoint */ -{ - trx_named_savept_t* savep; - - trx_start_if_not_started_xa(trx, false); - - savep = trx_savepoint_find(trx, savepoint_name); - - if (savep) { - /* There is a savepoint with the same name: free that */ - - UT_LIST_REMOVE(trx->trx_savepoints, savep); - - ut_free(savep->name); - ut_free(savep); - } - - /* Create a new savepoint and add it as the last in the list */ - - savep = static_cast( - ut_malloc_nokey(sizeof(*savep))); - - savep->name = mem_strdup(savepoint_name); - - savep->savept.least_undo_no = trx->undo_no; - trx->last_sql_stat_start.least_undo_no = trx->undo_no; - - savep->mysql_binlog_cache_pos = binlog_cache_pos; - - UT_LIST_ADD_LAST(trx->trx_savepoints, savep); - - trx->end_bulk_insert(); - - return(DB_SUCCESS); -} - -/*******************************************************************//** -Releases only the named savepoint. Savepoints which were set after this -savepoint are left as is. -@return if no savepoint of the name found then DB_NO_SAVEPOINT, -otherwise DB_SUCCESS */ -dberr_t -trx_release_savepoint_for_mysql( -/*============================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name) /*!< in: savepoint name */ -{ - trx_named_savept_t* savep; - - ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE, true) - || trx_state_eq(trx, TRX_STATE_PREPARED, true)); - ut_ad(trx->mysql_thd); - - savep = trx_savepoint_find(trx, savepoint_name); - - if (savep != NULL) { - trx_roll_savepoint_free(trx, savep); - return DB_SUCCESS; - } else if (trx->last_sql_stat_start.least_undo_no == 0) { - /* Bulk insert could have discarded savepoints */ - return DB_SUCCESS; - } - - return DB_NO_SAVEPOINT; -} - /*******************************************************************//** Roll back an active transaction. */ static @@ -620,7 +310,9 @@ trx_rollback_active( if (UNIV_UNLIKELY(!trx->rollback_finish())) { ut_ad(!dictionary_locked); } else { - ib::info() << "Rolled back recovered transaction " << trx_id; + sql_print_information( + "InnoDB: Rolled back recovered transaction " + TRX_ID_FMT, trx_id); } if (dictionary_locked) { @@ -906,7 +598,6 @@ trx_rollback_step( if (node->state == ROLL_NODE_SEND) { trx_t* trx; - ib_id_t roll_limit; trx = thr_get_trx(thr); @@ -914,13 +605,11 @@ trx_rollback_step( ut_a(node->undo_thr == NULL); - roll_limit = node->savept ? node->savept->least_undo_no : 0; - trx->mutex_lock(); trx_commit_or_rollback_prepare(trx); - node->undo_thr = trx_rollback_start(trx, roll_limit); + node->undo_thr = trx_rollback_start(trx, node->savept); trx->mutex_unlock(); } else { diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index 7b6073c598c..0d3a630d35d 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -47,6 +47,31 @@ trx_sys_t trx_sys; #ifdef UNIV_DEBUG /* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */ uint trx_rseg_n_slots_debug = 0; + +void rw_trx_hash_t::validate_element(trx_t *trx) +{ + ut_ad(!trx->read_only || !trx->rsegs.m_redo.rseg); + ut_ad(!trx->is_autocommit_non_locking()); + ut_d(bool acquire_trx_mutex= !trx->mutex_is_owner()); + ut_d(if (acquire_trx_mutex) trx->mutex_lock()); + switch (trx->state) { + case TRX_STATE_NOT_STARTED: + case TRX_STATE_ABORTED: + ut_error; + case TRX_STATE_PREPARED: + case TRX_STATE_PREPARED_RECOVERED: + case TRX_STATE_COMMITTED_IN_MEMORY: + ut_ad(!trx->is_autocommit_non_locking()); + break; + case TRX_STATE_ACTIVE: + if (!trx->is_autocommit_non_locking()) + break; + ut_ad(!trx->is_recovered); + ut_ad(trx->read_only); + ut_ad(trx->mysql_thd); + } + ut_d(if (acquire_trx_mutex) trx->mutex_unlock()); +} #endif /** Display the MySQL binlog offset info if it is present in the trx @@ -232,7 +257,8 @@ static trx_rseg_t *trx_rseg_create(uint32_t space_id) if (fil_space_t *space= mtr.x_lock_space(space_id)) { - ut_ad(space->purpose == FIL_TYPE_TABLESPACE); + ut_ad(!space->is_temporary()); + ut_ad(!space->is_being_imported()); if (buf_block_t *sys_header= trx_sysf_get(&mtr)) { ulint rseg_id= trx_sys_rseg_find_free(sys_header); @@ -356,6 +382,7 @@ size_t trx_sys_t::any_active_transactions(size_t *prepared) trx_sys.trx_list.for_each([&](const trx_t &trx) { switch (trx.state) { case TRX_STATE_NOT_STARTED: + case TRX_STATE_ABORTED: break; case TRX_STATE_ACTIVE: if (!trx.id) diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 55c283859cb..80cba1789ae 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -144,7 +144,7 @@ trx_init( trx->magic_n = TRX_MAGIC_N; - trx->last_sql_stat_start.least_undo_no = 0; + trx->last_stmt_start = 0; ut_ad(!trx->read_view.is_open()); @@ -192,10 +192,6 @@ struct TrxFactory { UT_LIST_INIT(trx->lock.evicted_tables, &dict_table_t::table_LRU); - UT_LIST_INIT( - trx->trx_savepoints, - &trx_named_savept_t::trx_savepoints); - trx->mutex_init(); } @@ -437,9 +433,8 @@ void trx_t::free() MEM_NOACCESS(&error_info, sizeof error_info); MEM_NOACCESS(&error_key_num, sizeof error_key_num); MEM_NOACCESS(&graph, sizeof graph); - MEM_NOACCESS(&trx_savepoints, sizeof trx_savepoints); MEM_NOACCESS(&undo_no, sizeof undo_no); - MEM_NOACCESS(&last_sql_stat_start, sizeof last_sql_stat_start); + MEM_NOACCESS(&last_stmt_start, sizeof last_stmt_start); MEM_NOACCESS(&rsegs, sizeof rsegs); MEM_NOACCESS(&roll_limit, sizeof roll_limit); MEM_NOACCESS(&in_rollback, sizeof in_rollback); @@ -467,9 +462,10 @@ void trx_t::free() /** Transition to committed state, to release implicit locks. */ TRANSACTIONAL_INLINE inline void trx_t::commit_state() { - ut_ad(state == TRX_STATE_PREPARED - || state == TRX_STATE_PREPARED_RECOVERED - || state == TRX_STATE_ACTIVE); + ut_d(auto trx_state{state}); + ut_ad(trx_state == TRX_STATE_PREPARED || + trx_state == TRX_STATE_PREPARED_RECOVERED || + trx_state == TRX_STATE_ACTIVE); /* This makes the transaction committed in memory and makes its changes to data visible to other transactions. NOTE that there is a small discrepancy from the strict formal visibility rules here: a @@ -1495,8 +1491,6 @@ TRANSACTIONAL_INLINE inline void trx_t::commit_in_memory(const mtr_t *mtr) } } - savepoints_discard(); - if (fts_trx) trx_finalize_for_fts(this, undo_no != 0); @@ -1515,7 +1509,7 @@ TRANSACTIONAL_INLINE inline void trx_t::commit_in_memory(const mtr_t *mtr) lock.was_chosen_as_deadlock_victim= false; } -void trx_t::commit_cleanup() +bool trx_t::commit_cleanup() noexcept { ut_ad(!dict_operation); ut_ad(!was_dict_operation); @@ -1536,6 +1530,7 @@ void trx_t::commit_cleanup() mutex.wr_unlock(); ut_a(error_state == DB_SUCCESS); + return false; } /** Commit the transaction in a mini-transaction. @@ -1600,7 +1595,7 @@ TRANSACTIONAL_TARGET void trx_t::commit_low(mtr_t *mtr) } -void trx_t::commit_persist() +void trx_t::commit_persist() noexcept { mtr_t *mtr= nullptr; mtr_t local_mtr; @@ -1614,7 +1609,7 @@ void trx_t::commit_persist() } -void trx_t::commit() +void trx_t::commit() noexcept { ut_ad(!was_dict_operation); ut_d(was_dict_operation= dict_operation); @@ -1653,6 +1648,7 @@ trx_commit_or_rollback_prepare( return; case TRX_STATE_COMMITTED_IN_MEMORY: + case TRX_STATE_ABORTED: break; } @@ -1720,33 +1716,26 @@ trx_commit_step( return(thr); } -/**********************************************************************//** -Does the transaction commit for MySQL. -@return DB_SUCCESS or error number */ -dberr_t -trx_commit_for_mysql( -/*=================*/ - trx_t* trx) /*!< in/out: transaction */ +void trx_commit_for_mysql(trx_t *trx) noexcept { - /* Because we do not do the commit by sending an Innobase - sig to the transaction, we must here make sure that trx has been - started. */ - - switch (trx->state) { - case TRX_STATE_NOT_STARTED: - return DB_SUCCESS; - case TRX_STATE_ACTIVE: - case TRX_STATE_PREPARED: - case TRX_STATE_PREPARED_RECOVERED: - trx->op_info = "committing"; - trx->commit(); - trx->op_info = ""; - return(DB_SUCCESS); - case TRX_STATE_COMMITTED_IN_MEMORY: - break; - } - ut_error; - return(DB_CORRUPTION); + switch (trx->state) { + case TRX_STATE_ABORTED: + trx->state= TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: + trx->will_lock= false; + break; + case TRX_STATE_ACTIVE: + case TRX_STATE_PREPARED: + case TRX_STATE_PREPARED_RECOVERED: + trx->op_info= "committing"; + trx->commit(); + trx->op_info= ""; + break; + case TRX_STATE_COMMITTED_IN_MEMORY: + ut_error; + break; + } } /** Durably write log until trx->commit_lsn @@ -1766,45 +1755,6 @@ void trx_commit_complete_for_mysql(trx_t *trx) trx_flush_log_if_needed(lsn, trx); } -/**********************************************************************//** -Marks the latest SQL statement ended. */ -void -trx_mark_sql_stat_end( -/*==================*/ - trx_t* trx) /*!< in: trx handle */ -{ - ut_a(trx); - - switch (trx->state) { - case TRX_STATE_PREPARED: - case TRX_STATE_PREPARED_RECOVERED: - case TRX_STATE_COMMITTED_IN_MEMORY: - break; - case TRX_STATE_NOT_STARTED: - trx->undo_no = 0; - /* fall through */ - case TRX_STATE_ACTIVE: - if (trx->fts_trx != NULL) { - fts_savepoint_laststmt_refresh(trx); - } - - if (trx->is_bulk_insert()) { - /* MDEV-25036 FIXME: we support buffered - insert only for the first insert statement */ - trx->error_state = trx->bulk_insert_apply(); - /* Allow a subsequent INSERT into an empty table - if !unique_checks && !foreign_key_checks. */ - return; - } - - trx->last_sql_stat_start.least_undo_no = trx->undo_no; - trx->end_bulk_insert(); - return; - } - - ut_error; -} - /**********************************************************************//** Prints info about a transaction. */ void @@ -1830,9 +1780,16 @@ trx_print_low( fprintf(f, "TRANSACTION (%p)", trx); } + THD* thd = trx->mysql_thd; + switch (trx->state) { case TRX_STATE_NOT_STARTED: fputs(", not started", f); + thd = nullptr; + goto state_ok; + case TRX_STATE_ABORTED: + fputs(", forced rollback done", f); + thd = nullptr; goto state_ok; case TRX_STATE_ACTIVE: fprintf(f, ", ACTIVE %lu sec", @@ -1898,9 +1855,8 @@ state_ok: putc('\n', f); } - if (trx->state != TRX_STATE_NOT_STARTED && trx->mysql_thd != NULL) { - innobase_mysql_print_thd( - f, trx->mysql_thd, static_cast(max_query_len)); + if (thd) { + innobase_mysql_print_thd(f, thd, uint(max_query_len)); } } @@ -2213,6 +2169,7 @@ trx_start_if_not_started_xa_low( bool read_write) /*!< in: true if read write transaction */ { switch (trx->state) { + case TRX_STATE_ABORTED: case TRX_STATE_NOT_STARTED: trx_start_low(trx, read_write); return; @@ -2256,6 +2213,7 @@ trx_start_if_not_started_low( } return; + case TRX_STATE_ABORTED: case TRX_STATE_PREPARED: case TRX_STATE_PREPARED_RECOVERED: case TRX_STATE_COMMITTED_IN_MEMORY: diff --git a/storage/innobase/unittest/innodb_sync-t.cc b/storage/innobase/unittest/innodb_sync-t.cc index 5ad726d8429..e12b5c25ba3 100644 --- a/storage/innobase/unittest/innodb_sync-t.cc +++ b/storage/innobase/unittest/innodb_sync-t.cc @@ -209,4 +209,7 @@ int main(int argc __attribute__((unused)), char **argv) ok(true, "sux_lock"); sux.free(); + + my_end(MY_CHECK_ERROR); + return exit_status(); } diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index 5b3bc185779..6bf28d7bdbd 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -340,8 +340,6 @@ ut_strerr( return("Data structure corruption"); case DB_CANNOT_DROP_CONSTRAINT: return("Cannot drop constraint"); - case DB_NO_SAVEPOINT: - return("No such savepoint"); case DB_TABLESPACE_EXISTS: return("Tablespace already exists"); case DB_TABLESPACE_DELETED: diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 52dc5632332..93d15962585 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -5455,7 +5455,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) if (! searching) _ma_check_print_info(param, "Found block with wrong recordlength: %lu " - "at %s\n", + "at %s", block_info.rec_len, llstr(sort_param->pos,llbuff)); continue; @@ -6463,7 +6463,7 @@ void _ma_update_auto_increment_key(HA_CHECK *param, MARIA_HA *info, { if (!(param->testflag & T_VERY_SILENT)) _ma_check_print_info(param, - "Table: %s doesn't have an auto increment key\n", + "Table: %s doesn't have an auto increment key", param->isam_file_name); DBUG_VOID_RETURN; } diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c index e73ac95cd35..0709f71ce18 100644 --- a/storage/maria/ma_extra.c +++ b/storage/maria/ma_extra.c @@ -74,7 +74,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, } if (info->s->file_map) /* Don't use cache if mmap */ break; -#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) +#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind) if ((share->options & HA_OPTION_COMPRESS_RECORD)) { mysql_mutex_lock(&share->intern_lock); @@ -162,7 +162,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, error= end_io_cache(&info->rec_cache); /* Sergei will insert full text index caching here */ } -#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) +#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind) if (info->opt_flag & MEMMAP_USED) madvise((char*) share->file_map, share->state.state.data_file_length, MADV_RANDOM); @@ -456,7 +456,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, maria_extra_keyflag(info, function); break; case HA_EXTRA_MMAP: -#ifdef HAVE_MMAP +#if defined(HAVE_MMAP) && !defined(HAVE_valgrind) if (block_records) break; /* Not supported */ mysql_mutex_lock(&share->intern_lock); diff --git a/storage/mroonga/vendor/groonga/src/groonga_benchmark.c b/storage/mroonga/vendor/groonga/src/groonga_benchmark.c index 267bb278764..a4918137d4f 100644 --- a/storage/mroonga/vendor/groonga/src/groonga_benchmark.c +++ b/storage/mroonga/vendor/groonga/src/groonga_benchmark.c @@ -271,12 +271,7 @@ error_exit_in_thread(intptr_t code) CRITICAL_SECTION_ENTER(grntest_cs); grntest_stop_flag = 1; CRITICAL_SECTION_LEAVE(grntest_cs); -#ifdef WIN32 - _endthreadex(code); -#else - pthread_exit((void *)code); -#endif /* WIN32 */ - return 0; + return code; } diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 2bf400d08f3..e46dc35f861 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1272,7 +1272,7 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))) { mi_check_print_warning(param, - "Record checksum is not the same as checksum stored in the index file\n"); + "Record checksum is not the same as checksum stored in the index file"); error=1; } else if (!extend) @@ -3625,7 +3625,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) block_info.rec_len > (uint) share->max_pack_length) { if (! searching) - mi_check_print_info(param,"Found block with wrong recordlength: %ld at %s\n", + mi_check_print_info(param,"Found block with wrong recordlength: %ld at %s", block_info.rec_len, llstr(sort_param->pos,llbuff)); continue; @@ -4135,7 +4135,7 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param) if (info->s->options & HA_OPTION_COMPRESS_RECORD) { mi_check_print_error(param, - "Recover aborted; Can't run standard recovery on compressed tables with errors in data-file. Use switch 'myisamchk --safe-recover' to fix it\n"); + "Recover aborted; Can't run standard recovery on compressed tables with errors in data-file. Use switch 'myisamchk --safe-recover' to fix it"); DBUG_RETURN(1); } @@ -4537,7 +4537,7 @@ void update_auto_increment_key(HA_CHECK *param, MI_INFO *info, { if (!(param->testflag & T_VERY_SILENT)) mi_check_print_info(param, - "Table: %s doesn't have an auto increment key\n", + "Table: %s doesn't have an auto increment key", param->isam_file_name); DBUG_VOID_RETURN; } diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index 96927a0b57b..daaa5d2e259 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -69,7 +69,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) } if (info->s->file_map) /* Don't use cache if mmap */ break; -#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) +#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind) if ((share->options & HA_OPTION_COMPRESS_RECORD)) { mysql_mutex_lock(&share->intern_lock); @@ -155,7 +155,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) error=end_io_cache(&info->rec_cache); /* Sergei will insert full text index caching here */ } -#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) +#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind) if (info->opt_flag & MEMMAP_USED) madvise((char*) share->file_map, share->state.state.data_file_length, MADV_RANDOM); @@ -321,7 +321,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) mi_extra_keyflag(info, function); break; case HA_EXTRA_MMAP: -#ifdef HAVE_MMAP +#if defined(HAVE_MMAP) && !defined(HAVE_valgrind) mysql_mutex_lock(&share->intern_lock); /* Memory map the data file if it is not already mapped. It is safe diff --git a/storage/myisam/mysql-test/mtr2/single.rdiff b/storage/myisam/mysql-test/mtr2/single.rdiff index fd590d53d4a..db13b5f4593 100644 --- a/storage/myisam/mysql-test/mtr2/single.rdiff +++ b/storage/myisam/mysql-test/mtr2/single.rdiff @@ -1,5 +1,5 @@ ---- suite/mtr2/single.result 2013-11-10 03:58:37.000000000 +0400 -+++ suite/mtr2/single.reject 2013-11-10 03:59:08.000000000 +0400 +--- suite/mtr2/single.result ++++ suite/mtr2/single.reject @@ -1,6 +1,6 @@ select 1; 1 diff --git a/storage/myisam/mysql-test/storage_engine/alter_table_online.rdiff b/storage/myisam/mysql-test/storage_engine/alter_table_online.rdiff index 58c7620f3b9..745cf0416ad 100644 --- a/storage/myisam/mysql-test/storage_engine/alter_table_online.rdiff +++ b/storage/myisam/mysql-test/storage_engine/alter_table_online.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/alter_table_online.result 2013-11-08 20:01:16.000000000 +0400 -+++ suite/storage_engine/alter_table_online.reject 2013-11-08 20:02:03.000000000 +0400 +--- suite/storage_engine/alter_table_online.result ++++ suite/storage_engine/alter_table_online.reject @@ -23,12 +50,30 @@ CREATE TABLE t1 (a , b , c ) ENGINE= ; INSERT INTO t1 (a,b,c) VALUES (1,100,'a'),(2,200,'b'),(3,300,'c'); diff --git a/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff index a8c78b117a9..0292bde2fe5 100644 --- a/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff +++ b/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/alter_tablespace.result 2012-07-12 19:53:40.775419511 +0400 -+++ suite/storage_engine/alter_tablespace.reject 2012-07-15 16:21:14.910435703 +0400 +--- suite/storage_engine/alter_tablespace.result ++++ suite/storage_engine/alter_tablespace.reject @@ -1,21 +1,14 @@ DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (a ) ENGINE= ; diff --git a/storage/myisam/mysql-test/storage_engine/check_table.rdiff b/storage/myisam/mysql-test/storage_engine/check_table.rdiff index 48e8fc2e770..7ded1d9bc36 100644 --- a/storage/myisam/mysql-test/storage_engine/check_table.rdiff +++ b/storage/myisam/mysql-test/storage_engine/check_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/check_table.result 2012-07-15 04:19:07.782936394 +0400 -+++ suite/storage_engine/check_table.reject 2012-07-15 16:21:16.734412773 +0400 +--- suite/storage_engine/check_table.result ++++ suite/storage_engine/check_table.reject @@ -18,7 +18,7 @@ INSERT INTO t1 (a,b) VALUES (6,'f'); CHECK TABLE t1 FAST; diff --git a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff index cf24f2c3e61..65d11557c86 100644 --- a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff +++ b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/foreign_keys.result 2012-07-12 18:56:19.782678645 +0400 -+++ suite/storage_engine/foreign_keys.reject 2012-07-15 16:21:30.414240794 +0400 +--- suite/storage_engine/foreign_keys.result ++++ suite/storage_engine/foreign_keys.reject @@ -12,29 +12,57 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff b/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff index e7fa0013fa9..665b45c0274 100644 --- a/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff +++ b/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index_type_hash.result 2012-07-15 01:10:17.919128889 +0400 -+++ suite/storage_engine/index_type_hash.reject 2012-07-15 16:21:32.806210722 +0400 +--- suite/storage_engine/index_type_hash.result ++++ suite/storage_engine/index_type_hash.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/myisam/mysql-test/storage_engine/misc.rdiff b/storage/myisam/mysql-test/storage_engine/misc.rdiff index cdbad003217..0d2f085074f 100644 --- a/storage/myisam/mysql-test/storage_engine/misc.rdiff +++ b/storage/myisam/mysql-test/storage_engine/misc.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/misc.result 2018-02-23 03:01:49.673249912 +0200 -+++ suite/storage_engine/misc.reject 2018-02-23 03:02:05.669249564 +0200 +--- suite/storage_engine/misc.result ++++ suite/storage_engine/misc.reject @@ -28,6 +28,10 @@ SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ORDER BY TABLE_NAME; diff --git a/storage/myisam/mysql-test/storage_engine/show_engine.rdiff b/storage/myisam/mysql-test/storage_engine/show_engine.rdiff index 4e6624653ea..8918fdbee71 100644 --- a/storage/myisam/mysql-test/storage_engine/show_engine.rdiff +++ b/storage/myisam/mysql-test/storage_engine/show_engine.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/show_engine.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/show_engine.reject 2012-07-15 16:21:54.401939228 +0400 +--- suite/storage_engine/show_engine.result ++++ suite/storage_engine/show_engine.reject @@ -4,7 +4,6 @@ # volatile data (timestamps, memory info, etc.) SHOW ENGINE STATUS; diff --git a/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff index a8df852515a..d94836573a8 100644 --- a/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff +++ b/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_insert_method.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/tbl_opt_insert_method.reject 2012-07-15 16:21:56.381914337 +0400 +--- suite/storage_engine/tbl_opt_insert_method.result ++++ suite/storage_engine/tbl_opt_insert_method.reject @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff index 4fa164523db..bf30d718c56 100644 --- a/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff +++ b/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_union.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/tbl_opt_union.reject 2012-07-15 16:21:58.121892463 +0400 +--- suite/storage_engine/tbl_opt_union.result ++++ suite/storage_engine/tbl_opt_union.reject @@ -4,11 +4,11 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff index b460b5b4763..8791d9795fe 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/cons_snapshot_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/cons_snapshot_repeatable_read.reject 2013-01-23 02:44:05.336711176 +0400 +--- suite/storage_engine/trx/cons_snapshot_repeatable_read.result ++++ suite/storage_engine/trx/cons_snapshot_repeatable_read.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff index d5f1a03084e..f8c7f93b134 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/cons_snapshot_serializable.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/cons_snapshot_serializable.reject 2013-01-23 02:44:05.928703734 +0400 +--- suite/storage_engine/trx/cons_snapshot_serializable.result ++++ suite/storage_engine/trx/cons_snapshot_serializable.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff b/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff index d7111ab28fc..83b2e3d5f64 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/delete.result 2012-07-12 23:06:18.946113626 +0400 -+++ suite/storage_engine/trx/delete.reject 2012-07-15 16:55:46.108397219 +0400 +--- suite/storage_engine/trx/delete.result ++++ suite/storage_engine/trx/delete.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff b/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff index cee69633860..1fa1e8a2652 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/insert.result 2012-07-12 23:09:44.663527407 +0400 -+++ suite/storage_engine/trx/insert.reject 2012-07-15 16:55:46.676390078 +0400 +--- suite/storage_engine/trx/insert.result ++++ suite/storage_engine/trx/insert.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff index 94e3fc83e1e..54528c7c872 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_read_committed.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/level_read_committed.reject 2013-01-23 02:44:06.572695636 +0400 +--- suite/storage_engine/trx/level_read_committed.result ++++ suite/storage_engine/trx/level_read_committed.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff index 91a2786cb68..618d6b32a75 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_read_uncommitted.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/level_read_uncommitted.reject 2013-01-23 02:44:07.196687792 +0400 +--- suite/storage_engine/trx/level_read_uncommitted.result ++++ suite/storage_engine/trx/level_read_uncommitted.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff index 2c265900004..6e1ce736413 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/level_repeatable_read.reject 2013-01-23 02:44:07.776680499 +0400 +--- suite/storage_engine/trx/level_repeatable_read.result ++++ suite/storage_engine/trx/level_repeatable_read.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff index 7955036e000..b69a809bf97 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_serializable.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/level_serializable.reject 2013-01-23 02:44:08.384672856 +0400 +--- suite/storage_engine/trx/level_serializable.result ++++ suite/storage_engine/trx/level_serializable.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff b/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff index 044ce56da43..2d5e718691d 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/select_for_update.result 2012-07-13 01:26:07.612653808 +0400 -+++ suite/storage_engine/trx/select_for_update.reject 2012-07-15 16:55:49.784351006 +0400 +--- suite/storage_engine/trx/select_for_update.result ++++ suite/storage_engine/trx/select_for_update.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff b/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff index e1e8d3050e7..5600b41ad57 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/select_lock_in_share_mode.result 2012-07-13 01:30:17.505512229 +0400 -+++ suite/storage_engine/trx/select_lock_in_share_mode.reject 2012-07-15 16:55:50.444342708 +0400 +--- suite/storage_engine/trx/select_lock_in_share_mode.result ++++ suite/storage_engine/trx/select_lock_in_share_mode.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/update.rdiff b/storage/myisam/mysql-test/storage_engine/trx/update.rdiff index ca3b77e7cec..b5e5f3491c1 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/update.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/update.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/update.result 2012-07-13 01:43:50.355293322 +0400 -+++ suite/storage_engine/trx/update.reject 2012-07-15 16:55:51.016335518 +0400 +--- suite/storage_engine/trx/update.result ++++ suite/storage_engine/trx/update.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff b/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff index 73c3796b13b..4f06ba899e4 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/xa.result 2012-07-13 01:47:00.788899248 +0400 -+++ suite/storage_engine/trx/xa.reject 2012-07-15 16:55:51.604328125 +0400 +--- suite/storage_engine/trx/xa.result ++++ suite/storage_engine/trx/xa.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support XA. diff --git a/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff b/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff index 4b057019bbd..a2b7e0dab29 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/xa_recovery.result 2012-07-13 01:48:46.859565758 +0400 -+++ suite/storage_engine/trx/xa_recovery.reject 2012-07-15 16:55:53.740301272 +0400 +--- suite/storage_engine/trx/xa_recovery.result ++++ suite/storage_engine/trx/xa_recovery.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support XA. diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff index b2ec2129d04..bd1a78fbcc0 100644 --- a/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff @@ -1,5 +1,5 @@ ---- alter_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ alter_table.reject 2013-01-23 02:50:10.652118538 +0400 +--- alter_table.result ++++ alter_table.reject @@ -8,7 +8,7 @@ `a` int(11) DEFAULT NULL, `c` char(8) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_table_online.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_table_online.rdiff index 857854a6115..51779d4bbee 100644 --- a/storage/myisammrg/mysql-test/storage_engine/alter_table_online.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/alter_table_online.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/alter_table_online.result 2014-11-12 05:27:00.000000000 +0400 -+++ suite/storage_engine/alter_table_online.reject 2014-12-05 20:42:25.000000000 +0400 +--- suite/storage_engine/alter_table_online.result ++++ suite/storage_engine/alter_table_online.reject @@ -2,8 +2,35 @@ CREATE TABLE t1 (a , b , c ) ENGINE= ; INSERT INTO t1 (a,b,c) VALUES (1,100,'a'),(2,200,'b'),(3,300,'c'); diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff index e5462f8cb1f..5d51ece13bd 100644 --- a/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff @@ -1,5 +1,5 @@ ---- alter_tablespace.result 2013-01-22 22:05:05.246633000 +0400 -+++ alter_tablespace.reject 2013-01-23 02:50:11.288110543 +0400 +--- alter_tablespace.result ++++ alter_tablespace.reject @@ -1,21 +1,14 @@ DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (a ) ENGINE= ; diff --git a/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff index 9854a986cc5..ffe16e16e06 100644 --- a/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff @@ -1,5 +1,5 @@ ---- analyze_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ analyze_table.reject 2013-01-23 02:50:11.912102699 +0400 +--- analyze_table.result ++++ analyze_table.reject @@ -5,25 +5,25 @@ INSERT INTO t1 (a,b) VALUES (3,'c'); ANALYZE TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff index cc04b800793..8ad8c70d10f 100644 --- a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff @@ -1,5 +1,5 @@ ---- autoincrement.result 2013-01-22 22:05:05.246633000 +0400 -+++ autoincrement.reject 2013-01-23 02:50:12.848090932 +0400 +--- autoincrement.result ++++ autoincrement.reject @@ -6,7 +6,7 @@ `a` int(11) NOT NULL AUTO_INCREMENT, `b` char(8) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff b/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff index 612c8d38311..2606c7e5cca 100644 --- a/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff @@ -1,5 +1,5 @@ ---- cache_index.result 2013-01-22 22:05:05.246633000 +0400 -+++ cache_index.reject 2013-01-23 02:50:13.468083137 +0400 +--- cache_index.result ++++ cache_index.reject @@ -12,31 +12,31 @@ SET GLOBAL .key_buffer_size=128*1024; CACHE INDEX t1 INDEX (a), t2 IN ; diff --git a/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff b/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff index f09aec971a9..8e1daa9f6a7 100644 --- a/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff @@ -1,5 +1,5 @@ ---- checksum_table_live.result 2013-01-22 22:05:05.246633000 +0400 -+++ checksum_table_live.reject 2013-01-23 02:50:14.440070917 +0400 +--- checksum_table_live.result ++++ checksum_table_live.reject @@ -11,8 +11,8 @@ test.t1 4272806499 CHECKSUM TABLE t1, t2 QUICK; diff --git a/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff index ad6352d3e7b..f90406e9dff 100644 --- a/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff @@ -1,5 +1,5 @@ ---- create_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ create_table.reject 2013-01-23 02:50:19.544006752 +0400 +--- create_table.result ++++ create_table.reject @@ -4,7 +4,7 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff index fc07ebc0e94..4af98e0d3b4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff @@ -1,5 +1,5 @@ ---- foreign_keys.result 2013-01-22 22:05:05.246633000 +0400 -+++ foreign_keys.reject 2013-01-23 02:50:28.187898084 +0400 +--- foreign_keys.result ++++ foreign_keys.reject @@ -12,29 +12,57 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff b/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff index c96b697167c..7c63cc87df9 100644 --- a/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff @@ -1,5 +1,5 @@ ---- fulltext_search.result 2013-01-22 22:05:05.246633000 +0400 -+++ fulltext_search.reject 2013-01-23 02:50:28.807890289 +0400 +--- fulltext_search.result ++++ fulltext_search.reject @@ -4,129 +4,27 @@ v2 TEXT , FULLTEXT v1 (v1) diff --git a/storage/myisammrg/mysql-test/storage_engine/handler.rdiff b/storage/myisammrg/mysql-test/storage_engine/handler.rdiff index 9e9117e04fc..a8fdce842e4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/handler.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/handler.rdiff @@ -1,5 +1,5 @@ ---- handler.result 2013-01-22 22:05:05.246633000 +0400 -+++ handler.reject 2013-01-23 02:50:29.411882697 +0400 +--- handler.result ++++ handler.reject @@ -2,76 +2,19 @@ CREATE TABLE t1 (a , b ) ENGINE= ; INSERT INTO t1 (a,b) VALUES ('foobar',1000),('a',1),('bar',200),('foo',100); diff --git a/storage/myisammrg/mysql-test/storage_engine/index.rdiff b/storage/myisammrg/mysql-test/storage_engine/index.rdiff index bf6806979ec..f797a6f628c 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index.rdiff @@ -1,5 +1,5 @@ ---- index.result 2013-01-22 22:05:05.246633000 +0400 -+++ index.reject 2013-01-23 02:50:30.111873897 +0400 +--- index.result ++++ index.reject @@ -61,7 +61,5 @@ ALTER TABLE t1 DROP INDEX a; INSERT INTO t1 (a,b) VALUES (1,'c'); diff --git a/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff index 357d4e931d2..8a4d47fa4ad 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff @@ -1,5 +1,5 @@ ---- index_enable_disable.result 2013-01-22 22:05:05.246633000 +0400 -+++ index_enable_disable.reject 2013-01-23 02:50:30.723866202 +0400 +--- index_enable_disable.result ++++ index_enable_disable.reject @@ -11,15 +11,19 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 1 a 1 a # # NULL NULL YES BTREE diff --git a/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff index 1874b0d5891..46958642019 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff @@ -1,5 +1,5 @@ ---- index_type_btree.result 2013-01-22 22:05:05.246633000 +0400 -+++ index_type_btree.reject 2013-01-23 02:50:31.963850614 +0400 +--- index_type_btree.result ++++ index_type_btree.reject @@ -61,7 +61,5 @@ ALTER TABLE t1 DROP INDEX a; INSERT INTO t1 (a,b) VALUES (1,'c'); diff --git a/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff index f6fd1e391aa..c3d6108f9f4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff @@ -1,5 +1,5 @@ ---- index_type_hash.result 2013-01-22 22:05:05.246633000 +0400 -+++ index_type_hash.reject 2013-01-23 02:50:32.647842015 +0400 +--- index_type_hash.result ++++ index_type_hash.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff b/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff index 24ffa2ab82f..1fe06b5004e 100644 --- a/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff @@ -1,5 +1,5 @@ ---- insert_delayed.result 2013-01-23 01:23:49.461254916 +0400 -+++ insert_delayed.reject 2013-01-23 02:50:34.475819034 +0400 +--- insert_delayed.result ++++ insert_delayed.reject @@ -5,7 +5,16 @@ connect con0,localhost,root,,; SET lock_wait_timeout = 1; diff --git a/storage/myisammrg/mysql-test/storage_engine/lock.rdiff b/storage/myisammrg/mysql-test/storage_engine/lock.rdiff index f6bb75409d3..8aa52943d08 100644 --- a/storage/myisammrg/mysql-test/storage_engine/lock.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/lock.rdiff @@ -1,5 +1,5 @@ ---- lock.result 2013-01-23 01:24:01.797100027 +0400 -+++ lock.reject 2013-01-23 02:50:53.291582487 +0400 +--- lock.result ++++ lock.reject @@ -42,34 +42,67 @@ UPDATE t1 SET id=1 WHERE id=-1; DROP TABLE t1,t2; diff --git a/storage/myisammrg/mysql-test/storage_engine/misc.rdiff b/storage/myisammrg/mysql-test/storage_engine/misc.rdiff index cdbad003217..0d2f085074f 100644 --- a/storage/myisammrg/mysql-test/storage_engine/misc.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/misc.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/misc.result 2018-02-23 03:01:49.673249912 +0200 -+++ suite/storage_engine/misc.reject 2018-02-23 03:02:05.669249564 +0200 +--- suite/storage_engine/misc.result ++++ suite/storage_engine/misc.reject @@ -28,6 +28,10 @@ SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ORDER BY TABLE_NAME; diff --git a/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff index 1b611adf25a..0ef657a2d16 100644 --- a/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff @@ -1,5 +1,5 @@ ---- optimize_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ optimize_table.reject 2013-01-23 02:50:54.339569313 +0400 +--- optimize_table.result ++++ optimize_table.reject @@ -5,25 +5,25 @@ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); OPTIMIZE TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff index 4c7ba7d8232..13881adcefb 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff @@ -1,5 +1,5 @@ ---- alter_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ alter_table.reject 2013-01-23 03:16:22.620356221 +0400 +--- alter_table.result ++++ alter_table.reject @@ -1,42 +1,29 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff index 7163aaefc53..5e25afb83ea 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff @@ -1,5 +1,5 @@ ---- analyze_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ analyze_table.reject 2013-01-23 03:16:23.240348427 +0400 +--- analyze_table.result ++++ analyze_table.reject @@ -1,47 +1,62 @@ DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 (a , b ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff index 5f7b7c75713..8f55bb5e12d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff @@ -1,5 +1,5 @@ ---- check_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ check_table.reject 2013-01-23 03:16:23.872340482 +0400 +--- check_table.result ++++ check_table.reject @@ -1,104 +1,122 @@ DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (a , b ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff index 6d01f0564f2..5be01fc6d3d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff @@ -1,5 +1,5 @@ ---- checksum_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ checksum_table.reject 2013-01-23 03:16:24.496332636 +0400 +--- checksum_table.result ++++ checksum_table.reject @@ -1,40 +1,74 @@ DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 (a , b ) ENGINE= CHECKSUM=0 PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff index d6aa75f1c44..bc814a9b100 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff @@ -1,5 +1,5 @@ ---- create_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ create_table.reject 2013-01-23 03:16:25.160324290 +0400 +--- create_table.result ++++ create_table.reject @@ -1,91 +1,79 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff index 2e2a1fecb8f..e6e646212bc 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff @@ -1,5 +1,5 @@ ---- optimize_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ optimize_table.reject 2013-01-23 03:16:25.780316495 +0400 +--- optimize_table.result ++++ optimize_table.reject @@ -1,54 +1,62 @@ DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 (a , b ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff index eddb6872ec3..4e7f0ab2fed 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/parts/repair_table.result 2017-08-28 19:29:20.491633306 +0300 -+++ suite/storage_engine/parts/repair_table.reject 2017-08-28 19:34:41.723633059 +0300 +--- suite/storage_engine/parts/repair_table.result ++++ suite/storage_engine/parts/repair_table.reject @@ -1,232 +1,116 @@ call mtr.add_suppression("Table '.*t1.*' is marked as crashed and should be repaired"); DROP TABLE IF EXISTS t1, t2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff index 9ba985f7adc..cec7083f4ff 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff @@ -1,5 +1,5 @@ ---- truncate_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ truncate_table.reject 2013-01-23 03:16:27.076300201 +0400 +--- truncate_table.result ++++ truncate_table.reject @@ -1,68 +1,34 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a , b ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff index d6c46b8c5b8..db5b8566b5d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/repair_table.result 2017-05-24 01:09:07.274213486 +0300 -+++ suite/storage_engine/repair_table.reject 2017-05-24 01:10:25.466214949 +0300 +--- suite/storage_engine/repair_table.result ++++ suite/storage_engine/repair_table.reject @@ -4,56 +4,50 @@ CREATE TABLE t2 (a , b ) ENGINE= ; REPAIR TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff b/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff index e78e6fdad53..3c7332e1330 100644 --- a/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff @@ -1,5 +1,5 @@ ---- show_engine.result 2013-01-22 22:05:05.246633000 +0400 -+++ show_engine.reject 2013-01-23 02:50:56.871537482 +0400 +--- show_engine.result ++++ show_engine.reject @@ -4,7 +4,6 @@ # volatile data (timestamps, memory info, etc.) SHOW ENGINE STATUS; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff index 4de7e81ffba..809bce6c3f3 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_ai.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_ai.reject 2013-01-23 02:50:57.547528984 +0400 +--- tbl_opt_ai.result ++++ tbl_opt_ai.reject @@ -4,11 +4,11 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff index 2632fabf89d..91b72a901c1 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_avg_row_length.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_avg_row_length.reject 2013-01-23 02:50:58.123521742 +0400 +--- tbl_opt_avg_row_length.result ++++ tbl_opt_avg_row_length.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff index baad32dd4db..a471a1ce388 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_checksum.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_checksum.reject 2013-01-23 02:50:58.739513998 +0400 +--- tbl_opt_checksum.result ++++ tbl_opt_checksum.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff index 3dc06fb2704..b08d922bab6 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_connection.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_connection.reject 2013-01-23 02:50:59.335506506 +0400 +--- tbl_opt_connection.result ++++ tbl_opt_connection.reject @@ -10,14 +10,14 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.rdiff index 671e26ec617..f4b1c89ec0b 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_data_dir.result 2017-05-24 00:21:15.550159778 +0300 -+++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.reject 2017-05-24 00:25:45.506164827 +0300 +--- suite/storage_engine/tbl_opt_data_dir.result ++++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.reject @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff index 2c2e40fa4b7..95e0ee1015d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_delay_key_write.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_delay_key_write.reject 2013-01-23 02:51:00.591490716 +0400 +--- tbl_opt_delay_key_write.result ++++ tbl_opt_delay_key_write.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.rdiff index ca025861f68..bd078ef7350 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_index_dir.result 2017-05-24 00:21:15.550159778 +0300 -+++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.reject 2017-05-24 00:25:45.506164827 +0300 +--- suite/storage_engine/tbl_opt_index_dir.result ++++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.reject @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff index f5dc536c7ee..2de1e5d1ad4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_insert_method.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_insert_method.reject 2013-01-23 02:51:01.211482922 +0400 +--- tbl_opt_insert_method.result ++++ tbl_opt_insert_method.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff index be90252f0b9..09370d12146 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_key_block_size.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_key_block_size.reject 2013-01-23 02:51:01.787475681 +0400 +--- tbl_opt_key_block_size.result ++++ tbl_opt_key_block_size.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff index 3eebf8cce9b..ae71f158a57 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_max_rows.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_max_rows.reject 2013-01-23 02:51:02.403467936 +0400 +--- tbl_opt_max_rows.result ++++ tbl_opt_max_rows.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff index 48c7124ca36..805a6f7d4d1 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_min_rows.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_min_rows.reject 2013-01-23 02:51:02.983460644 +0400 +--- tbl_opt_min_rows.result ++++ tbl_opt_min_rows.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff index ab16cbcb0dc..9318c4875f3 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_pack_keys.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_pack_keys.reject 2013-01-23 02:51:03.563453353 +0400 +--- tbl_opt_pack_keys.result ++++ tbl_opt_pack_keys.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff index dc8303682db..6ba898f2cd6 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_password.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_password.reject 2013-01-23 02:51:04.155445910 +0400 +--- tbl_opt_password.result ++++ tbl_opt_password.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff index 6c756e7b8e1..1d5e5e43796 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff @@ -1,5 +1,5 @@ ---- ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.result~ 2017-05-24 00:50:44.254192857 +0300 -+++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.reject 2017-05-24 00:50:44.334192859 +0300 +--- ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.result~ ++++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.reject @@ -5,26 +5,26 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff index e4e098a1b94..0a286b2863d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_union.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_union.reject 2013-01-23 02:51:05.375430573 +0400 +--- tbl_opt_union.result ++++ tbl_opt_union.reject @@ -4,11 +4,11 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff index a929b6df54b..3b238fc815c 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff @@ -1,5 +1,5 @@ ---- tbl_standard_opts.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_standard_opts.reject 2013-01-23 02:51:05.991422829 +0400 +--- tbl_standard_opts.result ++++ tbl_standard_opts.reject @@ -8,14 +8,14 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff index d2c7d4f2836..0b1882587e6 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff @@ -1,5 +1,5 @@ ---- tbl_temporary.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_temporary.reject 2013-01-23 02:51:06.599415185 +0400 +--- tbl_temporary.result ++++ tbl_temporary.reject @@ -6,6 +6,6 @@ t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff index e429bbdb177..0823239ecbe 100644 --- a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff @@ -1,5 +1,5 @@ ---- truncate_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ truncate_table.reject 2013-01-23 02:51:07.507403770 +0400 +--- truncate_table.result ++++ truncate_table.reject @@ -9,19 +9,19 @@ CREATE TABLE t1 (a KEY AUTO_INCREMENT, c ) ENGINE= ; SHOW TABLE STATUS LIKE 't1'; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff index 94cfa74f384..45da1550e33 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff @@ -1,5 +1,5 @@ ---- cons_snapshot_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 -+++ cons_snapshot_repeatable_read.reject 2013-01-23 03:22:34.255684132 +0400 +--- cons_snapshot_repeatable_read.result ++++ cons_snapshot_repeatable_read.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff index a9b9ba7f94b..df602ce2970 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff @@ -1,5 +1,5 @@ ---- cons_snapshot_serializable.result 2013-01-22 22:05:05.246633000 +0400 -+++ cons_snapshot_serializable.reject 2013-01-23 03:22:34.847676690 +0400 +--- cons_snapshot_serializable.result ++++ cons_snapshot_serializable.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff index e4249478c76..8f7801f7b98 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff @@ -1,5 +1,5 @@ ---- delete.result 2013-01-22 22:05:05.246633000 +0400 -+++ delete.reject 2013-01-23 03:22:35.419669500 +0400 +--- delete.result ++++ delete.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff index d5e99b6d7dc..59c7c73e189 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff @@ -1,5 +1,5 @@ ---- insert.result 2013-01-22 22:05:05.246633000 +0400 -+++ insert.reject 2013-01-23 03:22:35.987662359 +0400 +--- insert.result ++++ insert.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff index 9e7c340c524..a0f9a74ece7 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -1,5 +1,5 @@ ---- level_read_committed.result 2013-01-22 22:05:05.246633000 +0400 -+++ level_read_committed.reject 2013-01-23 03:22:36.603654615 +0400 +--- level_read_committed.result ++++ level_read_committed.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff index d44e4aa7a12..d2d6b261eef 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff @@ -1,5 +1,5 @@ ---- level_read_uncommitted.result 2013-01-22 22:05:05.246633000 +0400 -+++ level_read_uncommitted.reject 2013-01-23 03:22:37.263646318 +0400 +--- level_read_uncommitted.result ++++ level_read_uncommitted.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff index b24376a9c28..e049c56f67c 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff @@ -1,5 +1,5 @@ ---- level_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 -+++ level_repeatable_read.reject 2013-01-23 03:22:37.867638724 +0400 +--- level_repeatable_read.result ++++ level_repeatable_read.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff index 3567e718459..56953a3bf6d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff @@ -1,5 +1,5 @@ ---- level_serializable.result 2013-01-22 22:05:05.246633000 +0400 -+++ level_serializable.reject 2013-01-23 03:22:38.471631132 +0400 +--- level_serializable.result ++++ level_serializable.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff index bad014d87ed..a29686bc851 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff @@ -1,5 +1,5 @@ ---- select_for_update.result 2013-01-22 22:05:05.246633000 +0400 -+++ select_for_update.reject 2013-01-23 03:22:39.123622935 +0400 +--- select_for_update.result ++++ select_for_update.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff index db3eec1bc24..2db37c985a4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff @@ -1,5 +1,5 @@ ---- select_lock_in_share_mode.result 2013-01-22 22:05:05.246633000 +0400 -+++ select_lock_in_share_mode.reject 2013-01-23 03:22:39.739615191 +0400 +--- select_lock_in_share_mode.result ++++ select_lock_in_share_mode.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff index baac054766b..b0a589c8fd1 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff @@ -1,5 +1,5 @@ ---- update.result 2013-01-22 22:05:05.246633000 +0400 -+++ update.reject 2013-01-23 03:22:40.355607446 +0400 +--- update.result ++++ update.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff index a491287337d..1f6e2b9e24f 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff @@ -1,5 +1,5 @@ ---- xa.result 2013-01-22 22:05:05.246633000 +0400 -+++ xa.reject 2013-01-23 03:22:41.047598747 +0400 +--- xa.result ++++ xa.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support XA. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff index fa920abefc8..51964b6c32b 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff @@ -1,5 +1,5 @@ ---- xa_recovery.result 2013-01-22 22:05:05.246633000 +0400 -+++ xa_recovery.reject 2013-01-23 03:22:43.247571090 +0400 +--- xa_recovery.result ++++ xa_recovery.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support XA. diff --git a/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff index 78c47ded0c9..72f86c2af50 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_char_indexes.result 2014-10-12 14:22:11.000000000 +0400 -+++ suite/storage_engine/type_char_indexes.reject 2014-10-12 14:22:41.000000000 +0400 +--- suite/storage_engine/type_char_indexes.result ++++ suite/storage_engine/type_char_indexes.reject @@ -137,7 +137,7 @@ r3a EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; diff --git a/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff index eb4da4db951..053136f7b9f 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff @@ -1,5 +1,5 @@ ---- type_float_indexes.result 2013-01-22 22:05:05.246633000 +0400 -+++ type_float_indexes.reject 2013-01-23 02:51:13.059333973 +0400 +--- type_float_indexes.result ++++ type_float_indexes.reject @@ -60,7 +60,7 @@ ALTER TABLE t1 ADD UNIQUE KEY(d); EXPLAIN SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d; diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff index 6f337ffb638..99bc91cc3b8 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_spatial.result 2013-08-05 17:52:53.000000000 +0400 -+++ suite/storage_engine/type_spatial.reject 2013-08-05 17:56:37.000000000 +0400 +--- suite/storage_engine/type_spatial.result ++++ suite/storage_engine/type_spatial.reject @@ -2,699 +2,15 @@ DROP DATABASE IF EXISTS gis_ogs; CREATE DATABASE gis_ogs; diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff index 04c56979244..3d5ae37b840 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_spatial_indexes.result 2013-08-05 18:08:49.000000000 +0400 -+++ suite/storage_engine/type_spatial_indexes.reject 2013-08-05 18:27:47.000000000 +0400 +--- suite/storage_engine/type_spatial_indexes.result ++++ suite/storage_engine/type_spatial_indexes.reject @@ -2,1399 +2,31 @@ DROP DATABASE IF EXISTS gis_ogs; CREATE DATABASE gis_ogs; diff --git a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff index 6c4971c63be..cc1218f43e3 100644 --- a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff @@ -1,5 +1,5 @@ ---- vcol.result 2013-01-22 22:05:05.246633000 +0400 -+++ vcol.reject 2013-01-23 02:51:26.851160587 +0400 +--- vcol.result ++++ vcol.reject @@ -1,69 +1,12 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a , b GENERATED ALWAYS AS (a+1)) ENGINE= ; diff --git a/storage/rocksdb/mysql-test/storage_engine/cache_index.rdiff b/storage/rocksdb/mysql-test/storage_engine/cache_index.rdiff index 76e7705e377..1151a95d1f8 100644 --- a/storage/rocksdb/mysql-test/storage_engine/cache_index.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/cache_index.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/cache_index.result 2017-06-22 00:33:46.419995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/cache_index.reject 2017-06-22 01:11:22.479981459 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/cache_index.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/cache_index.reject @@ -12,31 +12,31 @@ SET GLOBAL .key_buffer_size=128*1024; CACHE INDEX t1 INDEX (a), t2 IN ; diff --git a/storage/rocksdb/mysql-test/storage_engine/checksum_table_live.rdiff b/storage/rocksdb/mysql-test/storage_engine/checksum_table_live.rdiff index 094136ee926..d0b35c939bd 100644 --- a/storage/rocksdb/mysql-test/storage_engine/checksum_table_live.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/checksum_table_live.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/checksum_table_live.result 2017-06-22 00:33:46.419995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/checksum_table_live.reject 2017-06-22 01:12:38.695980980 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/checksum_table_live.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/checksum_table_live.reject @@ -11,8 +11,8 @@ test.t1 4272806499 CHECKSUM TABLE t1, t2 QUICK; diff --git a/storage/rocksdb/mysql-test/storage_engine/index.rdiff b/storage/rocksdb/mysql-test/storage_engine/index.rdiff index 76d6c6dd8e4..d8cd56e9d70 100644 --- a/storage/rocksdb/mysql-test/storage_engine/index.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/index.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index.result 2017-03-12 04:57:07.169911845 +0200 -+++ suite/storage_engine/index.reject 2017-08-14 22:41:06.548555663 +0300 +--- suite/storage_engine/index.result ++++ suite/storage_engine/index.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/rocksdb/mysql-test/storage_engine/index_type_btree.rdiff b/storage/rocksdb/mysql-test/storage_engine/index_type_btree.rdiff index 5fcffbea13b..08cb76dbb7a 100644 --- a/storage/rocksdb/mysql-test/storage_engine/index_type_btree.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/index_type_btree.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index_type_btree.result 2017-03-12 04:57:07.169911845 +0200 -+++ suite/storage_engine/index_type_btree.reject 2017-08-14 22:50:47.264555216 +0300 +--- suite/storage_engine/index_type_btree.result ++++ suite/storage_engine/index_type_btree.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/rocksdb/mysql-test/storage_engine/index_type_hash.rdiff b/storage/rocksdb/mysql-test/storage_engine/index_type_hash.rdiff index 815b2983b87..709c8e42632 100644 --- a/storage/rocksdb/mysql-test/storage_engine/index_type_hash.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/index_type_hash.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index_type_hash.result 2017-03-12 04:57:07.169911845 +0200 -+++ suite/storage_engine/index_type_hash.reject 2017-08-14 22:51:55.644555163 +0300 +--- suite/storage_engine/index_type_hash.result ++++ suite/storage_engine/index_type_hash.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/rocksdb/mysql-test/storage_engine/misc.rdiff b/storage/rocksdb/mysql-test/storage_engine/misc.rdiff index cdbad003217..0d2f085074f 100644 --- a/storage/rocksdb/mysql-test/storage_engine/misc.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/misc.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/misc.result 2018-02-23 03:01:49.673249912 +0200 -+++ suite/storage_engine/misc.reject 2018-02-23 03:02:05.669249564 +0200 +--- suite/storage_engine/misc.result ++++ suite/storage_engine/misc.reject @@ -28,6 +28,10 @@ SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ORDER BY TABLE_NAME; diff --git a/storage/rocksdb/mysql-test/storage_engine/parts/checksum_table.rdiff b/storage/rocksdb/mysql-test/storage_engine/parts/checksum_table.rdiff index bf3347a4341..62b4c77306a 100644 --- a/storage/rocksdb/mysql-test/storage_engine/parts/checksum_table.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/parts/checksum_table.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/checksum_table.result 2017-06-22 00:33:46.419995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/checksum_table.reject 2017-06-22 19:25:02.935568998 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/checksum_table.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/checksum_table.reject @@ -31,8 +31,8 @@ test.t1 4272806499 CHECKSUM TABLE t1, t2 QUICK; diff --git a/storage/rocksdb/mysql-test/storage_engine/parts/create_table.rdiff b/storage/rocksdb/mysql-test/storage_engine/parts/create_table.rdiff index b2cb47a0927..9c46bece70e 100644 --- a/storage/rocksdb/mysql-test/storage_engine/parts/create_table.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/parts/create_table.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/create_table.result 2017-06-22 00:33:46.419995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/create_table.reject 2017-06-22 19:25:05.335568983 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/create_table.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/create_table.reject @@ -65,7 +65,7 @@ 1 SIMPLE t1 abc,def # # # # # # # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100; diff --git a/storage/rocksdb/mysql-test/storage_engine/show_engine.rdiff b/storage/rocksdb/mysql-test/storage_engine/show_engine.rdiff index 15a9bb6f171..869be38fa6e 100644 --- a/storage/rocksdb/mysql-test/storage_engine/show_engine.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/show_engine.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/show_engine.result 2017-03-12 04:57:07.169911845 +0200 -+++ suite/storage_engine/show_engine.reject 2017-08-14 22:58:15.508554871 +0300 +--- suite/storage_engine/show_engine.result ++++ suite/storage_engine/show_engine.reject @@ -4,7 +4,11 @@ # volatile data (timestamps, memory info, etc.) SHOW ENGINE STATUS; diff --git a/storage/rocksdb/mysql-test/storage_engine/show_table_status.rdiff b/storage/rocksdb/mysql-test/storage_engine/show_table_status.rdiff index d7252eb54ed..7f78b3bfda2 100644 --- a/storage/rocksdb/mysql-test/storage_engine/show_table_status.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/show_table_status.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/show_table_status.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/show_table_status.reject 2017-06-22 14:04:10.723690009 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/show_table_status.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/show_table_status.reject @@ -19,7 +19,7 @@ Create_time ### Update_time ### diff --git a/storage/rocksdb/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/rocksdb/mysql-test/storage_engine/tbl_opt_insert_method.rdiff index 20f594fbb40..f2a5c24857b 100644 --- a/storage/rocksdb/mysql-test/storage_engine/tbl_opt_insert_method.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/tbl_opt_insert_method.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_insert_method.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_insert_method.reject 2017-06-22 02:39:45.243948128 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_insert_method.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_insert_method.reject @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/rocksdb/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/rocksdb/mysql-test/storage_engine/tbl_opt_union.rdiff index 0d65ad0744a..04ff062fa41 100644 --- a/storage/rocksdb/mysql-test/storage_engine/tbl_opt_union.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/tbl_opt_union.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_union.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_union.reject 2017-06-22 02:41:02.719947641 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_union.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_union.reject @@ -4,11 +4,11 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/rocksdb/mysql-test/storage_engine/tbl_temporary.rdiff b/storage/rocksdb/mysql-test/storage_engine/tbl_temporary.rdiff index d24806e7c9f..34a2161a891 100644 --- a/storage/rocksdb/mysql-test/storage_engine/tbl_temporary.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/tbl_temporary.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_temporary.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_temporary.reject 2017-06-22 15:27:50.643658456 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_temporary.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_temporary.reject @@ -1,11 +1,14 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c CHAR(1)) ENGINE=MyISAM; diff --git a/storage/rocksdb/mysql-test/storage_engine/truncate_table.rdiff b/storage/rocksdb/mysql-test/storage_engine/truncate_table.rdiff index 9ca7861d51e..1ebdeb1d30b 100644 --- a/storage/rocksdb/mysql-test/storage_engine/truncate_table.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/truncate_table.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/truncate_table.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/truncate_table.reject 2017-06-22 02:43:27.183946733 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/truncate_table.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/truncate_table.reject @@ -29,13 +29,12 @@ CREATE TABLE t1 (a , b ) ENGINE= ; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'); diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/delete.rdiff b/storage/rocksdb/mysql-test/storage_engine/trx/delete.rdiff index dac23b83579..7e9f7fd8ce8 100644 --- a/storage/rocksdb/mysql-test/storage_engine/trx/delete.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/trx/delete.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/delete.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/delete.reject 2017-06-22 19:29:36.827567276 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/delete.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/delete.reject @@ -68,5 +68,7 @@ DELETE FROM t1; INSERT INTO t1 (a,b) VALUES (1,'a'); diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/insert.rdiff b/storage/rocksdb/mysql-test/storage_engine/trx/insert.rdiff index 36a71076a2b..532bb1f4c7b 100644 --- a/storage/rocksdb/mysql-test/storage_engine/trx/insert.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/trx/insert.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/insert.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/insert.reject 2017-06-22 19:29:39.131567262 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/insert.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/insert.reject @@ -37,18 +37,18 @@ INSERT INTO t1 SET a = 11, b = 'f'; INSERT t1 SET b = DEFAULT; diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/rocksdb/mysql-test/storage_engine/trx/level_read_committed.rdiff index 6b9e4a3f4e9..c847dcaae70 100644 --- a/storage/rocksdb/mysql-test/storage_engine/trx/level_read_committed.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_read_committed.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_read_committed.reject 2017-06-22 19:29:41.459567247 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_read_committed.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_read_committed.reject @@ -77,6 +77,7 @@ CREATE TABLE t1 (a ) ENGINE= ; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/rocksdb/mysql-test/storage_engine/trx/level_repeatable_read.rdiff index cf770755243..e5e300d7d87 100644 --- a/storage/rocksdb/mysql-test/storage_engine/trx/level_repeatable_read.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/trx/level_repeatable_read.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_repeatable_read.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_repeatable_read.reject 2017-06-22 20:33:13.935543284 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_repeatable_read.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_repeatable_read.reject @@ -24,8 +24,7 @@ SELECT a FROM t1; a diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/update.rdiff b/storage/rocksdb/mysql-test/storage_engine/trx/update.rdiff index ab181947733..1430782b491 100644 --- a/storage/rocksdb/mysql-test/storage_engine/trx/update.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/trx/update.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/update.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/update.reject 2017-06-22 19:29:57.267567148 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/update.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/update.reject @@ -29,20 +29,23 @@ SAVEPOINT spt1; UPDATE t1 SET b = ''; diff --git a/storage/rocksdb/mysql-test/storage_engine/type_binary_indexes.rdiff b/storage/rocksdb/mysql-test/storage_engine/type_binary_indexes.rdiff index 5eec9d24250..55c269374bb 100644 --- a/storage/rocksdb/mysql-test/storage_engine/type_binary_indexes.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/type_binary_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_binary_indexes.result 2017-03-12 04:57:07.173911845 +0200 -+++ suite/storage_engine/type_binary_indexes.reject 2017-08-14 22:54:02.144555066 +0300 +--- suite/storage_engine/type_binary_indexes.result ++++ suite/storage_engine/type_binary_indexes.reject @@ -91,7 +91,7 @@ INSERT INTO t1 (b,b20,v16,v128) SELECT b,b20,v16,v128 FROM t1; EXPLAIN SELECT HEX(SUBSTRING(v16,0,3)) FROM t1 WHERE v16 LIKE 'varchar%'; diff --git a/storage/rocksdb/mysql-test/storage_engine/type_bit_indexes.rdiff b/storage/rocksdb/mysql-test/storage_engine/type_bit_indexes.rdiff index e53a33b4fba..5825ca2731c 100644 --- a/storage/rocksdb/mysql-test/storage_engine/type_bit_indexes.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/type_bit_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_bit_indexes.result 2017-12-12 20:34:34.000000000 +0200 -+++ suite/storage_engine/type_bit_indexes.reject 2017-12-12 20:35:24.539330056 +0200 +--- suite/storage_engine/type_bit_indexes.result ++++ suite/storage_engine/type_bit_indexes.reject @@ -69,7 +69,7 @@ (1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF); EXPLAIN SELECT HEX(b+c) FROM t1 WHERE c > 1 OR HEX(b) < 0xFFFFFF; diff --git a/storage/rocksdb/mysql-test/storage_engine/type_enum_indexes.rdiff b/storage/rocksdb/mysql-test/storage_engine/type_enum_indexes.rdiff index be83fb6e212..bd6290ae112 100644 --- a/storage/rocksdb/mysql-test/storage_engine/type_enum_indexes.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/type_enum_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_enum_indexes.result 2017-03-12 04:38:50.000000000 +0200 -+++ suite/storage_engine/type_enum_indexes.reject 2017-12-12 20:36:47.455331726 +0200 +--- suite/storage_engine/type_enum_indexes.result ++++ suite/storage_engine/type_enum_indexes.reject @@ -30,7 +30,7 @@ t1 0 a_b 2 b # # NULL NULL # # EXPLAIN SELECT a FROM t1 WHERE b > 'test2' ORDER BY a; diff --git a/storage/rocksdb/mysql-test/storage_engine/type_set_indexes.rdiff b/storage/rocksdb/mysql-test/storage_engine/type_set_indexes.rdiff index 2703e81b745..1608f617c75 100644 --- a/storage/rocksdb/mysql-test/storage_engine/type_set_indexes.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/type_set_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_set_indexes.result 2017-03-12 04:38:50.000000000 +0200 -+++ suite/storage_engine/type_set_indexes.reject 2017-12-12 20:37:16.187332305 +0200 +--- suite/storage_engine/type_set_indexes.result ++++ suite/storage_engine/type_set_indexes.reject @@ -97,7 +97,7 @@ Warning 1265 Data truncated for column 'b' at row 7 EXPLAIN SELECT a FROM t1 WHERE FIND_IN_SET('Europe',a) > 0; diff --git a/storage/spider/mysql-test/spider/r/alter_server.result b/storage/spider/mysql-test/spider/r/alter_server.result new file mode 100644 index 00000000000..01d28764ed7 --- /dev/null +++ b/storage/spider/mysql-test/spider/r/alter_server.result @@ -0,0 +1,31 @@ +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +select Socket from mysql.servers where Server_name = "srv"; +Socket +/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock +create table t2 (c int); +alter SERVER srv OPTIONS (DATABASE 'test'); +create table t1 (c int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +Warnings: +Warning 138 Spider table params in COMMENT or CONNECTION strings have been deprecated and will be removed in a future release. Please use table options instead. +insert into t1 values (1), (2), (3); +select * from t1; +c +1 +2 +3 +select * from t2; +c +1 +2 +3 +drop table t1, t2; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/t/alter_server.cnf b/storage/spider/mysql-test/spider/t/alter_server.cnf new file mode 100644 index 00000000000..69672af4ef6 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/alter_server.cnf @@ -0,0 +1,5 @@ +[mysqld.1.1] +socket= /tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock + +[ENV] +MASTER_1_MYSOCK= @mysqld.1.1.socket diff --git a/storage/spider/mysql-test/spider/t/alter_server.test b/storage/spider/mysql-test/spider/t/alter_server.test new file mode 100644 index 00000000000..10228e785cb --- /dev/null +++ b/storage/spider/mysql-test/spider/t/alter_server.test @@ -0,0 +1,27 @@ +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log +set spider_same_server_link= 1; + +# Test long socket length +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +select Socket from mysql.servers where Server_name = "srv"; +create table t2 (c int); +# triggers a table read into the server object +alter SERVER srv OPTIONS (DATABASE 'test'); +create table t1 (c int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 values (1), (2), (3); +select * from t1; +select * from t2; +drop table t1, t2; +drop server srv; + +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 95ac1d50e81..f7cbb507e35 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -894,6 +894,27 @@ int my_fprintf(FILE *stream, const char* format, ...) } +#ifdef __APPLE__ +/* Delete the ':' character added by Apple's implementation of strerror_r */ +static void delete_colon_char(char *buf) +{ + static const char *unknown_err= "Unknown error"; + static const size_t unknown_err_len= 13; + char *ptr= strstr(buf, unknown_err); + char *src= NULL; + if (ptr) { + ptr+= unknown_err_len; + if (*ptr == ':') { + // just overwrite the colon by shifting everything down by one, + // e.g. "Unknown error: 1000" becomes "Unknown error 1000" + src= ptr + 1; + memmove(ptr, src, strlen(src) + 1); // include null + } + } +} +#endif + + /* Return system error text for given error number @@ -947,6 +968,10 @@ const char* my_strerror(char *buf, size_t len, int nr) #else strerror_r(nr, buf, len); #endif + +#ifdef __APPLE__ + delete_colon_char(buf); +#endif } /* diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 7514823ffa8..71ab024a43c 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -22506,6 +22506,129 @@ static void test_mdev_34718_ad() rc= mysql_query(mysql, "DROP TABLE t1, t2"); myquery(rc); } + +/* Test case for bulk INSERT in presence of AFTER INSERT trigger */ +static void test_mdev_34958() +{ + int rc; + MYSQL_STMT *stmt_insert; + MYSQL_BIND bind[2]; + MYSQL_RES *result; + MYSQL_ROW row; + my_ulonglong row_count; + unsigned int vals[] = { 1, 2, 3}; + unsigned int vals_array_len = 3; + const char *insert_stmt= "INSERT INTO t1 VALUES (?)"; + + /* Set up test's environment */ + rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TABLE t2 (a INT)"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TRIGGER t1_ai AFTER INSERT ON t1 " + "FOR EACH ROW INSERT INTO t2 VALUES (NEW.a);"); + + stmt_insert = mysql_stmt_init(mysql); + if (!stmt_insert) + { + fprintf(stderr, "mysql_stmt_init failed: Error: %s\n", + mysql_error(mysql)); + exit(1); + } + + rc= mysql_stmt_prepare(stmt_insert, insert_stmt, strlen(insert_stmt)); + if (rc) + { + fprintf(stderr, "mysql_stmt_prepare failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + memset(&bind[0], 0, sizeof(MYSQL_BIND)); + + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= vals; + + rc= mysql_stmt_attr_set(stmt_insert, STMT_ATTR_ARRAY_SIZE, &vals_array_len); + if (rc) + { + fprintf(stderr, "mysql_stmt_prepare failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + rc= mysql_stmt_bind_param(stmt_insert, bind); + if (rc) + { + fprintf(stderr, "mysql_stmt_bind_param failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + rc= mysql_stmt_execute(stmt_insert); + if (rc) + { + fprintf(stderr, "mysql_stmt_execute failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + /* + It's expected that the INSERT statement adds three rows into + the table t1 + */ + row_count = mysql_stmt_affected_rows(stmt_insert); + if (row_count != 3) + { + fprintf(stderr, "Wrong number of affected rows (%llu), expected 3\n", + row_count); + exit(1); + } + + /* + * Check that the AFTER INSERT trigger of the table t1 does work correct + * and inserted the rows (1), (2), (3) into the table t2. + */ + rc= mysql_query(mysql, "SELECT 't1' tname, a FROM t1 " + "UNION SELECT 't2' tname, a FROM t2 ORDER BY tname, a"); + if (rc) + { + fprintf(stderr, "Query failed: %s\n", mysql_error(mysql)); + } + + result= mysql_store_result(mysql); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 1); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 2); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 3); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 1); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 2); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 3); + + row= mysql_fetch_row(result); + DIE_UNLESS(row == NULL); + + mysql_free_result(result); + + mysql_stmt_close(stmt_insert); + + /* Clean up */ + rc= mysql_query(mysql, "DROP TABLE t1, t2"); + myquery(rc); +} #endif // EMBEDDED_LIBRARY /* @@ -23080,6 +23203,7 @@ static struct my_tests_st my_tests[]= { { "test_mdev_34718_au", test_mdev_34718_au }, { "test_mdev_34718_bd", test_mdev_34718_bd }, { "test_mdev_34718_ad", test_mdev_34718_ad }, + { "test_mdev_34958", test_mdev_34958 }, #endif { "test_mdev_10075", test_mdev_10075}, { 0, 0 } diff --git a/tests/thread_test.c b/tests/thread_test.c index 8242811c744..1c9df416ea9 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -70,7 +70,6 @@ end: thread_count--; pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */ pthread_mutex_unlock(&LOCK_thread_count); - pthread_exit(0); return 0; } diff --git a/tpool/aio_linux.cc b/tpool/aio_linux.cc index 507c6b9264f..0955a6dded4 100644 --- a/tpool/aio_linux.cc +++ b/tpool/aio_linux.cc @@ -99,6 +99,7 @@ class aio_linux final : public aio */ constexpr unsigned MAX_EVENTS= 256; + aio->m_pool->m_worker_init_callback(); io_event events[MAX_EVENTS]; for (;;) { @@ -107,14 +108,14 @@ class aio_linux final : public aio continue; case -EINVAL: if (shutdown_in_progress) - return; + goto end; /* fall through */ default: if (ret < 0) { fprintf(stderr, "io_getevents returned %d\n", ret); abort(); - return; + goto end; } for (int i= 0; i < ret; i++) { @@ -138,6 +139,8 @@ class aio_linux final : public aio } } } +end: + aio->m_pool->m_worker_destroy_callback(); } public: diff --git a/tpool/aio_win.cc b/tpool/aio_win.cc index eec37383152..f483e3ca1e1 100644 --- a/tpool/aio_win.cc +++ b/tpool/aio_win.cc @@ -92,7 +92,9 @@ public: static void aio_completion_thread_proc(tpool_generic_win_aio* aio) { + aio->m_pool->m_worker_init_callback(); aio->completion_thread_work(); + aio->m_pool->m_worker_destroy_callback(); } ~tpool_generic_win_aio() diff --git a/tpool/tpool.h b/tpool/tpool.h index c906500ed86..b33317572e5 100644 --- a/tpool/tpool.h +++ b/tpool/tpool.h @@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ #define NOMINMAX #endif #include +#include + /** Windows-specific native file handle struct. Apart from the actual handle, contains PTP_IO @@ -207,21 +209,24 @@ protected: std::unique_ptr m_aio; virtual aio *create_native_aio(int max_io)= 0; +public: /** Functions to be called at worker thread start/end can be used for example to set some TLS variables */ - void (*m_worker_init_callback)(void); - void (*m_worker_destroy_callback)(void); + void (*m_worker_init_callback)(void)= [] {}; + void (*m_worker_destroy_callback)(void)= [] {}; -public: - thread_pool() : m_aio(), m_worker_init_callback(), m_worker_destroy_callback() + thread_pool() + : m_aio() { } virtual void submit_task(task *t)= 0; virtual timer* create_timer(callback_func func, void *data=nullptr) = 0; void set_thread_callbacks(void (*init)(), void (*destroy)()) { + assert(init); + assert(destroy); m_worker_init_callback= init; m_worker_destroy_callback= destroy; } diff --git a/tpool/tpool_generic.cc b/tpool/tpool_generic.cc index 55a7f55bf7d..c86fcf277cf 100644 --- a/tpool/tpool_generic.cc +++ b/tpool/tpool_generic.cc @@ -564,8 +564,7 @@ void thread_pool_generic::worker_main(worker_data *thread_var) { task* task; set_tls_pool(this); - if(m_worker_init_callback) - m_worker_init_callback(); + m_worker_init_callback(); tls_worker_data = thread_var; m_thread_creation_pending.clear(); @@ -575,8 +574,7 @@ void thread_pool_generic::worker_main(worker_data *thread_var) task->execute(); } - if (m_worker_destroy_callback) - m_worker_destroy_callback(); + m_worker_destroy_callback(); worker_end(thread_var); } diff --git a/tpool/tpool_win.cc b/tpool/tpool_win.cc index 4e119332dd1..30867b8885c 100644 --- a/tpool/tpool_win.cc +++ b/tpool/tpool_win.cc @@ -45,9 +45,7 @@ class thread_pool_win : public thread_pool if (!m_pool) return; - if (m_pool->m_worker_destroy_callback) - m_pool->m_worker_destroy_callback(); - + m_pool->m_worker_destroy_callback(); m_pool->m_thread_count--; } /** This needs to be called before every IO or simple task callback.*/ @@ -63,8 +61,7 @@ class thread_pool_win : public thread_pool m_pool = pool; m_pool->m_thread_count++; // Call the thread init function. - if (m_pool->m_worker_init_callback) - m_pool->m_worker_init_callback(); + m_pool->m_worker_init_callback(); } }; diff --git a/unittest/json_lib/json_normalize-t.c b/unittest/json_lib/json_normalize-t.c index f72e90175e2..646e74af3e2 100644 --- a/unittest/json_lib/json_normalize-t.c +++ b/unittest/json_lib/json_normalize-t.c @@ -241,8 +241,10 @@ check_number_normalize(const char *in, const char *expected) int -main(void) +main(int argc, char** argv) { + MY_INIT(argv[0]); + plan(88); diag("Testing json_normalization."); @@ -276,5 +278,6 @@ main(void) test_json_normalize_nested_deep(); test_json_normalize_non_utf8(); + my_end(MY_CHECK_ERROR); return exit_status(); } diff --git a/unittest/mysys/dynstring-t.c b/unittest/mysys/dynstring-t.c index 194d435dfff..32a6b2a50e3 100644 --- a/unittest/mysys/dynstring-t.c +++ b/unittest/mysys/dynstring-t.c @@ -26,8 +26,10 @@ static void check(const char *res) str1.length= 0; } -int main(void) +int main(int argc, char** argv) { + MY_INIT(argv[0]); + plan(23); IF_WIN(skip_all("Test of POSIX shell escaping rules, not for CMD.EXE\n"), ); @@ -69,6 +71,7 @@ int main(void) dynstr_free(&str1); + my_end(MY_CHECK_ERROR); return exit_status(); } diff --git a/unittest/mysys/stack_allocation-t.c b/unittest/mysys/stack_allocation-t.c index 2b044c80f42..23b75a8f148 100644 --- a/unittest/mysys/stack_allocation-t.c +++ b/unittest/mysys/stack_allocation-t.c @@ -91,7 +91,6 @@ pthread_handler_t thread_stack_check(void *arg __attribute__((unused))) test_stack_detection(1, STACK_ALLOC_SMALL_BLOCK_SIZE-1); test_stack_detection(2, STACK_ALLOC_SMALL_BLOCK_SIZE+1); my_thread_end(); - pthread_exit(0); return 0; } diff --git a/unittest/sql/my_apc-t.cc b/unittest/sql/my_apc-t.cc index 83f894bedc5..09069ef5d40 100644 --- a/unittest/sql/my_apc-t.cc +++ b/unittest/sql/my_apc-t.cc @@ -108,7 +108,6 @@ void *test_apc_service_thread(void *ptr) apc_target.destroy(); mysql_mutex_destroy(&target_mutex); my_thread_end(); - pthread_exit(0); return NULL; } diff --git a/unittest/sql/my_json_writer-t.cc b/unittest/sql/my_json_writer-t.cc index 9363682d86d..8d8fda3f4c9 100644 --- a/unittest/sql/my_json_writer-t.cc +++ b/unittest/sql/my_json_writer-t.cc @@ -54,6 +54,8 @@ constexpr uint FAKE_SELECT_LEX_ID= UINT_MAX; int main(int args, char **argv) { + MY_INIT(argv[0]); + plan(NO_PLAN); diag("Testing Json_writer checks"); @@ -141,6 +143,7 @@ int main(int args, char **argv) diag("Done"); + my_end(MY_CHECK_ERROR); return exit_status(); } diff --git a/wsrep-lib b/wsrep-lib index 1c61b809d1e..70cd967f5e2 160000 --- a/wsrep-lib +++ b/wsrep-lib @@ -1 +1 @@ -Subproject commit 1c61b809d1e1d03771dcad689d3a084e17c6b6c3 +Subproject commit 70cd967f5e249b53d6cce90e2e4198641c564381