diff --git a/.gitignore b/.gitignore index 93a132b3d83dd..2fb3857120c1f 100644 --- a/.gitignore +++ b/.gitignore @@ -261,7 +261,7 @@ support-files/my-innodb-heavy-4G.cnf support-files/my-large.cnf support-files/my-medium.cnf support-files/my-small.cnf -support-files/mysql-log-rotate +support-files/mariadb.logrotate support-files/mysql.10.0.11.spec support-files/mysql.server support-files/mysql.service diff --git a/CMakeLists.txt b/CMakeLists.txt index ce77fdc5f1fc4..3ac59eeefa625 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) "None" "Debug" "Release" "MinSizeRel" "RelWithDebInfo") ENDIF() -PROJECT(MySQL) +PROJECT(MariaDB) # Remove the following comment if you don't want to have striped binaries # in RPM's: @@ -88,6 +88,7 @@ ELSE() SET(CMAKE_CXX_STANDARD 11) ENDIF() +# Lower case package names from PROJECT are used if not explictly upper case. SET(CPACK_PACKAGE_NAME "MariaDB") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MariaDB: a very fast and robust SQL database server") SET(CPACK_PACKAGE_URL "http://mariadb.org") diff --git a/VERSION b/VERSION index 4d9021a0d5996..2b0eac3dbce9c 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -MYSQL_VERSION_MAJOR=10 -MYSQL_VERSION_MINOR=10 -MYSQL_VERSION_PATCH=3 -SERVER_MATURITY=stable +MYSQL_VERSION_MAJOR=11 +MYSQL_VERSION_MINOR=0 +MYSQL_VERSION_PATCH=1 +SERVER_MATURITY=gamma diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index cd5e65c6161d6..82b9ff20731ba 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2394,48 +2394,11 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi case OPT_REWRITE_DB: // db_from->db_to { /* See also handling of OPT_REPLICATE_REWRITE_DB in sql/mysqld.cc */ - const char* ptr; - const char* key= argument; // db-from - const char* val; // db-to - - // Skipp pre-space in key - while (*key && my_isspace(&my_charset_latin1, *key)) - key++; - - // Where val begins - if (!(ptr= strstr(key, "->"))) - { - sql_print_error("Bad syntax in rewrite-db: missing '->'\n"); - return 1; - } - val= ptr + 2; - - // Skip blanks at the end of key - while (ptr > key && my_isspace(&my_charset_latin1, ptr[-1])) - ptr--; - - if (ptr == key) + if (binlog_filter->add_rewrite_db(argument)) { - sql_print_error("Bad syntax in rewrite-db: empty FROM db\n"); + sql_print_error("Bad syntax in rewrite-db. Expected syntax is FROM->TO."); return 1; } - key= strmake_root(&glob_root, key, (size_t) (ptr-key)); - - /* Skipp pre space in value */ - while (*val && my_isspace(&my_charset_latin1, *val)) - val++; - - // Value ends with \0 or space - for (ptr= val; *ptr && !my_isspace(&my_charset_latin1, *ptr) ; ptr++) - {} - if (ptr == val) - { - sql_print_error("Bad syntax in rewrite-db: empty TO db\n"); - return 1; - } - val= strmake_root(&glob_root, val, (size_t) (ptr-val)); - - binlog_filter->add_db_rewrite(key, val); break; } case OPT_PRINT_ROW_COUNT: @@ -2859,6 +2822,7 @@ static Exit_status check_master_version() break; case 5: case 10: + case 11: /* The server is soon going to send us its Format_description log event, unless it is a 5.0 server with 3.23 or 4.0 binlogs. @@ -3690,7 +3654,7 @@ int main(int argc, char** argv) fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;\n"); fprintf(result_file, - "/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n"); + "/*!40019 SET @@session.max_delayed_threads=0*/;\n"); if (disable_log_bin) fprintf(result_file, diff --git a/client/mysqldump.c b/client/mysqldump.c index e4977bde08c1c..842b13e899767 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -129,7 +129,8 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m opt_include_master_host_port= 0, opt_events= 0, opt_comments_used= 0, opt_alltspcs=0, opt_notspcs= 0, opt_logging, - opt_drop_trigger= 0; + opt_header=0, + opt_drop_trigger= 0, opt_dump_history= 0; #define OPT_SYSTEM_ALL 1 #define OPT_SYSTEM_USERS 2 #define OPT_SYSTEM_PLUGINS 4 @@ -150,7 +151,7 @@ static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0, static ulong opt_max_allowed_packet, opt_net_buffer_length; static double opt_max_statement_time= 0.0; static MYSQL mysql_connection,*mysql=0; -static DYNAMIC_STRING insert_pat, select_field_names; +static DYNAMIC_STRING insert_pat, select_field_names, select_field_names_for_header; static char *opt_password=0,*current_user=0, *current_host=0,*path=0,*fields_terminated=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0, @@ -352,6 +353,12 @@ static struct my_option my_long_options[] = "'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER " "TABLE tb_name ENABLE KEYS */; will be put in the output.", &opt_disable_keys, &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"dump-date", OPT_DUMP_DATE, "Put a dump date to the end of the output.", + &opt_dump_date, &opt_dump_date, 0, + GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"dump-history", 'H', "Dump system-versioned tables with history (only for " + "timestamp based versioning)", &opt_dump_history, + &opt_dump_history, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"dump-slave", OPT_MYSQLDUMP_SLAVE_DATA, "This causes the binary log position and filename of the master to be " "appended to the dumped data output. Setting the value to 1, will print" @@ -412,6 +419,8 @@ static struct my_option my_long_options[] = "output, but only commented.", &opt_use_gtid, &opt_use_gtid, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"header", 0, "Used together with --tab. When enabled, adds header with column names to the top of output txt files.", + &opt_header, &opt_header, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"hex-blob", OPT_HEXBLOB, "Dump binary strings (BINARY, " @@ -566,9 +575,6 @@ static struct my_option my_long_options[] = "isolated from them. Option automatically turns off --lock-tables.", &opt_single_transaction, &opt_single_transaction, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"dump-date", OPT_DUMP_DATE, "Put a dump date to the end of the output.", - &opt_dump_date, &opt_dump_date, 0, - GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"skip-opt", OPT_SKIP_OPTIMIZATION, "Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -784,7 +790,7 @@ static void write_header(FILE *sql_file, const char *db_name) if (!opt_logging) fprintf(sql_file, -"\n/*M!100101 SET LOCAL SQL_LOG_OFF=0, LOCAL SLOW_QUERY_LOG=0 */;"); +"\n/*M!100101 SET LOCAL SQL_LOG_OFF=0, LOCAL LOG_SLOW_QUERY=0 */;"); if (opt_set_charset) fprintf(sql_file, @@ -1297,6 +1303,12 @@ static int get_options(int *argc, char ***argv) "%s: You must use option --tab with --fields-...\n", my_progname_short); return(EX_USAGE); } + if (!path && opt_header) + { + fprintf(stderr, + "%s: You must use option --tab with --header\n", my_progname_short); + return(EX_USAGE); + } /* We don't delete master logs if slave data option */ if (opt_slave_data) @@ -1341,15 +1353,38 @@ static int get_options(int *argc, char ***argv) my_progname_short); return(EX_USAGE); } + if (opt_xml && path) + { + fprintf(stderr, "%s: --xml can't be used with --tab.\n", my_progname_short); + return(EX_USAGE); + } + if (opt_xml && opt_dump_history) + { + fprintf(stderr, "%s: --xml can't be used with --dump-history.\n", + my_progname_short); + return(EX_USAGE); + } + if (opt_replace_into && opt_dump_history) + { + fprintf(stderr, "%s: --dump-history can't be used with --replace.\n", + my_progname_short); + return(EX_USAGE); + } + if (opt_asof_timestamp && opt_dump_history) + { + fprintf(stderr, "%s: --dump-history can't be used with --as-of.\n", + my_progname_short); + return(EX_USAGE); + } if (opt_asof_timestamp && strchr(opt_asof_timestamp, '\'')) { fprintf(stderr, "%s: Incorrect DATETIME value: '%s'\n", my_progname_short, opt_asof_timestamp); return(EX_USAGE); } + if (strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME) && - !(charset_info= get_charset_by_csname(default_charset, - MY_CS_PRIMARY, + !(charset_info= get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(MY_UTF8_IS_UTF8MB3 | MY_WME)))) exit(1); if (opt_order_by_size && (*argc > 1 && !opt_databases)) @@ -1952,6 +1987,7 @@ static void free_resources() dynstr_free(&dynamic_where); dynstr_free(&insert_pat); dynstr_free(&select_field_names); + dynstr_free(&select_field_names_for_header); if (defaults_argv) free_defaults(defaults_argv); mysql_library_end(); @@ -2092,7 +2128,7 @@ static my_bool test_if_special_chars(const char *str) /* - quote_name(name, buff, force) + quote(name, buff, force, quote_c) Quotes a string, if it requires quoting. To force quoting regardless of the characters within the string, the force flag can be set to true. @@ -3076,15 +3112,6 @@ static uint get_table_structure(const char *table, const char *db, char *table_t char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH]; char temp_buff[NAME_LEN*2 + 3], temp_buff2[NAME_LEN*2 + 3]; - const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, " - "`COLUMN_TYPE` AS `Type`, " - "`IS_NULLABLE` AS `Null`, " - "`COLUMN_KEY` AS `Key`, " - "`COLUMN_DEFAULT` AS `Default`, " - "`EXTRA` AS `Extra`, " - "`COLUMN_COMMENT` AS `Comment` " - "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE " - "TABLE_SCHEMA = %s AND TABLE_NAME = %s"; FILE *sql_file= md_result_file; size_t len; my_bool is_log_table; @@ -3126,9 +3153,15 @@ static uint get_table_structure(const char *table, const char *db, char *table_t { select_field_names_inited= 1; init_dynamic_string_checked(&select_field_names, "", 1024, 1024); + if (opt_header) + init_dynamic_string_checked(&select_field_names_for_header, "", 1024, 1024); } else + { dynstr_set_checked(&select_field_names, ""); + if (opt_header) + dynstr_set_checked(&select_field_names_for_header, ""); + } insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " : delayed ? " DELAYED " : opt_ignore ? " IGNORE " : ""); @@ -3136,7 +3169,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t if (versioned) { - if (!opt_asof_timestamp) + if (!opt_asof_timestamp && !opt_dump_history) versioned= NULL; else { @@ -3155,8 +3188,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t } len= my_snprintf(query_buff, sizeof(query_buff), - "SET SQL_QUOTE_SHOW_CREATE=%d", - (opt_quoted || opt_keywords)); + "SET SQL_QUOTE_SHOW_CREATE=%d", opt_quoted || opt_keywords); if (!create_options) strmov(query_buff+len, "/*!40102 ,SQL_MODE=concat(@@sql_mode, _utf8 ',NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS') */"); @@ -3169,6 +3201,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t if (!opt_xml && !mysql_query_with_error_report(mysql, 0, query_buff)) { + int vers_hidden= opt_dump_history && versioned && *versioned; /* using SHOW CREATE statement */ if (!opt_no_create_info) { @@ -3366,8 +3399,10 @@ static uint get_table_structure(const char *table, const char *db, char *table_t dynstr_free(&create_table_str); mysql_free_result(result); } - my_snprintf(query_buff, sizeof(query_buff), "show fields from %s", - result_table); + my_snprintf(query_buff, sizeof(query_buff), + "select column_name, extra, generation_expression, data_type " + "from information_schema.columns where table_schema=database() " + "and table_name=%s", quote_for_equal(table, temp_buff)); if (mysql_query_with_error_report(mysql, &result, query_buff)) { if (path) @@ -3377,17 +3412,38 @@ static uint get_table_structure(const char *table, const char *db, char *table_t while ((row= mysql_fetch_row(result))) { - if (strlen(row[SHOW_EXTRA]) && strstr(row[SHOW_EXTRA],"INVISIBLE")) + if (strstr(row[1],"INVISIBLE")) complete_insert= 1; + if (vers_hidden && row[2] && strcmp(row[2], "ROW START") == 0) + { + vers_hidden= 0; + if (row[3] && strcmp(row[3], "bigint") == 0) + { + maybe_die(EX_ILLEGAL_TABLE, "Cannot use --dump-history for table %s with transaction-precise history", + result_table); + *versioned= 0; + } + } if (init) { dynstr_append_checked(&select_field_names, ", "); + if (opt_header) + dynstr_append_checked(&select_field_names_for_header, ", "); } init=1; dynstr_append_checked(&select_field_names, - quote_name(row[SHOW_FIELDNAME], name_buff, 0)); + quote_name(row[0], name_buff, 0)); + if (opt_header) + dynstr_append_checked(&select_field_names_for_header, + quote_for_equal(row[0], name_buff)); } - init=0; + + if (vers_hidden) + { + complete_insert= 1; + dynstr_append_checked(&select_field_names, ", row_start, row_end"); + } + /* If write_data is true, then we build up insert statements for the table's data. Note: in subsequent lines of code, this test @@ -3418,11 +3474,21 @@ static uint get_table_structure(const char *table, const char *db, char *table_t if (complete_insert) dynstr_append_checked(&insert_pat, select_field_names.str); - num_fields= mysql_num_rows(result); + num_fields= mysql_num_rows(result) + (vers_hidden ? 2 : 0); mysql_free_result(result); } else { + const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, " + "`COLUMN_TYPE` AS `Type`, " + "`IS_NULLABLE` AS `Null`, " + "`COLUMN_KEY` AS `Key`, " + "`COLUMN_DEFAULT` AS `Default`, " + "`EXTRA` AS `Extra`, " + "`COLUMN_COMMENT` AS `Comment` " + "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE " + "TABLE_SCHEMA = %s AND TABLE_NAME = %s"; + verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n", my_progname_short, mysql_error(mysql)); @@ -3475,21 +3541,6 @@ static uint get_table_structure(const char *table, const char *db, char *table_t } } - while ((row= mysql_fetch_row(result))) - { - if (strlen(row[SHOW_EXTRA]) && strstr(row[SHOW_EXTRA],"INVISIBLE")) - complete_insert= 1; - if (init) - { - dynstr_append_checked(&select_field_names, ", "); - } - dynstr_append_checked(&select_field_names, - quote_name(row[SHOW_FIELDNAME], name_buff, 0)); - init=1; - } - init=0; - mysql_data_seek(result, 0); - while ((row= mysql_fetch_row(result))) { ulong *lengths= mysql_fetch_lengths(result); @@ -3500,13 +3551,16 @@ static uint get_table_structure(const char *table, const char *db, char *table_t fputs(",\n",sql_file); check_io(sql_file); } - if (complete_insert) - dynstr_append_checked(&insert_pat, ", "); + dynstr_append_checked(&select_field_names, ", "); + if (opt_header) + dynstr_append_checked(&select_field_names_for_header, ", "); } + dynstr_append_checked(&select_field_names, + quote_name(row[SHOW_FIELDNAME], name_buff, 0)); + if (opt_header) + dynstr_append_checked(&select_field_names_for_header, + quote_for_equal(row[SHOW_FIELDNAME], name_buff)); init=1; - if (complete_insert) - dynstr_append_checked(&insert_pat, - quote_name(row[SHOW_FIELDNAME], name_buff, 0)); if (!opt_no_create_info) { if (opt_xml) @@ -3517,12 +3571,10 @@ static uint get_table_structure(const char *table, const char *db, char *table_t if (opt_keywords) fprintf(sql_file, " %s.%s %s", result_table, - quote_name(row[SHOW_FIELDNAME],name_buff, 0), - row[SHOW_TYPE]); + quote_name(row[SHOW_FIELDNAME],name_buff, 0), row[SHOW_TYPE]); else - fprintf(sql_file, " %s %s", quote_name(row[SHOW_FIELDNAME], - name_buff, 0), - row[SHOW_TYPE]); + fprintf(sql_file, " %s %s", + quote_name(row[SHOW_FIELDNAME], name_buff, 0), row[SHOW_TYPE]); if (row[SHOW_DEFAULT]) { fputs(" DEFAULT ", sql_file); @@ -3535,6 +3587,8 @@ static uint get_table_structure(const char *table, const char *db, char *table_t check_io(sql_file); } } + if (complete_insert) + dynstr_append_checked(&insert_pat, select_field_names.str); num_fields= mysql_num_rows(result); mysql_free_result(result); if (!opt_no_create_info) @@ -4020,10 +4074,15 @@ static char *alloc_query_str(size_t size) static void vers_append_system_time(DYNAMIC_STRING* query_string) { - DBUG_ASSERT(opt_asof_timestamp); - dynstr_append_checked(query_string, " FOR SYSTEM_TIME AS OF TIMESTAMP '"); - dynstr_append_checked(query_string, opt_asof_timestamp); - dynstr_append_checked(query_string, "'"); + if (opt_dump_history) + dynstr_append_checked(query_string, " FOR SYSTEM_TIME ALL"); + else + { + DBUG_ASSERT(opt_asof_timestamp); + dynstr_append_checked(query_string, " FOR SYSTEM_TIME AS OF TIMESTAMP '"); + dynstr_append_checked(query_string, opt_asof_timestamp); + dynstr_append_checked(query_string, "'"); + } } @@ -4132,7 +4191,6 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, if (path) { char filename[FN_REFLEN], tmp_path[FN_REFLEN]; - /* Convert the path to native os format and resolve to the full filepath. @@ -4163,15 +4221,27 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, if (fields_terminated || enclosed || opt_enclosed || escaped) dynstr_append_checked(&query_string, " FIELDS"); - + add_load_option(&query_string, " TERMINATED BY ", fields_terminated); add_load_option(&query_string, " ENCLOSED BY ", enclosed); add_load_option(&query_string, " OPTIONALLY ENCLOSED BY ", opt_enclosed); add_load_option(&query_string, " ESCAPED BY ", escaped); add_load_option(&query_string, " LINES TERMINATED BY ", lines_terminated); + if (opt_header) + { + dynstr_append_checked(&query_string, " FROM ( SELECT "); + if (order_by) + dynstr_append_checked(&query_string, " 0 AS `_$is_data_row$_`,"); + dynstr_append_checked(&query_string, select_field_names_for_header.str); + dynstr_append_checked(&query_string, " UNION ALL SELECT "); + if (order_by) + dynstr_append_checked(&query_string, "1 AS `_$is_data_row$_`,"); + dynstr_append_checked(&query_string, select_field_names.str); + } dynstr_append_checked(&query_string, " FROM "); dynstr_append_checked(&query_string, result_table); + if (versioned) vers_append_system_time(&query_string); @@ -4180,10 +4250,15 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, dynstr_append_checked(&query_string, " WHERE "); dynstr_append_checked(&query_string, where); } + if (opt_header) + dynstr_append_checked(&query_string, ") s"); if (order_by) { - dynstr_append_checked(&query_string, " ORDER BY "); + if (opt_header) + dynstr_append_checked(&query_string, " ORDER BY `_$is_data_row$_`,"); + else + dynstr_append_checked(&query_string, " ORDER BY "); dynstr_append_checked(&query_string, order_by); my_free(order_by); order_by= 0; @@ -4257,6 +4332,11 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, goto err; } + if (versioned && !opt_xml && opt_dump_history) + { + fprintf(md_result_file,"/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */;\n"); + check_io(md_result_file); + } if (opt_lock) { fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table); @@ -4554,6 +4634,11 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, fprintf(md_result_file, "commit;\n"); check_io(md_result_file); } + if (versioned && !opt_xml && opt_dump_history) + { + fprintf(md_result_file,"/*!101100 SET system_versioning_insert_history=@old_system_versioning_insert_history */;\n"); + check_io(md_result_file); + } mysql_free_result(res); } dynstr_free(&query_string); @@ -5445,7 +5530,7 @@ static int init_dumping_mysql_tables(char *qdatabase) if (opt_drop_database) fprintf(md_result_file, "\n/*!50106 SET @save_log_output=@@LOG_OUTPUT*/;\n" - "/*M!100203 EXECUTE IMMEDIATE IF(@@LOG_OUTPUT='TABLE' AND (@@SLOW_QUERY_LOG=1 OR @@GENERAL_LOG=1)," + "/*M!100203 EXECUTE IMMEDIATE IF(@@LOG_OUTPUT='TABLE' AND (@@LOG_SLOW_QUERY=1 OR @@GENERAL_LOG=1)," "\"SET GLOBAL LOG_OUTPUT='NONE'\", \"DO 0\") */;\n"); DBUG_RETURN(init_dumping_tables(qdatabase)); diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 88f238c7855d1..3930a325d092b 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5801,6 +5801,7 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host, con - connection structure to be used host, user, pass, - connection parameters db, port, sock + default_db - 0 if db was explicitly passed DESCRIPTION This function will try to establish a connection to server and handle @@ -5818,7 +5819,8 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host, int connect_n_handle_errors(struct st_command *command, MYSQL* con, const char* host, const char* user, const char* pass, - const char* db, int port, const char* sock) + const char* db, int port, const char* sock, + my_bool default_db) { DYNAMIC_STRING *ds; int failed_attempts= 0; @@ -5859,8 +5861,10 @@ int connect_n_handle_errors(struct st_command *command, mysql_options(con, MYSQL_OPT_CONNECT_ATTR_RESET, 0); mysql_options4(con, MYSQL_OPT_CONNECT_ATTR_ADD, "program_name", "mysqltest"); - while (!mysql_real_connect(con, host, user, pass, db, port, sock ? sock: 0, - CLIENT_MULTI_STATEMENTS)) + while (!mysql_real_connect(con, host, user, pass, + (default_db ? "" : db), + port, (sock ? sock : 0), + CLIENT_MULTI_STATEMENTS)) { /* If we have used up all our connections check whether this @@ -5900,6 +5904,13 @@ int connect_n_handle_errors(struct st_command *command, return 0; /* Not connected */ } + if (default_db && db && db[0] != '\0') + { + mysql_select_db(con, db); + // Ignore errors intentionally + } + + var_set_errno(0); handle_no_error(command); revert_properties(); @@ -5953,6 +5964,7 @@ void do_connect(struct st_command *command) int connect_timeout= 0; char *csname=0; struct st_connection* con_slot; + my_bool default_db; static DYNAMIC_STRING ds_connection_name; static DYNAMIC_STRING ds_host; @@ -6159,7 +6171,12 @@ void do_connect(struct st_command *command) /* Use default db name */ if (ds_database.length == 0) + { dynstr_set(&ds_database, opt_db); + default_db= 1; + } + else + default_db= 0; if (opt_plugin_dir && *opt_plugin_dir) mysql_options(con_slot->mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); @@ -6174,7 +6191,7 @@ void do_connect(struct st_command *command) if (connect_n_handle_errors(command, con_slot->mysql, ds_host.str,ds_user.str, ds_password.str, ds_database.str, - con_port, ds_sock.str)) + con_port, ds_sock.str, default_db)) { DBUG_PRINT("info", ("Inserting connection %s in connection pool", ds_connection_name.str)); diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index dc2ca544d28d2..339363b216943 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -162,7 +162,7 @@ SET(ignored SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*" - "%config(noreplace) ${INSTALL_SYSCONFDIR}/logrotate.d/mysql" + "%config(noreplace) ${INSTALL_SYSCONFDIR}/logrotate.d/mariadb" ) SET(CPACK_RPM_common_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONFDIR}/my.cnf") SET(CPACK_RPM_shared_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*") diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake deleted file mode 100644 index e1c764692bc53..0000000000000 --- a/cmake/os/FreeBSD.cmake +++ /dev/null @@ -1,30 +0,0 @@ - -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. -# -# 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 - -# This file includes FreeBSD specific options and quirks, related to system checks - -# Should not be needed any more, but kept for easy resurrection if needed -# #Legacy option, maybe not needed anymore , taken as is from autotools build -# ADD_DEFINITIONS(-DNET_RETRY_COUNT=1000000) - -# The below was used for really old versions of FreeBSD, roughly: before 5.1.9 -# ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH) - -# Find libexecinfo (library that contains backtrace_symbols etc) -SET(EXECINFO_ROOT /usr/local CACHE INTERNAL "Where to find execinfo library and header") -INCLUDE_DIRECTORIES(${EXECINFO_ROOT}/include) -SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${EXECINFO_ROOT}/include) -SET(ENV{LIB} "$ENV{LIB}:${EXECINFO_ROOT}/lib") diff --git a/debian/additions/innotop/innotop b/debian/additions/innotop/innotop index 2bc090917fe1b..d47b122f29c69 100644 --- a/debian/additions/innotop/innotop +++ b/debian/additions/innotop/innotop @@ -466,7 +466,7 @@ sub parse_status_text { # too many locks to print, the output might be truncated) my $time_text; - if ( ($mysqlversion =~ /^5\.[67]\./) || ($mysqlversion =~ /^10\.[0-9]\./) ) { + if ( ($mysqlversion =~ /^5\.[67]\./) || ($mysqlversion =~ /^10|11\.[0-9]\./) ) { ( $time_text ) = $fulltext =~ m/^([0-9-]* [0-9:]*) [0-9a-fx]* INNODB MONITOR OUTPUT/m; $innodb_data{'ts'} = [ parse_innodb_timestamp_56( $time_text ) ]; } else { @@ -634,7 +634,7 @@ sub parse_fk_section { return 0 unless $fulltext; my ( $ts, $type ); - if ( ($mysqlversion =~ /^5.[67]\./) || ($mysqlversion =~ /^10.[0-9]\./) ) { + if ( ($mysqlversion =~ /^5.[67]\./) || ($mysqlversion =~ /^10|11.[0-9]\./) ) { ( $ts, $type ) = $fulltext =~ m/^([0-9-]* [0-9:]*)\s[0-9a-fx]*\s+(\w+)/m; $section->{'ts'} = [ parse_innodb_timestamp_56( $ts ) ]; } else { @@ -894,7 +894,7 @@ sub parse_dl_section { my ( $ts ) = $fulltext =~ m/^$s$/m; return 0 unless $ts; - if ( ($mysqlversion =~ /^5\.[67]\./) || ($mysqlversion =~ /^10\.[0-9]\./) ) { + if ( ($mysqlversion =~ /^5\.[67]\./) || ($mysqlversion =~ /^10|11\.[0-9]\./) ) { $dl->{'ts'} = [ parse_innodb_timestamp_56( $ts ) ]; } else { diff --git a/debian/additions/mariadb.conf.d/50-server.cnf b/debian/additions/mariadb.conf.d/50-server.cnf index aa61301297e49..fac3ce54c5ced 100644 --- a/debian/additions/mariadb.conf.d/50-server.cnf +++ b/debian/additions/mariadb.conf.d/50-server.cnf @@ -56,11 +56,11 @@ bind-address = 127.0.0.1 # Enable this if you want to have error logging into a separate file #log_error = /var/log/mysql/error.log # Enable the slow query log to see queries with especially long duration -#slow_query_log_file = /var/log/mysql/mariadb-slow.log -#long_query_time = 10 +#log_slow_query_file = /var/log/mysql/mariadb-slow.log +#log_slow_query_time = 10 #log_slow_verbosity = query_plan,explain #log-queries-not-using-indexes -#min_examined_row_limit = 1000 +#log_slow_min_examined_row_limit = 1000 # The following can be used as easy to replay backup logs or for replication. # note: if you are setting up a replication slave, see README.Debian about @@ -108,7 +108,7 @@ collation-server = utf8mb4_general_ci # you can put MariaDB-only options here [mariadb] -# This group is only read by MariaDB-10.10 servers. +# This group is only read by MariaDB-11.0 servers. # If you use the same .cnf file for MariaDB of different versions, # use this group for options that older servers don't understand -[mariadb-10.10] +[mariadb-11.0] diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index 36cf47b6b9426..f82cc7eb375eb 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -70,7 +70,7 @@ disable_pmem() disable_libfmt() { - # 0.7+ required + # 7.0+ required sed '/libfmt-dev/d' -i debian/control } @@ -144,7 +144,7 @@ in replace_uring_with_aio disable_libfmt ;& - impish|jammy|kinetic) + impish|jammy|kinetic|lunar) # mariadb-plugin-rocksdb s390x not supported by us (yet) # ubuntu doesn't support mips64el yet, so keep this just # in case something changes. diff --git a/debian/changelog b/debian/changelog index 2f98eccffce89..60ef886f6dd98 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -mariadb (1:10.10.0) unstable; urgency=medium +mariadb (1:11.0.0) unstable; urgency=medium * Initial Release diff --git a/debian/control b/debian/control index 8886da40fdf64..91766d64b3ea3 100644 --- a/debian/control +++ b/debian/control @@ -271,8 +271,7 @@ Depends: libmariadb3 (>= 10.5.4), mariadb-common (>= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} -Conflicts: mariadb-client (<< ${source:Version}), - mariadb-client-10.0, +Conflicts: mariadb-client-10.0, mariadb-client-10.1, mariadb-client-10.2, mariadb-client-10.3, @@ -308,7 +307,8 @@ Conflicts: mariadb-client (<< ${source:Version}), mysql-client-core-5.7, mysql-client-core-8.0, virtual-mysql-client-core -Breaks: mariadb-server-10.0, +Breaks: mariadb-client (<< ${source:Version}), + mariadb-server-10.0, mariadb-server-10.1, mariadb-server-core (<< ${source:Version}), mariadb-server-core-10.0, @@ -384,7 +384,6 @@ Replaces: mariadb-client (<< ${source:Version}), percona-xtradb-cluster-server-5.7, virtual-mysql-client-core Provides: default-mysql-client-core, - mariadb-client-core-10.10, virtual-mysql-client-core Description: MariaDB database core client binaries MariaDB is a fast, stable and true multi-user, multi-threaded SQL database @@ -403,8 +402,7 @@ Depends: debianutils (>=1.6), ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Conflicts: mariadb-client (<< ${source:Version}), - mariadb-client-10.0, +Conflicts: mariadb-client-10.0, mariadb-client-10.1, mariadb-client-10.2, mariadb-client-10.3, @@ -473,8 +471,7 @@ Breaks: mariadb-client-core (<< ${source:Version}), percona-server-server-5.6, percona-xtradb-cluster-server-5.6, percona-xtradb-cluster-server-5.7 -Replaces: mariadb-client (<< ${source:Version}), - mariadb-client-10.0, +Replaces: mariadb-client-10.0, mariadb-client-10.1, mariadb-client-10.2, mariadb-client-10.3, @@ -544,7 +541,6 @@ Replaces: mariadb-client (<< ${source:Version}), percona-xtradb-cluster-server-5.7, virtual-mysql-client Provides: default-mysql-client, - mariadb-client-10.10, virtual-mysql-client Recommends: libdbd-mariadb-perl | libdbd-mysql-perl, libdbi-perl, @@ -563,8 +559,7 @@ Architecture: any Depends: mariadb-common (>= ${source:Version}), ${misc:Depends}, ${shlibs:Depends} -Conflicts: mariadb-server-core (<< ${source:Version}), - mariadb-server-core-10.0, +Conflicts: mariadb-server-core-10.0, mariadb-server-core-10.1, mariadb-server-core-10.2, mariadb-server-core-10.3, @@ -658,7 +653,6 @@ Replaces: mariadb-client (<< ${source:Version}), percona-xtradb-cluster-server-5.7, virtual-mysql-server-core Provides: default-mysql-server-core, - mariadb-server-core-10.10, virtual-mysql-server-core Description: MariaDB database core server files MariaDB is a fast, stable and true multi-user, multi-threaded SQL database @@ -695,8 +689,7 @@ Depends: galera-4 (>= 26.4), ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Conflicts: mariadb-server (<< ${source:Version}), - mariadb-server-10.0, +Conflicts: mariadb-server-10.0, mariadb-server-10.1, mariadb-server-10.2, mariadb-server-10.3, @@ -739,7 +732,6 @@ Replaces: handlersocket-mysql-5.5, mariadb-client-10.6, mariadb-client-10.7, mariadb-client-10.8, - mariadb-server (<< ${source:Version}), mariadb-server-10.0, mariadb-server-10.1, mariadb-server-10.2, @@ -771,7 +763,6 @@ Replaces: handlersocket-mysql-5.5, percona-xtradb-cluster-server-5.7, virtual-mysql-server Provides: default-mysql-server, - mariadb-server-10.10, virtual-mysql-server Description: MariaDB database server binaries MariaDB is a fast, stable and true multi-user, multi-threaded SQL database diff --git a/debian/mariadb-plugin-provider-bzip2.lintian-overrides b/debian/mariadb-plugin-provider-bzip2.lintian-overrides index 563c05a3a6b05..47298832bcfda 100644 --- a/debian/mariadb-plugin-provider-bzip2.lintian-overrides +++ b/debian/mariadb-plugin-provider-bzip2.lintian-overrides @@ -1,3 +1,3 @@ # It's intentional that bzip2 compression plugin doesn't have symbols from libc # More info https://jira.mariadb.org/browse/MDEV-28120 -library-not-linked-against-libc usr/lib/mysql/plugin/provider_bzip2.so \ No newline at end of file +library-not-linked-against-libc [usr/lib/mysql/plugin/provider_bzip2.so] diff --git a/debian/mariadb-plugin-provider-lz4.lintian-overrides b/debian/mariadb-plugin-provider-lz4.lintian-overrides index 3f7d7e9ecfbb8..dbfde13313538 100644 --- a/debian/mariadb-plugin-provider-lz4.lintian-overrides +++ b/debian/mariadb-plugin-provider-lz4.lintian-overrides @@ -1,3 +1,3 @@ # It's intentional that LZ4 compression plugin doesn't have symbols from libc # More info https://jira.mariadb.org/browse/MDEV-28120 -library-not-linked-against-libc usr/lib/mysql/plugin/provider_lz4.so \ No newline at end of file +library-not-linked-against-libc [usr/lib/mysql/plugin/provider_lz4.so] diff --git a/debian/mariadb-plugin-provider-lzma.lintian-overrides b/debian/mariadb-plugin-provider-lzma.lintian-overrides index 94eafa766a408..79f6cb793c279 100644 --- a/debian/mariadb-plugin-provider-lzma.lintian-overrides +++ b/debian/mariadb-plugin-provider-lzma.lintian-overrides @@ -1,3 +1,3 @@ # It's intentional that LZMA compression plugin doesn't have symbols from libc # More info https://jira.mariadb.org/browse/MDEV-28120 -library-not-linked-against-libc usr/lib/mysql/plugin/provider_lzma.so \ No newline at end of file +library-not-linked-against-libc [usr/lib/mysql/plugin/provider_lzma.so] diff --git a/debian/mariadb-plugin-provider-lzo.lintian-overrides b/debian/mariadb-plugin-provider-lzo.lintian-overrides index 8184923cf9a15..ccca4e2d355d3 100644 --- a/debian/mariadb-plugin-provider-lzo.lintian-overrides +++ b/debian/mariadb-plugin-provider-lzo.lintian-overrides @@ -1,3 +1,3 @@ # It's intentional that LZO compression plugin doesn't have symbols from libc # More info https://jira.mariadb.org/browse/MDEV-28120 -library-not-linked-against-libc usr/lib/mysql/plugin/provider_lzo.so \ No newline at end of file +library-not-linked-against-libc [usr/lib/mysql/plugin/provider_lzo.so] diff --git a/debian/mariadb-plugin-provider-snappy.lintian-overrides b/debian/mariadb-plugin-provider-snappy.lintian-overrides index 6c76162573d74..b62907c34698a 100644 --- a/debian/mariadb-plugin-provider-snappy.lintian-overrides +++ b/debian/mariadb-plugin-provider-snappy.lintian-overrides @@ -1,3 +1,3 @@ # It's intentional that Snappy compression plugin doesn't have symbols from libc # More info https://jira.mariadb.org/browse/MDEV-28120 -library-not-linked-against-libc usr/lib/mysql/plugin/provider_snappy.so \ No newline at end of file +library-not-linked-against-libc [usr/lib/mysql/plugin/provider_snappy.so] diff --git a/debian/mariadb-server-core.install b/debian/mariadb-server-core.install index 1a07a3fea9494..4eee370672a91 100644 --- a/debian/mariadb-server-core.install +++ b/debian/mariadb-server-core.install @@ -15,8 +15,8 @@ usr/share/man/man1/resolveip.1 usr/share/man/man8/mariadbd.8 usr/share/man/man8/mysqld.8 usr/share/mysql/bulgarian -usr/share/mysql/chinese usr/share/mysql/charsets +usr/share/mysql/chinese usr/share/mysql/czech usr/share/mysql/danish usr/share/mysql/dutch diff --git a/debian/mariadb-server.install b/debian/mariadb-server.install index 254e9cc8945af..2350196e9d38e 100644 --- a/debian/mariadb-server.install +++ b/debian/mariadb-server.install @@ -5,6 +5,7 @@ debian/additions/mariadb.conf.d/50-mysqld_safe.cnf etc/mysql/mariadb.conf.d debian/additions/mariadb.conf.d/50-server.cnf etc/mysql/mariadb.conf.d debian/additions/source_mariadb.py usr/share/apport/package-hooks etc/apparmor.d/usr.sbin.mariadbd +etc/logrotate.d/mariadb etc/security/user_map.conf lib/*/security/pam_user_map.so lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf diff --git a/debian/mariadb-server.mysql-server.logrotate b/debian/mariadb-server.mysql-server.logrotate deleted file mode 100644 index 11e4480c42715..0000000000000 --- a/debian/mariadb-server.mysql-server.logrotate +++ /dev/null @@ -1,20 +0,0 @@ -# - I put everything in one block and added sharedscripts, so that mysql gets -# flush-logs'd only once. -# Else the binary logs would automatically increase by n times every day. -# - The error log is obsolete, messages go to syslog now. -/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log { - daily - rotate 7 - missingok - create 640 mysql adm - compress - sharedscripts - postrotate - test -x /usr/bin/mysqladmin || exit 0 - # check if server is running - if mysqladmin ping > /dev/null 2>&1; then - mysqladmin --defaults-file=/etc/mysql/debian.cnf --local flush-error-log \ - flush-engine-log flush-general-log flush-slow-log - fi - endscript -} diff --git a/debian/mariadb-server.postinst b/debian/mariadb-server.postinst index 2da1c736dec5c..a5ab6e8e1dc83 100644 --- a/debian/mariadb-server.postinst +++ b/debian/mariadb-server.postinst @@ -220,6 +220,13 @@ EOF fi fi + # The introduction of /etc/logrotate.d/mariadb has made the old config + # obsolete and it needs to be disabled to prevent logrotate running twice. + if [ -f /etc/logrotate.d/mysql-server ] + then + mv -vf /etc/logrotate.d/mysql-server /etc/logrotate.d/mysql-server.dpkg-bak + fi + # @TODO: Remove once buildbot.askmonty.org has been updated not to expect this file mkdir -p /etc/systemd/system/mariadb.service.d/ # Note that file cannot be empty, otherwise systemd version in Ubuntu Bionic diff --git a/debian/mariadb-test-data.lintian-overrides b/debian/mariadb-test-data.lintian-overrides index 85e40a8b429bd..b73e31029e6ca 100644 --- a/debian/mariadb-test-data.lintian-overrides +++ b/debian/mariadb-test-data.lintian-overrides @@ -1,7 +1,5 @@ # These should be moved, see https://jira.mariadb.org/browse/MDEV-21654 -arch-dependent-file-in-usr-share usr/share/mysql/mysql-test/suite/plugins/pam/pam_mariadb_mtr.so arch-dependent-file-in-usr-share [usr/share/mysql/mysql-test/suite/plugins/pam/pam_mariadb_mtr.so] -arch-independent-package-contains-binary-or-object usr/share/mysql/mysql-test/suite/plugins/pam/pam_mariadb_mtr.so arch-independent-package-contains-binary-or-object [usr/share/mysql/mysql-test/suite/plugins/pam/pam_mariadb_mtr.so] # Mainly for support for *BSD family. Not right way to do but this is test package and not for production incorrect-path-for-interpreter /usr/bin/env perl != /usr/bin/perl [usr/share/mysql/mysql-test/std_data/checkDBI_DBD-MariaDB.pl] diff --git a/debian/mariadb-test.lintian-overrides b/debian/mariadb-test.lintian-overrides index 5bac3d60cacf4..d09cfe3c537da 100644 --- a/debian/mariadb-test.lintian-overrides +++ b/debian/mariadb-test.lintian-overrides @@ -1,6 +1,4 @@ # These should be moved, see https://jira.mariadb.org/browse/MDEV-21653 -arch-dependent-file-in-usr-share usr/share/mysql/mysql-test/lib/My/SafeProcess/my_safe_process -arch-dependent-file-in-usr-share usr/share/mysql/mysql-test/lib/My/SafeProcess/wsrep_check_version arch-dependent-file-in-usr-share [usr/share/mysql/mysql-test/lib/My/SafeProcess/my_safe_process] arch-dependent-file-in-usr-share [usr/share/mysql/mysql-test/lib/My/SafeProcess/wsrep_check_version] # Mainly for support for *BSD family. Not right way to do but this is test package and not for production diff --git a/debian/not-installed b/debian/not-installed index f209b2394b7ea..c0d085656162a 100644 --- a/debian/not-installed +++ b/debian/not-installed @@ -1,5 +1,4 @@ etc/columnstore/storagemanager.cnf.example # Copy of etc/columnstore/storagemanager.cnf that is installed -etc/logrotate.d/mysql # Debian packaging uses mariadb-server.mysql-server.logrotate etc/my.cnf # Debian packaging has /etc/mysql/my.cnf, which is a symlink to mariadb.cnf etc/mysql/mariadb.conf.d/client.cnf # Debian packaging uses files from debian/additions/mariadb.cnf.d/ etc/mysql/mariadb.conf.d/enable_encryption.preset # Debian packaging uses files from debian/additions/mariadb.cnf.d/ @@ -51,8 +50,8 @@ usr/share/mysql/Mongo2.jar usr/share/mysql/Mongo3.jar usr/share/mysql/binary-configure usr/share/mysql/magic +usr/share/mysql/mariadb.logrotate usr/share/mysql/maria_add_gis_sp.sql # mariadb-server-core.install has *_bootstrap.sql -usr/share/mysql/mysql-log-rotate # Debian packaging uses mariadb-server.mysql-server.logrotate usr/share/mysql/mysql-test/asan.supp usr/share/mysql/mysql-test/lsan.supp usr/share/mysql/mysql-test/unstable-tests diff --git a/debian/rules b/debian/rules index 5d5766a95c7be..0eb80bfb41fe7 100755 --- a/debian/rules +++ b/debian/rules @@ -195,9 +195,6 @@ endif # Move test plugins that are only needed by the client to the libmariadb path mv -v $(TMP)/usr/lib/mysql/plugin/qa_auth_client.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/ -override_dh_installlogrotate-arch: - dh_installlogrotate --name mysql-server - override_dh_systemd_enable: dh_systemd_enable --name=mariadb dh_systemd_enable --no-enable --name=mariadb mariadb.socket diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml index 2392df2be4d3d..77a8147f4700c 100644 --- a/debian/salsa-ci.yml +++ b/debian/salsa-ci.yml @@ -522,6 +522,70 @@ mysql-8.0 Jammy to mariadb upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ +mariadb.org 10.11 to mariadb upgrade: + stage: upgrade extras + needs: + - job: build + image: debian:${RELEASE} + artifacts: + when: always + name: "$CI_BUILD_NAME" + paths: + - ${WORKING_DIR}/debug + script: + - *test-prepare-container + - apt install -y curl + - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc + - echo "deb https://deb.mariadb.org/10.11/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list + - apt-get update + - apt-get install -y mariadb-server + - *test-verify-initial + # Install MariaDB built in this commit + # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.9.1-1 vs 1:10.9.1+mariadb~sid + - apt-get install -y --allow-downgrades ./*.deb + # Verify installation of MariaDB built in this commit + - dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed + - mariadb --version # Client version + - service mariadb status # There is no init.d/mysql in MariaDB 10.5+ + - *test-verify-final + variables: + GIT_STRATEGY: none + except: + variables: + - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ + +mariadb.org 10.10 to mariadb upgrade: + stage: upgrade extras + needs: + - job: build + image: debian:${RELEASE} + artifacts: + when: always + name: "$CI_BUILD_NAME" + paths: + - ${WORKING_DIR}/debug + script: + - *test-prepare-container + - apt install -y curl + - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc + - echo "deb https://deb.mariadb.org/10.10/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list + - apt-get update + - apt-get install -y mariadb-server + - *test-verify-initial + # Install MariaDB built in this commit + # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.9.1-1 vs 1:10.9.1+mariadb~sid + - apt-get install -y --allow-downgrades ./*.deb + # Verify installation of MariaDB built in this commit + - dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed + - mariadb --version # Client version + - service mariadb status # There is no init.d/mysql in MariaDB 10.5+ + - *test-verify-final + variables: + GIT_STRATEGY: none + except: + variables: + - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ + mariadb.org 10.9 to mariadb upgrade: stage: upgrade extras needs: @@ -538,7 +602,7 @@ mariadb.org 10.9 to mariadb upgrade: - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc - echo "deb https://deb.mariadb.org/10.9/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list - apt-get update - - apt-get install -y mariadb-server-10.9 + - apt-get install -y mariadb-server - *test-verify-initial # Install MariaDB built in this commit # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.9.1-1 vs 1:10.9.1+mariadb~sid @@ -553,7 +617,6 @@ mariadb.org 10.9 to mariadb upgrade: except: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ - allow_failure: true mariadb.org-10.8 to mariadb upgrade: stage: upgrade extras @@ -586,7 +649,6 @@ mariadb.org-10.8 to mariadb upgrade: except: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ - allow_failure: true mariadb.org-10.7 to mariadb upgrade: stage: upgrade extras @@ -619,7 +681,6 @@ mariadb.org-10.7 to mariadb upgrade: except: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ - allow_failure: true mariadb.org-10.6 to mariadb upgrade: stage: upgrade extras diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides index 740a7871a2e80..7686591f0a8fd 100644 --- a/debian/source/lintian-overrides +++ b/debian/source/lintian-overrides @@ -4,28 +4,9 @@ version-substvar-for-external-package mariadb-client-core -> mysql-client-5.5 version-substvar-for-external-package mariadb-server -> mysql-server version-substvar-for-external-package libmariadb-dev -> libmysqlclient-dev version-substvar-for-external-package libmariadb-dev -> libmysqld-dev -version-substvar-for-external-package mariadb-server-10.9 -> mysql-client-5.* -version-substvar-for-external-package mariadb-server-10.9 -> mysql-client-8.* -version-substvar-for-external-package mariadb-client-10.9 -> mysql-client-core-5.* -version-substvar-for-external-package mariadb-client-10.9 -> mysql-client-core-8.* +version-substvar-for-external-package Replaces ${source:Version} libmariadb-dev -> libmysqlclient-dev [debian/control:74] +version-substvar-for-external-package Replaces ${source:Version} libmariadb-dev -> libmysqld-dev [debian/control:74] version-substvar-for-external-package libmariadbd-dev -> libmariadbclient-dev -# Intentional version-substvar-for-external-package as long as mariadb-server -# provides mariadb-server-10.10 and mariadb-client provides mariadb-client-10.10 -version-substvar-for-external-package Conflicts (line 408) ${source:Version} mariadb-client -> mariadb-client-10.10 -version-substvar-for-external-package Conflicts (line 575) ${source:Version} mariadb-server-core -> mariadb-server-core-10.10 -version-substvar-for-external-package Conflicts (line 711) ${source:Version} mariadb-server -> mariadb-server-10.10 -version-substvar-for-external-package Conflicts (line 95) ${source:Version} libmariadb-dev-compat -> libmariadbclient-dev -version-substvar-for-external-package Replaces (line 109) ${source:Version} libmariadb-dev-compat -> libmariadbclient-dev -version-substvar-for-external-package Replaces (line 330) ${source:Version} mariadb-client-core -> mariadb-client-10.10 -version-substvar-for-external-package Replaces (line 330) ${source:Version} mariadb-client-core -> mariadb-server-core-10.10 -version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-client-10.10 -version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-client-core-10.10 -version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-server-10.10 -version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-server-core-10.10 -version-substvar-for-external-package Replaces (line 626) ${source:Version} mariadb-server-core -> mariadb-client-10.10 -version-substvar-for-external-package Replaces (line 626) ${source:Version} mariadb-server-core -> mariadb-server-10.10 -version-substvar-for-external-package Replaces (line 748) ${source:Version} mariadb-server -> mariadb-client-10.10 -version-substvar-for-external-package Replaces (line 748) ${source:Version} mariadb-server -> mariadb-server-10.10 # ColumnStore not used in Debian, safe to ignore. Reported upstream in https://jira.mariadb.org/browse/MDEV-24124 source-is-missing storage/columnstore/columnstore/utils/jemalloc/libjemalloc.so.2 source-is-missing [storage/columnstore/columnstore/utils/jemalloc/libjemalloc.so.2] @@ -106,3 +87,10 @@ source-contains-autogenerated-visual-c++-file storage/columnstore/columnstore/*. source-contains-autogenerated-visual-c++-file storage/columnstore/columnstore/*.h source-contains-autogenerated-visual-c++-file win/upgrade_wizard/resource.h source-contains-autogenerated-visual-c++-file win/upgrade_wizard/upgrade.rc + +# New in 10.11 +version-substvar-for-external-package Conflicts ${source:Version} libmariadb-dev-compat -> libmariadbclient-dev [debian/control:95] +version-substvar-for-external-package Replaces ${source:Version} libmariadb-dev-compat -> libmariadbclient-dev [debian/control:109] +missing-build-dependency-for-dh-addon systemd (does not satisfy debhelper:any (>= 9.20160709~) | debhelper-compat:any | dh-sequence-systemd:any | dh-systemd:any) [debian/rules] +source-is-missing [sql/share/charsets/languages.html] +source-is-missing [storage/rocksdb/rocksdb/docs/_includes/footer.html] diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index ae7d4583c69cc..69448586b33b1 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -554,7 +554,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn) (unsigned long)strlen(opt_incremental_history_name)); snprintf(query, sizeof(query), "SELECT innodb_to_lsn " - "FROM PERCONA_SCHEMA.xtrabackup_history " + "FROM " XB_HISTORY_TABLE " " "WHERE name = '%s' " "AND innodb_to_lsn IS NOT NULL " "ORDER BY innodb_to_lsn DESC LIMIT 1", @@ -567,7 +567,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn) (unsigned long)strlen(opt_incremental_history_uuid)); snprintf(query, sizeof(query), "SELECT innodb_to_lsn " - "FROM PERCONA_SCHEMA.xtrabackup_history " + "FROM " XB_HISTORY_TABLE " " "WHERE uuid = '%s' " "AND innodb_to_lsn IS NOT NULL " "ORDER BY innodb_to_lsn DESC LIMIT 1", @@ -1572,7 +1572,7 @@ operator<<(std::ostream& s, const escape_and_quote& eq) /*********************************************************************//** Writes xtrabackup_info file and if backup_history is enable creates -PERCONA_SCHEMA.xtrabackup_history and writes a new history record to the +mysql.mariabackup_history and writes a new history record to the table containing all the history info particular to the just completed backup. */ bool @@ -1672,9 +1672,7 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history, } xb_mysql_query(connection, - "CREATE DATABASE IF NOT EXISTS PERCONA_SCHEMA", false); - xb_mysql_query(connection, - "CREATE TABLE IF NOT EXISTS PERCONA_SCHEMA.xtrabackup_history(" + "CREATE TABLE IF NOT EXISTS " XB_HISTORY_TABLE "(" "uuid VARCHAR(40) NOT NULL PRIMARY KEY," "name VARCHAR(255) DEFAULT NULL," "tool_name VARCHAR(255) DEFAULT NULL," @@ -1697,7 +1695,7 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history, #define ESCAPE_BOOL(expr) ((expr)?"'Y'":"'N'") - oss << "insert into PERCONA_SCHEMA.xtrabackup_history(" + oss << "insert into " XB_HISTORY_TABLE "(" << "uuid, name, tool_name, tool_command, tool_version," << "ibbackup_version, server_version, start_time, end_time," << "lock_time, binlog_pos, innodb_from_lsn, innodb_to_lsn," diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index e0a4711a2aac5..2932fa6d5a630 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -199,12 +199,6 @@ xb_fil_cur_open( return(XB_FIL_CUR_SKIP); } - if (srv_file_flush_method == SRV_O_DIRECT - || srv_file_flush_method == SRV_O_DIRECT_NO_FSYNC) { - - os_file_set_nocache(cursor->file, node->name, "OPEN"); - } - posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL); cursor->page_size = node->space->physical_size(); diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 20f87354fd079..b925b41552d2a 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -377,7 +377,7 @@ static struct my_option ibx_long_options[] = {"incremental-history-name", OPT_INCREMENTAL_HISTORY_NAME, "This option specifies the name of the backup series stored in the " - "PERCONA_SCHEMA.xtrabackup_history history record to base an " + XB_HISTORY_TABLE " history record to base an " "incremental backup on. Backup will search the history table " "looking for the most recent (highest innodb_to_lsn), successful " "backup in the series and take the to_lsn value to use as the " @@ -392,7 +392,7 @@ static struct my_option ibx_long_options[] = {"incremental-history-uuid", OPT_INCREMENTAL_HISTORY_UUID, "This option specifies the UUID of the specific history record " - "stored in the PERCONA_SCHEMA.xtrabackup_history to base an " + "stored in the " XB_HISTORY_TABLE " table to base an " "incremental backup on. --incremental-history-name, " "--incremental-basedir and --incremental-lsn. If no valid lsn can be " "found (no success record with that uuid), an error will be returned." @@ -417,7 +417,7 @@ static struct my_option ibx_long_options[] = {"history", OPT_HISTORY, "This option enables the tracking of backup history in the " - "PERCONA_SCHEMA.xtrabackup_history table. An optional history " + XB_HISTORY_TABLE " table. An optional history " "series name may be specified that will be placed with the history " "record for the current backup being taken.", NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc index 01e4d83e344aa..086d4078e317c 100644 --- a/extra/mariabackup/write_filt.cc +++ b/extra/mariabackup/write_filt.cc @@ -129,6 +129,18 @@ wf_incremental_process(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile) incremental_lsn >= mach_read_from_8(page + FIL_PAGE_LSN)) continue; + /* Check whether TRX_SYS page has been changed */ + if (mach_read_from_4(page + FIL_PAGE_SPACE_ID) + == TRX_SYS_SPACE + && mach_read_from_4(page + FIL_PAGE_OFFSET) + == TRX_SYS_PAGE_NO) { + msg(cursor->thread_n, + "--incremental backup is impossible if " + "the server had been restarted with " + "different innodb_undo_tablespaces."); + return false; + } + /* updated page */ if (cp->npages == page_size / 4) { /* flush buffer */ diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index ef826a4010579..e0ea4a17ab87c 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -311,6 +311,8 @@ extern const char *innodb_checksum_algorithm_names[]; extern TYPELIB innodb_checksum_algorithm_typelib; extern const char *innodb_flush_method_names[]; extern TYPELIB innodb_flush_method_typelib; +/** Ignored option */ +static ulong innodb_flush_method; static const char *binlog_info_values[] = {"off", "lockless", "on", "auto", NullS}; @@ -1032,6 +1034,8 @@ enum options_xtrabackup #if defined __linux__ || defined _WIN32 OPT_INNODB_LOG_FILE_BUFFERING, #endif + OPT_INNODB_DATA_FILE_BUFFERING, + OPT_INNODB_DATA_FILE_WRITE_THROUGH, OPT_INNODB_LOG_FILE_SIZE, OPT_INNODB_OPEN_FILES, OPT_XTRA_DEBUG_SYNC, @@ -1368,7 +1372,7 @@ struct my_option xb_client_options[]= { {"incremental-history-name", OPT_INCREMENTAL_HISTORY_NAME, "This option specifies the name of the backup series stored in the " - "PERCONA_SCHEMA.xtrabackup_history history record to base an " + XB_HISTORY_TABLE " history record to base an " "incremental backup on. Xtrabackup will search the history table " "looking for the most recent (highest innodb_to_lsn), successful " "backup in the series and take the to_lsn value to use as the " @@ -1383,7 +1387,7 @@ struct my_option xb_client_options[]= { {"incremental-history-uuid", OPT_INCREMENTAL_HISTORY_UUID, "This option specifies the UUID of the specific history record " - "stored in the PERCONA_SCHEMA.xtrabackup_history to base an " + "stored in the " XB_HISTORY_TABLE " table to base an " "incremental backup on. --incremental-history-name, " "--incremental-basedir and --incremental-lsn. If no valid lsn can be " "found (no success record with that uuid), an error will be returned." @@ -1412,7 +1416,7 @@ struct my_option xb_client_options[]= { {"history", OPT_HISTORY, "This option enables the tracking of backup history in the " - "PERCONA_SCHEMA.xtrabackup_history table. An optional history " + XB_HISTORY_TABLE " table. An optional history " "series name may be specified that will be placed with the history " "record for the current backup being taken.", NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -1583,10 +1587,10 @@ struct my_option xb_server_options[] = FALSE, 0, 0, 0, 0, 0}, {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD, - "With which method to flush data.", - &srv_file_flush_method, &srv_file_flush_method, + "Ignored parameter with no effect", + &innodb_flush_method, &innodb_flush_method, &innodb_flush_method_typelib, GET_ENUM, REQUIRED_ARG, - IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_O_DIRECT), 0, 0, 0, 0, 0}, + 4/* O_DIRECT */, 0, 0, 0, 0, 0}, {"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE, "Redo log buffer size in bytes.", @@ -1600,6 +1604,16 @@ struct my_option xb_server_options[] = (G_PTR*) &log_sys.log_buffered, 0, GET_BOOL, NO_ARG, TRUE, 0, 0, 0, 0, 0}, #endif + {"innodb_data_file_buffering", OPT_INNODB_DATA_FILE_BUFFERING, + "Whether the file system cache for data files is enabled during --backup", + (G_PTR*) &fil_system.buffered, + (G_PTR*) &fil_system.buffered, 0, GET_BOOL, NO_ARG, + FALSE, 0, 0, 0, 0, 0}, + {"innodb_data_file_write_through", OPT_INNODB_DATA_FILE_WRITE_THROUGH, + "Whether each write to data files writes through", + (G_PTR*) &fil_system.write_through, + (G_PTR*) &fil_system.write_through, 0, GET_BOOL, NO_ARG, + FALSE, 0, 0, 0, 0, 0}, {"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE, "Ignored for mysqld option compatibility", (G_PTR*) &srv_log_file_size, (G_PTR*) &srv_log_file_size, 0, @@ -1653,7 +1667,7 @@ struct my_option xb_server_options[] = {"innodb_undo_tablespaces", OPT_INNODB_UNDO_TABLESPACES, "Number of undo tablespaces to use.", (G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces, - 0, GET_UINT, REQUIRED_ARG, 0, 0, 126, 0, 1, 0}, + 0, GET_UINT, REQUIRED_ARG, 3, 0, 126, 0, 1, 0}, {"innodb_compression_level", OPT_INNODB_COMPRESSION_LEVEL, "Compression level used for zlib compression.", @@ -1917,12 +1931,6 @@ xb_get_one_option(const struct my_option *opt, ADD_PRINT_PARAM_OPT(srv_log_group_home_dir); break; - case OPT_INNODB_FLUSH_METHOD: - ut_a(srv_file_flush_method - <= IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_O_DIRECT_NO_FSYNC)); - ADD_PRINT_PARAM_OPT(innodb_flush_method_names[srv_file_flush_method]); - break; - case OPT_INNODB_PAGE_SIZE: ADD_PRINT_PARAM_OPT(innobase_page_size); @@ -2161,12 +2169,6 @@ static bool innodb_init_param() srv_print_verbose_log = verbose ? 2 : 1; - /* Store the default charset-collation number of this MySQL - installation */ - - /* We cannot treat characterset here for now!! */ - data_mysql_default_charset_coll = (ulint)default_charset_info->number; - ut_ad(DATA_MYSQL_BINARY_CHARSET_COLL == my_charset_bin.number); #ifdef _WIN32 @@ -3859,85 +3861,6 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback) return(err); } -/** Assign srv_undo_space_id_start variable if there are undo tablespace present. -Read the TRX_SYS page from ibdata1 file and get the minimum space id from -the first slot rollback segments of TRX_SYS_PAGE_NO. -@retval DB_ERROR if file open or page read failed. -@retval DB_SUCCESS if srv_undo_space_id assigned successfully. */ -static dberr_t xb_assign_undo_space_start() -{ - - pfs_os_file_t file; - bool ret; - dberr_t error = DB_SUCCESS; - uint32_t space; - uint32_t fsp_flags; - int n_retries = 5; - - file = os_file_create(0, srv_sys_space.first_datafile()->filepath(), - OS_FILE_OPEN, OS_FILE_NORMAL, OS_DATA_FILE, true, &ret); - - if (!ret) { - msg("Error opening %s", srv_sys_space.first_datafile()->filepath()); - return DB_ERROR; - } - - byte* page = static_cast - (aligned_malloc(srv_page_size, srv_page_size)); - - if (os_file_read(IORequestRead, file, page, 0, srv_page_size, nullptr) - != DB_SUCCESS) { - msg("Reading first page failed.\n"); - error = DB_ERROR; - goto func_exit; - } - - fsp_flags = mach_read_from_4( - page + FSP_HEADER_OFFSET + FSP_SPACE_FLAGS); -retry: - if (os_file_read(IORequestRead, file, page, - TRX_SYS_PAGE_NO << srv_page_size_shift, - srv_page_size, nullptr) != DB_SUCCESS) { - msg("Reading TRX_SYS page failed."); - error = DB_ERROR; - goto func_exit; - } - - /* TRX_SYS page can't be compressed or encrypted. */ - if (buf_page_is_corrupted(false, page, fsp_flags)) { - if (n_retries--) { - std::this_thread::sleep_for( - std::chrono::milliseconds(1)); - goto retry; - } else { - msg("mariabackup: TRX_SYS page corrupted.\n"); - error = DB_ERROR; - goto func_exit; - } - } - - /* 0th slot always points to system tablespace. - 1st slot should point to first undotablespace which is minimum. */ - - ut_ad(mach_read_from_4(TRX_SYS + TRX_SYS_RSEGS - + TRX_SYS_RSEG_SLOT_SIZE - + TRX_SYS_RSEG_PAGE_NO + page) - != FIL_NULL); - - space = mach_read_from_4(TRX_SYS + TRX_SYS_RSEGS - + TRX_SYS_RSEG_SLOT_SIZE - + TRX_SYS_RSEG_SPACE + page); - - srv_undo_space_id_start = space; - -func_exit: - aligned_free(page); - ret = os_file_close(file); - ut_a(ret); - - return error; -} - /** Close all undo tablespaces while applying incremental delta */ static void xb_close_undo_tablespaces() { @@ -3990,14 +3913,7 @@ xb_load_tablespaces() } /* Add separate undo tablespaces to fil_system */ - - err = xb_assign_undo_space_start(); - - if (err != DB_SUCCESS) { - return err; - } - - err = srv_undo_tablespaces_init(false); + err = srv_undo_tablespaces_init(false, nullptr); if (err != DB_SUCCESS) { return(err); diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 11de9eeaf489d..3796c9ec698f4 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA #include "changed_page_bitmap.h" #include +#define XB_HISTORY_TABLE "mysql.mariadb_backup_history" + struct xb_delta_info_t { xb_delta_info_t(ulint page_size, ulint zip_size, uint32_t space_id) diff --git a/libmariadb b/libmariadb index 72b40bfaa869f..d9af4fcbc6a7c 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 72b40bfaa869f3fe84242471dda989d13983d84c +Subproject commit d9af4fcbc6a7c0ab72b38bb47e0d4fa1f1f83316 diff --git a/man/mysqladmin.1 b/man/mysqladmin.1 index a3b6b167179fd..da25123a219c2 100644 --- a/man/mysqladmin.1 +++ b/man/mysqladmin.1 @@ -676,7 +676,7 @@ The number of questions (queries) from clients since the server was started\&. Slow queries .sp The number of queries that have taken more than -long_query_time +log_slow_query_time seconds\&. .RE .sp diff --git a/man/mysqlbinlog.1 b/man/mysqlbinlog.1 index 05376046259a0..8dd814d34ab8f 100644 --- a/man/mysqlbinlog.1 +++ b/man/mysqlbinlog.1 @@ -1381,7 +1381,7 @@ The hex output consists of comment lines beginning with .RS 4 .\} .nf -/*!40019 SET @@session\&.max_insert_delayed_threads=0*/; +/*!40019 SET @@session\&.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; # at 4 #051024 17:24:13 server id 1 end_log_pos 98 diff --git a/man/mysqldump.1 b/man/mysqldump.1 index 04efe7e4de7ed..9bb6fdadca11c 100644 --- a/man/mysqldump.1 +++ b/man/mysqldump.1 @@ -1003,6 +1003,21 @@ Available from MariaDB 10.0.13, and is used together with \fB\-\-master\-data\fR .sp -1 .IP \(bu 2.3 .\} +.\" mysqldump: header option +.\" header option: mysqldump +\fB\-\-header\fR +.sp +Used together with --tab. When enabled, adds header with column names to the top of output txt files. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysqldump: hex-blob option .\" hex-blob option: mysqldump \fB\-\-hex\-blob\fR diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index 4a1af2a4553bb..078f6572bed28 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -32,6 +32,7 @@ if ($tmp) --echo Relay_Master_Log_File # --echo Slave_IO_Running No --echo Slave_SQL_Running No + --echo Replicate_Rewrite_DB # --echo Replicate_Do_DB # --echo Replicate_Ignore_DB # --echo Replicate_Do_Table # @@ -76,7 +77,7 @@ if ($tmp) } if (!$tmp) { # Note: after WL#5177, fields 13-18 shall not be filtered-out. - --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 22 # 23 # 24 # 25 # 26 # 40 # 41 # 42 # 44 # 51 # 52 # 53 # + --replace_column 4 # 5 # 6 # 7 # 8 # 9 # 10 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # 23 # 24 # 25 # 26 # 27 # 41 # 42 # 43 # 45 # 52 # 53 # 54 # query_vertical SHOW SLAVE STATUS; } diff --git a/mysql-test/include/concurrent.inc b/mysql-test/include/concurrent.inc index 0a49ae13d4b41..1d65549f8f48b 100644 --- a/mysql-test/include/concurrent.inc +++ b/mysql-test/include/concurrent.inc @@ -49,7 +49,7 @@ let $keep_locks= `SELECT @@global.tx_isolation IN ('REPEATABLE-READ','SERIALIZAB # # Set up privileges and remove user level locks, if exist. # -GRANT USAGE ON test.* TO mysqltest@localhost; +GRANT ALL ON test.* TO mysqltest@localhost; --echo --echo ** diff --git a/mysql-test/include/grant_cache.inc b/mysql-test/include/grant_cache.inc index 467c117056345..b3e96d160fa24 100644 --- a/mysql-test/include/grant_cache.inc +++ b/mysql-test/include/grant_cache.inc @@ -84,9 +84,11 @@ show status like "Qcache_hits%"; # Create the test users grant SELECT on mysqltest.* to mysqltest_1@localhost; +grant SELECT on test.t1 to mysqltest_1@localhost; grant SELECT on mysqltest.t1 to mysqltest_2@localhost; grant SELECT on test.t1 to mysqltest_2@localhost; grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost; +grant SELECT(a) on test.t1 to mysqltest_3@localhost; # The following queries should be fetched from cache connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); @@ -115,7 +117,7 @@ show status like "Qcache_not_cached"; # Don't use '' as user because it will pick Unix login -connect (unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK); +connect (unkuser,localhost,unkuser,,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); connection unkuser; show grants for current_user(); diff --git a/mysql-test/lib/My/Debugger.pm b/mysql-test/lib/My/Debugger.pm index c2062c2eaba13..412c028cfc52c 100644 --- a/mysql-test/lib/My/Debugger.pm +++ b/mysql-test/lib/My/Debugger.pm @@ -78,7 +78,7 @@ my %debuggers = ( options => '-f -o {log} {exe} {args}', }, rr => { - options => '_RR_TRACE_DIR={log} rr record {exe} {args} --loose-skip-innodb-use-native-aio --loose-innodb-flush-method=fsync', + options => '_RR_TRACE_DIR={log} rr record {exe} {args}', run => 'env', pre => sub { ::mtr_error('rr requires kernel.perf_event_paranoid <= 1') diff --git a/mysql-test/main/analyze_format_json.result b/mysql-test/main/analyze_format_json.result index 6c9b8ce298293..9a756782f96f5 100644 --- a/mysql-test/main/analyze_format_json.result +++ b/mysql-test/main/analyze_format_json.result @@ -5,6 +5,9 @@ INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); analyze format=json select * from t0 where a<3; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -38,6 +41,9 @@ analyze format=json select * from t0, t1 where t1.a=t0.a and t0.a > 9; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -85,6 +91,9 @@ analyze format=json select * from t0, t1 where t1.a=t0.a and t1.b<4; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -135,6 +144,9 @@ analyze format=json select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -181,6 +193,9 @@ analyze format=json select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60 and tbl1.c > tbl2.c; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -236,6 +251,9 @@ insert into t2 values (0),(1); analyze format=json select * from t1 straight_join t2 force index(a) where t2.a=t1.a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -294,6 +312,9 @@ NULL analyze format=json select * from test.t1 where t1.a<5; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -334,6 +355,9 @@ analyze format=json update t1 set b=pk; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_total_time_ms": "REPLACED", @@ -352,6 +376,9 @@ analyze format=json select * from t1 where pk < 10 and b > 4; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -383,6 +410,9 @@ analyze format=json delete from t1 where pk < 10 and b > 4; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_total_time_ms": "REPLACED", @@ -426,6 +456,9 @@ select * from t1, t2 where (t2.key1 between t1.lb1 and t1.rb1) and (t2.key3=t1.c1 OR t2.key4=t1.c2); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -485,6 +518,9 @@ INSERT INTO t1 select * from t0; analyze format=json (select * from t1 tbl1 where a<5) union (select * from t1 tbl2 where a in (2,3)); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -561,6 +597,9 @@ insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B; analyze format=json select a, max(b) as TOP from t2 group by a having TOP > a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -598,6 +637,9 @@ ANALYZE analyze format=json select a, max(b) as TOP from t2 group by a having 1<>2; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -634,6 +676,9 @@ ANALYZE analyze format=json select a, max(b) as TOP from t2 group by a having 1=2; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "table": { @@ -645,6 +690,9 @@ ANALYZE analyze format=json select a, max(b) as TOP from t2 group by a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -688,6 +736,9 @@ INSERT INTO t2 VALUES (3),(4); ANALYZE FORMAT=JSON SELECT STRAIGHT_JOIN * FROM t1, t2 WHERE b IN ( SELECT a FROM t1 ); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -771,6 +822,9 @@ WHERE f3 IN ( 1, 2 ) GROUP BY sq ORDER BY gc; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -888,6 +942,9 @@ create table t2 as select * from t1; analyze format=json select a, (select t2.b from t2 where t2.a 0 and t5.a <= 5 group by t5.a order by sum limit 1; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -635,6 +659,9 @@ analyze format=json select col1 f1, col2 f2, col1 f3 from t2 group by f1; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/bind_multiple_addresses_resolution.opt b/mysql-test/main/bind_multiple_addresses_resolution.opt new file mode 100644 index 0000000000000..ab5aaff94547a --- /dev/null +++ b/mysql-test/main/bind_multiple_addresses_resolution.opt @@ -0,0 +1 @@ +--bind-address=localhost,192.168.0.1 diff --git a/mysql-test/main/bind_multiple_addresses_resolution.result b/mysql-test/main/bind_multiple_addresses_resolution.result new file mode 100644 index 0000000000000..d0e1441312413 --- /dev/null +++ b/mysql-test/main/bind_multiple_addresses_resolution.result @@ -0,0 +1,12 @@ +call mtr.add_suppression("Can't start server: Bind on TCP/IP port."); +CREATE TABLE t (a TEXT); +connect con1,localhost,root,,test; +SELECT * FROM t; +a +connect con2,127.0.0.1,root,,test; +SELECT * FROM t; +a +connection default; +DROP TABLE t; +disconnect con1; +disconnect con2; diff --git a/mysql-test/main/bind_multiple_addresses_resolution.test b/mysql-test/main/bind_multiple_addresses_resolution.test new file mode 100644 index 0000000000000..752c8d1a37a10 --- /dev/null +++ b/mysql-test/main/bind_multiple_addresses_resolution.test @@ -0,0 +1,23 @@ +--source include/check_ipv6.inc +--source include/not_embedded.inc + +call mtr.add_suppression("Can't start server: Bind on TCP/IP port."); +# The server is started with --bind-address=localhost,192.168.0.1, and should +# listen on all addresses 'localhost' resolves to and 192.168.0.1. With at least +# 127.0.0.1 and ::1 amongst them. + +CREATE TABLE t (a TEXT); +--connect(con1,localhost,root,,test) +SELECT * FROM t; +--connect(con2,127.0.0.1,root,,test) +SELECT * FROM t; +# Temporary disable. +# Some cloud-init services don't resolve localhost->::1 +# bb - kvm-asan, kvm-deb-focal-amd64, kvm-deb-groovy-amd64 +#--connect(con3,::1,root,,test) +#SELECT * FROM t; +--connection default +DROP TABLE t; +--disconnect con1 +--disconnect con2 +#--disconnect con3 diff --git a/mysql-test/main/brackets.result b/mysql-test/main/brackets.result index 3fd19ef968a10..f87afdc0f4793 100644 --- a/mysql-test/main/brackets.result +++ b/mysql-test/main/brackets.result @@ -489,8 +489,6 @@ drop table t1; # select * from ( mysql.db ); Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv Event_priv Trigger_priv Delete_history_priv -% test Y Y Y Y Y Y N Y Y Y Y Y Y Y Y N N Y Y Y -% test\_% Y Y Y Y Y Y N Y Y Y Y Y Y Y Y N N Y Y Y create table t1 (a int); insert into t1 values (7), (2), (7); select * from (t1); diff --git a/mysql-test/main/bug46760-master.opt b/mysql-test/main/bug46760-master.opt index 2d7be7fb9b17f..5b4331aa7a68a 100644 --- a/mysql-test/main/bug46760-master.opt +++ b/mysql-test/main/bug46760-master.opt @@ -1,2 +1 @@ --loose-innodb-lock-wait-timeout=2 ---loose-innodb-file-per-table diff --git a/mysql-test/main/column_compression_parts.test b/mysql-test/main/column_compression_parts.test index 4c77a7308f71a..8dfb304173b8f 100644 --- a/mysql-test/main/column_compression_parts.test +++ b/mysql-test/main/column_compression_parts.test @@ -141,7 +141,6 @@ CREATE TABLE t1 (a BLOB COMPRESSED) CREATE TABLE t1 (a VARCHAR(200) COMPRESSED) PARTITION BY KEY(a) partitions 30; ALTER TABLE t1 COALESCE PARTITION 20; -#ALTER TABLE t1 ADD PARTITION (PARTITION pm TABLESPACE = `innodb_file_per_table`); --mdev MDEV-13584 ALTER TABLE t1 ADD PARTITION (PARTITION pm); CREATE TABLE t2 like t1; ALTER TABLE t2 REMOVE PARTITIONING; diff --git a/mysql-test/main/comments.result b/mysql-test/main/comments.result index c13eb510326b3..8b3f9fba38241 100644 --- a/mysql-test/main/comments.result +++ b/mysql-test/main/comments.result @@ -64,7 +64,7 @@ SELECT 1 /*!99999 +1*/; SELECT 1 /*!100000 +1*/; 1 +1 2 -SELECT 1 /*!110000 +1*/; +SELECT 1 /*!210000 +1*/; 1 1 # @@ -86,7 +86,7 @@ SELECT 1 /*M!99999 +1*/; SELECT 1 /*M!100000 +1*/; 1 +1 2 -SELECT 1 /*M!110000 +1*/; +SELECT 1 /*M!210000 +1*/; 1 1 select 1/*!2*/; diff --git a/mysql-test/main/comments.test b/mysql-test/main/comments.test index 6cf69635d1e74..871258907801f 100644 --- a/mysql-test/main/comments.test +++ b/mysql-test/main/comments.test @@ -41,7 +41,7 @@ SELECT 1 /*!50700 +1*/; SELECT 1 /*!50999 +1*/; SELECT 1 /*!99999 +1*/; SELECT 1 /*!100000 +1*/; -SELECT 1 /*!110000 +1*/; +SELECT 1 /*!210000 +1*/; --echo # --echo # Tesing that versions >= 5.7.x and < 10.0.0 are not ignored @@ -52,7 +52,7 @@ SELECT 1 /*M!50700 +1*/; SELECT 1 /*M!50999 +1*/; SELECT 1 /*M!99999 +1*/; SELECT 1 /*M!100000 +1*/; -SELECT 1 /*M!110000 +1*/; +SELECT 1 /*M!210000 +1*/; # # Bug#25411 (trigger code truncated) diff --git a/mysql-test/main/concurrent_innodb_safelog.result b/mysql-test/main/concurrent_innodb_safelog.result index 7d120547570aa..40f89c7c65bc8 100644 --- a/mysql-test/main/concurrent_innodb_safelog.result +++ b/mysql-test/main/concurrent_innodb_safelog.result @@ -7,7 +7,7 @@ SELECT @@global.tx_isolation; @@global.tx_isolation REPEATABLE-READ # keep_locks == 1 -GRANT USAGE ON test.* TO mysqltest@localhost; +GRANT ALL ON test.* TO mysqltest@localhost; ** ** two UPDATE's running and both changing distinct result sets diff --git a/mysql-test/main/concurrent_innodb_unsafelog.result b/mysql-test/main/concurrent_innodb_unsafelog.result index 9ae80328c0b4c..3771438bc6651 100644 --- a/mysql-test/main/concurrent_innodb_unsafelog.result +++ b/mysql-test/main/concurrent_innodb_unsafelog.result @@ -8,7 +8,7 @@ SELECT @@global.tx_isolation; @@global.tx_isolation READ-COMMITTED # keep_locks == 0 -GRANT USAGE ON test.* TO mysqltest@localhost; +GRANT ALL ON test.* TO mysqltest@localhost; ** ** two UPDATE's running and both changing distinct result sets diff --git a/mysql-test/main/crash_commit_before-master.opt b/mysql-test/main/crash_commit_before-master.opt index f464a1013d7d8..d1bf57fe8206e 100644 --- a/mysql-test/main/crash_commit_before-master.opt +++ b/mysql-test/main/crash_commit_before-master.opt @@ -1,3 +1,2 @@ --loose-skip-stack-trace --skip-core-file --default-storage-engine=MyISAM ---loose-skip-innodb-file-per-table diff --git a/mysql-test/main/create_drop_role.result b/mysql-test/main/create_drop_role.result index b7ec45daeae80..7f43751c00722 100644 --- a/mysql-test/main/create_drop_role.result +++ b/mysql-test/main/create_drop_role.result @@ -51,7 +51,6 @@ u1@localhost SHOW DATABASES; Database information_schema -test SELECT CURRENT_ROLE; CURRENT_ROLE NULL diff --git a/mysql-test/main/create_or_replace.result b/mysql-test/main/create_or_replace.result index e7170632fd60c..4e96af9732649 100644 --- a/mysql-test/main/create_or_replace.result +++ b/mysql-test/main/create_or_replace.result @@ -579,5 +579,4 @@ DROP TABLE IF EXISTS tm, t; # # End of 10.3 tests # -# End of 10.4 tests SET GLOBAL innodb_stats_persistent=@save_persistent; diff --git a/mysql-test/main/create_or_replace.test b/mysql-test/main/create_or_replace.test index 58221dde4fe88..05c5d25ba1523 100644 --- a/mysql-test/main/create_or_replace.test +++ b/mysql-test/main/create_or_replace.test @@ -528,6 +528,4 @@ DROP TABLE IF EXISTS tm, t; --echo # End of 10.3 tests --echo # ---echo # End of 10.4 tests - SET GLOBAL innodb_stats_persistent=@save_persistent; diff --git a/mysql-test/main/cte_grant.result b/mysql-test/main/cte_grant.result index 96588d26b6cfa..7a982fcee9af6 100644 --- a/mysql-test/main/cte_grant.result +++ b/mysql-test/main/cte_grant.result @@ -2,7 +2,7 @@ connect root,localhost,root,,test; connection root; create database mysqltest; create user mysqltest_1@localhost; -connect user1,localhost,mysqltest_1,,test; +connect user1,localhost,mysqltest_1,,"*NO-ONE*"; connection user1; connection root; create table mysqltest.t1 (a int, b int); @@ -77,8 +77,7 @@ values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15); create user foo@localhost; grant SELECT on db.t1 to foo@localhost; grant SELECT(a) on db.t2 to foo@localhost; -connect con1,localhost,foo,,; -use db; +connect con1,localhost,foo,,db; with cte as (select * from t1 where i < 4) select * from cte; i diff --git a/mysql-test/main/cte_grant.test b/mysql-test/main/cte_grant.test index c6627c05829d1..3e6d50095693d 100644 --- a/mysql-test/main/cte_grant.test +++ b/mysql-test/main/cte_grant.test @@ -12,7 +12,7 @@ create database mysqltest; --enable_warnings create user mysqltest_1@localhost; -connect (user1,localhost,mysqltest_1,,test); +connect (user1,localhost,mysqltest_1,,"*NO-ONE*"); connection user1; connection root; @@ -96,8 +96,7 @@ create user foo@localhost; grant SELECT on db.t1 to foo@localhost; grant SELECT(a) on db.t2 to foo@localhost; ---connect (con1,localhost,foo,,) -use db; +--connect (con1,localhost,foo,,db) with cte as (select * from t1 where i < 4) select * from cte; with cte as (select * from t1 where i < 4 group by i) diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index 8320c8d3c4dcb..31bc12f23320a 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -2455,6 +2455,9 @@ select counter+1 from src where counter<10 ) select * from src; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -3861,6 +3864,9 @@ where (dt.a1) in (with recursive cte as (select a2 from t2 where a2='2' select a2 from cte); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -4120,6 +4126,9 @@ select t1.* from t1, r_cte as r where t1.c = r.a ) select 0 as b FROM dual union all select b FROM r_cte as t; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "query_specifications": [ @@ -4285,6 +4294,9 @@ select 0 as b FROM dual union all select b FROM r_cte as t) select * from t1 as tt; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/delete_returning_grant.result b/mysql-test/main/delete_returning_grant.result index b41d48a71128e..30fdf41cf67d4 100644 --- a/mysql-test/main/delete_returning_grant.result +++ b/mysql-test/main/delete_returning_grant.result @@ -10,6 +10,7 @@ CREATE DATABASE mysqltest; CREATE TABLE mysqltest.t1 SELECT * FROM t1; GRANT DELETE ON mysqltest.* TO mysqltest_1@localhost; GRANT SELECT(b) ON mysqltest.t1 TO mysqltest_1@localhost; +GRANT SELECT ON test.* TO mysqltest_1@localhost; connect user1,localhost,mysqltest_1,,test; connection user1; DELETE FROM mysqltest.t1 WHERE a=2 RETURNING b; diff --git a/mysql-test/main/delete_returning_grant.test b/mysql-test/main/delete_returning_grant.test index 67613603a7281..d21af3922619a 100644 --- a/mysql-test/main/delete_returning_grant.test +++ b/mysql-test/main/delete_returning_grant.test @@ -23,6 +23,7 @@ CREATE TABLE mysqltest.t1 SELECT * FROM t1; GRANT DELETE ON mysqltest.* TO mysqltest_1@localhost; GRANT SELECT(b) ON mysqltest.t1 TO mysqltest_1@localhost; +GRANT SELECT ON test.* TO mysqltest_1@localhost; connect (user1,localhost,mysqltest_1,,test); diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result index 3576c1fa356d4..268b111cd77bf 100644 --- a/mysql-test/main/derived.result +++ b/mysql-test/main/derived.result @@ -205,6 +205,7 @@ SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; x 1 create user mysqltest_1; +grant all on test.* to mysqltest_1; create table t1 select 1 as a; connect con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK; connection con1; diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test index e25c1c89ad30d..b256637ce2641 100644 --- a/mysql-test/main/derived.test +++ b/mysql-test/main/derived.test @@ -109,6 +109,7 @@ SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; # # Connect without a database as user mysqltest_1 create user mysqltest_1; +grant all on test.* to mysqltest_1; create table t1 select 1 as a; connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK); connection con1; diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index 9bbd32a9c8444..e07f2550297db 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -19643,6 +19643,9 @@ CREATE VIEW v1 AS SELECT a FROM t1 UNION VALUES (3),(4); ANALYZE FORMAT=JSON SELECT * from v1 WHERE a=3; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/events_grant.result b/mysql-test/main/events_grant.result index 5bdbbf0f8f1ea..5952097a8d2e3 100644 --- a/mysql-test/main/events_grant.result +++ b/mysql-test/main/events_grant.result @@ -13,6 +13,7 @@ CREATE DATABASE events_test2; CREATE USER ev_test@localhost; GRANT ALL ON events_test.* to ev_test@localhost; GRANT ALL ON events_test2.* to ev_test@localhost; +GRANT ALL ON test.* TO ev_test@localhost; REVOKE EVENT ON events_test2.* FROM ev_test@localhost; connect ev_con1,localhost,ev_test,,events_test2; select "NEW CONNECTION"; @@ -24,6 +25,7 @@ ev_test@localhost events_test2 SHOW GRANTS; Grants for ev_test@localhost GRANT USAGE ON *.* TO `ev_test`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `ev_test`@`localhost` GRANT ALL PRIVILEGES ON `events_test`.* TO `ev_test`@`localhost` GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, TRIGGER, DELETE HISTORY ON `events_test2`.* TO `ev_test`@`localhost` "Here comes an error:"; diff --git a/mysql-test/main/events_grant.test b/mysql-test/main/events_grant.test index cd5b691154226..2fe39a6cf2dde 100644 --- a/mysql-test/main/events_grant.test +++ b/mysql-test/main/events_grant.test @@ -16,6 +16,7 @@ CREATE DATABASE events_test2; CREATE USER ev_test@localhost; GRANT ALL ON events_test.* to ev_test@localhost; GRANT ALL ON events_test2.* to ev_test@localhost; +GRANT ALL ON test.* TO ev_test@localhost; REVOKE EVENT ON events_test2.* FROM ev_test@localhost; #now we are on con1 connect (ev_con1,localhost,ev_test,,events_test2); diff --git a/mysql-test/main/except.result b/mysql-test/main/except.result index 3dc4e1c94706b..d83623370d5a3 100644 --- a/mysql-test/main/except.result +++ b/mysql-test/main/except.result @@ -72,6 +72,9 @@ EXPLAIN ANALYZE format=json (select a,b from t1) except (select c,d from t2); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -131,6 +134,9 @@ ANALYZE ANALYZE format=json select * from ((select a,b from t1) except (select c,d from t2)) a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -336,6 +342,9 @@ EXPLAIN ANALYZE format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -434,6 +443,9 @@ ANALYZE format=json select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/except_all.result b/mysql-test/main/except_all.result index ac032221cc583..df19abda07781 100644 --- a/mysql-test/main/except_all.result +++ b/mysql-test/main/except_all.result @@ -115,6 +115,9 @@ Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 ANALYZE format=json select * from ((select a,b from t1) except all (select c,d from t2)) a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -196,6 +199,9 @@ ANALYZE ANALYZE format=json select * from ((select a from t1) except all (select c from t2)) a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -463,6 +469,9 @@ EXPLAIN ANALYZE format=json (select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -560,6 +569,9 @@ ANALYZE ANALYZE format=json select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result index cf1aa172146bc..3c3c0688ab8b7 100644 --- a/mysql-test/main/explain_json.result +++ b/mysql-test/main/explain_json.result @@ -1148,6 +1148,9 @@ EXPLAIN analyze format=json select count(distinct b) from t1 group by a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1446,6 +1449,9 @@ analyze format=json select * from t1; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "table": { @@ -1497,6 +1503,9 @@ analyze format=json select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1576,6 +1585,9 @@ analyze format=json select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1664,6 +1676,9 @@ analyze format=json select distinct t1.a from t1 join t2 on t2.pk=t1.a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1770,6 +1785,9 @@ analyze format=json select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/explain_json.test b/mysql-test/main/explain_json.test index 07e4ec09ad4d2..17e2da4754c60 100644 --- a/mysql-test/main/explain_json.test +++ b/mysql-test/main/explain_json.test @@ -329,6 +329,7 @@ explain select * from t1; explain format=json select * from t1; +--source include/analyze-format.inc analyze format=json select * from t1; drop table t1; diff --git a/mysql-test/main/explain_json_format_partitions.result b/mysql-test/main/explain_json_format_partitions.result index f164006d75648..b76fe29625e23 100644 --- a/mysql-test/main/explain_json_format_partitions.result +++ b/mysql-test/main/explain_json_format_partitions.result @@ -29,6 +29,9 @@ EXPLAIN analyze format=json select * from t1 where a in (2,3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -55,6 +58,9 @@ ANALYZE analyze format=json update t1 set a=a+10 where a in (2,3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_total_time_ms": "REPLACED", @@ -76,6 +82,9 @@ ANALYZE analyze format=json delete from t1 where a in (20,30,40); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_total_time_ms": "REPLACED", diff --git a/mysql-test/main/flush-innodb.result b/mysql-test/main/flush-innodb.result index 2c886e4f9fcc6..5df79e4cc0c05 100644 --- a/mysql-test/main/flush-innodb.result +++ b/mysql-test/main/flush-innodb.result @@ -8,9 +8,6 @@ DROP TABLE t1; # WL#6168: FLUSH TABLES ... FOR EXPORT -- parser # -# Requires innodb_file_per_table -SET @old_innodb_file_per_table= @@GLOBAL.innodb_file_per_table; -SET GLOBAL innodb_file_per_table= 1; # new "EXPORT" keyword is a valid user variable name: SET @export = 10; # new "EXPORT" keyword is a valid SP parameter name: @@ -300,6 +297,4 @@ DROP TABLE t1; connection con1; disconnect con1; connection default; -# Reset innodb_file_per_table -SET GLOBAL innodb_file_per_table= @old_innodb_file_per_table; # End of 5.6 tests diff --git a/mysql-test/main/flush-innodb.test b/mysql-test/main/flush-innodb.test index 7665ae5e07726..fcb0608373e32 100644 --- a/mysql-test/main/flush-innodb.test +++ b/mysql-test/main/flush-innodb.test @@ -18,10 +18,6 @@ DROP TABLE t1; --echo # --echo ---echo # Requires innodb_file_per_table -SET @old_innodb_file_per_table= @@GLOBAL.innodb_file_per_table; -SET GLOBAL innodb_file_per_table= 1; - --echo # new "EXPORT" keyword is a valid user variable name: SET @export = 10; @@ -432,7 +428,4 @@ DROP TABLE t1; --source include/wait_until_disconnected.inc --connection default ---echo # Reset innodb_file_per_table -SET GLOBAL innodb_file_per_table= @old_innodb_file_per_table; - --echo # End of 5.6 tests diff --git a/mysql-test/main/flush_notembedded.result b/mysql-test/main/flush_notembedded.result index 25ddeba17d34a..b0fa8a6dfbcda 100644 --- a/mysql-test/main/flush_notembedded.result +++ b/mysql-test/main/flush_notembedded.result @@ -9,6 +9,7 @@ create table mysqltest1.t1 (a int); create user u1@localhost; grant reload on *.* to u1@localhost; grant select on mysqltest1.* to u1@localhost; +grant all on test.* to u1@localhost; connect u1,localhost,u1; flush tables mysqltest1.t1 for export; ERROR 42000: Access denied for user 'u1'@'localhost' to database 'mysqltest1' diff --git a/mysql-test/main/flush_notembedded.test b/mysql-test/main/flush_notembedded.test index af3b8a00c55ec..193ac026cb44f 100644 --- a/mysql-test/main/flush_notembedded.test +++ b/mysql-test/main/flush_notembedded.test @@ -13,6 +13,7 @@ create table mysqltest1.t1 (a int); create user u1@localhost; grant reload on *.* to u1@localhost; grant select on mysqltest1.* to u1@localhost; +grant all on test.* to u1@localhost; connect u1,localhost,u1; error ER_DBACCESS_DENIED_ERROR; flush tables mysqltest1.t1 for export; diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result index 585e927a0d49f..d89bf9f075af8 100644 --- a/mysql-test/main/grant.result +++ b/mysql-test/main/grant.result @@ -517,7 +517,7 @@ grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost; grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost; grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost; grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost; -connect conn1,localhost,mysqltest_3,,; +connect conn1,localhost,mysqltest_3,,"*NO-ONE*",; connection conn1; SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES WHERE GRANTEE = '''mysqltest_3''@''localhost''' @@ -859,24 +859,29 @@ mysqltest_8 '%' mysqltest_8 'host8' Schema privileges grant select on mysqltest.* to mysqltest_8@''; +grant select on test.* to mysqltest_8@''; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` GRANT SELECT ON `mysqltest`.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` grant select on mysqltest.* to mysqltest_8@; show grants for mysqltest_8@; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` GRANT SELECT ON `mysqltest`.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` grant select on mysqltest.* to mysqltest_8; show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` GRANT SELECT ON `mysqltest`.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` select * from information_schema.schema_privileges where grantee like "'mysqltest_8'%"; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'%' def mysqltest SELECT NO +'mysqltest_8'@'%' def test SELECT NO connect conn3,localhost,mysqltest_8,,; select * from t1; a @@ -886,25 +891,31 @@ revoke select on mysqltest.* from mysqltest_8@''; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` select * from information_schema.schema_privileges where grantee like "'mysqltest_8'%"; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE +'mysqltest_8'@'%' def test SELECT NO flush privileges; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` show grants for mysqltest_8@; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` grant select on mysqltest.* to mysqltest_8@''; flush privileges; show grants for mysqltest_8@; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` GRANT SELECT ON `mysqltest`.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` revoke select on mysqltest.* from mysqltest_8@''; flush privileges; Column privileges @@ -913,19 +924,23 @@ grant update (a) on t1 to mysqltest_8; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` flush privileges; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` select * from information_schema.column_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE @@ -939,37 +954,45 @@ revoke update (a) on t1 from mysqltest_8@''; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` select * from information_schema.column_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE flush privileges; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` Table privileges grant update on t1 to mysqltest_8@''; grant update on t1 to mysqltest_8; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT UPDATE ON `test`.`t1` TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT UPDATE ON `test`.`t1` TO `mysqltest_8`@`%` flush privileges; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT UPDATE ON `test`.`t1` TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT UPDATE ON `test`.`t1` TO `mysqltest_8`@`%` select * from information_schema.table_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE @@ -985,9 +1008,11 @@ revoke update on t1 from mysqltest_8@''; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` select * from information_schema.table_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE 'mariadb.sys'@'localhost' def mysql global_priv SELECT NO @@ -996,9 +1021,11 @@ flush privileges; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` "DROP USER" should clear privileges grant all privileges on mysqltest.* to mysqltest_8@''; grant select on mysqltest.* to mysqltest_8@''; @@ -1008,11 +1035,13 @@ grant all privileges on mysqltest.* to mysqltest_8; show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT ALL PRIVILEGES ON `mysqltest`.* TO `mysqltest_8`@`%` GRANT UPDATE, UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT ALL PRIVILEGES ON `mysqltest`.* TO `mysqltest_8`@`%` GRANT UPDATE, UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` select * from information_schema.user_privileges @@ -1030,11 +1059,13 @@ show grants for mysqltest_8@''; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` GRANT ALL PRIVILEGES ON `mysqltest`.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT UPDATE, UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` show grants for mysqltest_8; Grants for mysqltest_8@% GRANT USAGE ON *.* TO `mysqltest_8`@`%` GRANT ALL PRIVILEGES ON `mysqltest`.* TO `mysqltest_8`@`%` +GRANT SELECT ON `test`.* TO `mysqltest_8`@`%` GRANT UPDATE, UPDATE (`a`) ON `test`.`t1` TO `mysqltest_8`@`%` drop user mysqltest_8@''; show grants for mysqltest_8@''; @@ -1066,7 +1097,7 @@ GRANT SHOW VIEW ON mysqltest2.v_ny TO 'mysqltest_1'@'localhost' IDENTIFIE GRANT SELECT ON mysqltest2.v_yn TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; GRANT SELECT ON mysqltest2.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; GRANT SHOW VIEW,SELECT ON mysqltest2.v_yy TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; -connect mysqltest_1, localhost, mysqltest_1, mysqltest_1,; +connect mysqltest_1, localhost, mysqltest_1, mysqltest_1,"*NO-ONE*"; SHOW CREATE VIEW mysqltest2.v_nn; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest2`.`v_nn` SHOW CREATE TABLE mysqltest2.v_nn; @@ -1550,7 +1581,7 @@ select db, routine_name, routine_type, proc_priv from mysql.procs_priv where use db routine_name routine_type proc_priv mysqltest1 f1 FUNCTION Execute mysqltest1 p1 PROCEDURE Execute -connect bug36544_con1,localhost,mysqluser1,,; +connect bug36544_con1,localhost,mysqluser1,,"*NO-ONE*"; call mysqltest1.p1(); select mysqltest1.f1(); mysqltest1.f1() @@ -1579,7 +1610,7 @@ Grants for mysqluser1@localhost GRANT USAGE ON *.* TO `mysqluser1`@`localhost` select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; db routine_name routine_type proc_priv -connect bug36544_con2,localhost,mysqluser1,,; +connect bug36544_con2,localhost,mysqluser1,,"*NO-ONE*"; # Newly created user should not be able to access any of the routines. call mysqltest1.p1(); ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1' @@ -1661,7 +1692,7 @@ select db, routine_name, routine_type, proc_priv from mysql.procs_priv where use db routine_name routine_type proc_priv select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost'; db table_name table_priv -connect bug36544_con3,localhost,mysqluser1,,; +connect bug36544_con3,localhost,mysqluser1,,"*NO-ONE*"; # Newly created user should not be able to access to any of the # stored routines or tables. call mysqltest1.p1(); @@ -1693,7 +1724,7 @@ select db, table_name, table_priv from mysql.tables_priv where user='mysqluser10 db table_name table_priv mysqltest1 t11 Select mysqltest1 t22 Select -connect bug36544_con4,localhost,mysqluser10,,; +connect bug36544_con4,localhost,mysqluser10,,"*NO-ONE*"; call mysqltest1.p1(); select mysqltest1.f1(); mysqltest1.f1() @@ -1826,7 +1857,7 @@ SHOW GRANTS FOR 'user1'@'localhost'; Grants for user1@localhost GRANT USAGE ON *.* TO `user1`@`localhost` GRANT CREATE, CREATE ROUTINE ON `db1`.* TO `user1`@`localhost` -connect con1,localhost,user1,,; +connect con1,localhost,user1,,"*NO-ONE*"; ** Connect as user1 and create a procedure. ** The creation will imply implicitly assigned ** EXECUTE and ALTER ROUTINE privileges to @@ -1843,7 +1874,7 @@ BEGIN SET @x = 0; REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT; END ;|| -connect con2,localhost,user2,,; +connect con2,localhost,user2,,"*NO-ONE*"; ** Connect as user2 and create a procedure. ** Implicitly assignment of privileges will ** fail because the user2@localhost is an @@ -2676,13 +2707,13 @@ DROP USER foo@'127.0.0.1'; create user foo@localhost; create database foodb; grant create routine on foodb.* to foo@localhost; -connect con1,localhost,foo; +connect con1,localhost,foo,,foodb; create procedure fooproc() select 'i am fooproc'; show grants; Grants for foo@localhost GRANT USAGE ON *.* TO `foo`@`localhost` GRANT CREATE ROUTINE ON `foodb`.* TO `foo`@`localhost` -GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO `foo`@`localhost` +GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `foodb`.`fooproc` TO `foo`@`localhost` disconnect con1; connection default; rename table mysql.procs_priv to mysql.procs_priv1; @@ -2701,9 +2732,9 @@ show grants for foo@localhost; Grants for foo@localhost GRANT USAGE ON *.* TO `foo`@`localhost` GRANT CREATE ROUTINE ON `foodb`.* TO `foo`@`localhost` -GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO `foo`@`localhost` +GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `foodb`.`fooproc` TO `foo`@`localhost` drop user foo@localhost; -drop procedure fooproc; +drop procedure foodb.fooproc; drop database foodb; # # Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS @@ -2713,14 +2744,13 @@ DROP DATABASE IF EXISTS secret; DROP DATABASE IF EXISTS no_such_db; CREATE DATABASE secret; GRANT USAGE ON *.* TO untrusted@localhost; -connect con1, localhost, untrusted; +connect con1, localhost, untrusted,,"*NO-ONE*"; SHOW GRANTS; Grants for untrusted@localhost GRANT USAGE ON *.* TO `untrusted`@`localhost` SHOW DATABASES; Database information_schema -test # Both statements below should fail with the same error. # They used to give different errors, thereby # hinting that the secret database exists. @@ -2780,7 +2810,7 @@ DROP USER dummy@localhost; CREATE USER foo; CREATE DATABASE db; CREATE TABLE db.t (a INT); -connect con1,localhost,foo,,; +connect con1,localhost,foo,,"*NO-ONE*"; GRANT ALL ON db.t TO foo; ERROR 42000: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW ... command denied to user 'foo'@'localhost' for table `db`.`t` GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT OPTION, REFERENCES, @@ -2834,12 +2864,14 @@ DROP USER bar3@localhost; # # MDEV-17946 : Unsorted acl_dbs after RENAME USER # +CREATE USER a; CREATE USER foo; GRANT SELECT ON test.* TO foo; -RENAME USER '' TO 'name'; +RENAME USER 'a' TO 'name'; GRANT UPDATE ON test.* TO foo; -RENAME USER 'name' to ''; +RENAME USER 'name' to 'a'; DROP USER foo; +DROP USER a; # # End of 10.4 tests # diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test index a243967a9c7be..69bb050778db8 100644 --- a/mysql-test/main/grant.test +++ b/mysql-test/main/grant.test @@ -327,7 +327,7 @@ grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost; grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost; grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost; grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost; -connect (conn1,localhost,mysqltest_3,,); +connect (conn1,localhost,mysqltest_3,,"*NO-ONE*",); connection conn1; SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES WHERE GRANTEE = '''mysqltest_3''@''localhost''' @@ -596,6 +596,7 @@ select user, QUOTE(host) from mysql.user where user="mysqltest_8"; --echo Schema privileges grant select on mysqltest.* to mysqltest_8@''; +grant select on test.* to mysqltest_8@''; show grants for mysqltest_8@''; grant select on mysqltest.* to mysqltest_8@; show grants for mysqltest_8@; @@ -723,7 +724,7 @@ GRANT SELECT ON mysqltest2.v_yn TO 'mysqltest_1'@'localhost' IDENTIFIE GRANT SELECT ON mysqltest2.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; GRANT SHOW VIEW,SELECT ON mysqltest2.v_yy TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; -connect (mysqltest_1, localhost, mysqltest_1, mysqltest_1,); +connect (mysqltest_1, localhost, mysqltest_1, mysqltest_1,"*NO-ONE*"); # fail because of missing SHOW VIEW (have generic SELECT) --error ER_TABLEACCESS_DENIED_ERROR @@ -1369,7 +1370,7 @@ grant execute on procedure mysqltest1.p1 to mysqluser1@localhost; --echo # in privilege tables and in in-memory structures. show grants for mysqluser1@localhost; select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; ---connect (bug36544_con1,localhost,mysqluser1,,) +--connect (bug36544_con1,localhost,mysqluser1,,"*NO-ONE*") call mysqltest1.p1(); select mysqltest1.f1(); @@ -1396,7 +1397,7 @@ select mysqltest1.f1(); create user mysqluser1@localhost; show grants for mysqluser1@localhost; select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; ---connect (bug36544_con2,localhost,mysqluser1,,) +--connect (bug36544_con2,localhost,mysqluser1,,"*NO-ONE*") --echo # Newly created user should not be able to access any of the routines. --error ER_PROCACCESS_DENIED_ERROR call mysqltest1.p1(); @@ -1463,7 +1464,7 @@ create user mysqluser1@localhost; show grants for mysqluser1@localhost; select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost'; ---connect (bug36544_con3,localhost,mysqluser1,,) +--connect (bug36544_con3,localhost,mysqluser1,,"*NO-ONE*") --echo # Newly created user should not be able to access to any of the --echo # stored routines or tables. --error ER_PROCACCESS_DENIED_ERROR @@ -1484,7 +1485,7 @@ select * from mysqltest1.t22; show grants for mysqluser10@localhost; select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser10' and host='localhost'; select db, table_name, table_priv from mysql.tables_priv where user='mysqluser10' and host='localhost'; ---connect (bug36544_con4,localhost,mysqluser10,,) +--connect (bug36544_con4,localhost,mysqluser10,,"*NO-ONE*") call mysqltest1.p1(); select mysqltest1.f1(); select * from mysqltest1.t11; @@ -1677,7 +1678,7 @@ GRANT CREATE ON db1.* TO 'user2'@'%'; GRANT CREATE ROUTINE ON db1.* TO 'user2'@'%'; FLUSH PRIVILEGES; SHOW GRANTS FOR 'user1'@'localhost'; -connect (con1,localhost,user1,,); +connect (con1,localhost,user1,,"*NO-ONE*"); --echo ** Connect as user1 and create a procedure. --echo ** The creation will imply implicitly assigned --echo ** EXECUTE and ALTER ROUTINE privileges to @@ -1693,7 +1694,7 @@ CREATE PROCEDURE db1.proc1(p1 INT) END ;|| DELIMITER ;|| -connect (con2,localhost,user2,,); +connect (con2,localhost,user2,,"*NO-ONE*"); --echo ** Connect as user2 and create a procedure. --echo ** Implicitly assignment of privileges will --echo ** fail because the user2@localhost is an @@ -2170,7 +2171,7 @@ DROP USER foo@'127.0.0.1'; create user foo@localhost; create database foodb; grant create routine on foodb.* to foo@localhost; -connect con1,localhost,foo; +connect con1,localhost,foo,,foodb; create procedure fooproc() select 'i am fooproc'; show grants; disconnect con1; @@ -2183,7 +2184,7 @@ show grants for foo@localhost; flush privileges; show grants for foo@localhost; drop user foo@localhost; -drop procedure fooproc; +drop procedure foodb.fooproc; drop database foodb; @@ -2200,7 +2201,7 @@ DROP DATABASE IF EXISTS no_such_db; CREATE DATABASE secret; GRANT USAGE ON *.* TO untrusted@localhost; -connect (con1, localhost, untrusted); +connect (con1, localhost, untrusted,,"*NO-ONE*"); SHOW GRANTS; SHOW DATABASES; @@ -2265,7 +2266,7 @@ CREATE USER foo; CREATE DATABASE db; CREATE TABLE db.t (a INT); ---connect (con1,localhost,foo,,) +--connect (con1,localhost,foo,,"*NO-ONE*") --error ER_TABLEACCESS_DENIED_ERROR GRANT ALL ON db.t TO foo; @@ -2336,12 +2337,14 @@ DROP USER bar3@localhost; --echo # --echo # MDEV-17946 : Unsorted acl_dbs after RENAME USER --echo # +CREATE USER a; CREATE USER foo; GRANT SELECT ON test.* TO foo; -RENAME USER '' TO 'name'; +RENAME USER 'a' TO 'name'; GRANT UPDATE ON test.* TO foo; -RENAME USER 'name' to ''; +RENAME USER 'name' to 'a'; DROP USER foo; +DROP USER a; --echo # --echo # End of 10.4 tests diff --git a/mysql-test/main/grant2.result b/mysql-test/main/grant2.result index b0ad299819859..6ba7ddf1e0a73 100644 --- a/mysql-test/main/grant2.result +++ b/mysql-test/main/grant2.result @@ -12,7 +12,7 @@ flush privileges; grant all privileges on `my\_1`.* to mysqltest_1@localhost with grant option; grant create user on *.* to mysqltest_1@localhost; create user mysqltest_2@localhost; -connect user_a,localhost,mysqltest_1,,; +connect user_a,localhost,mysqltest_1,,"*NO-ONE*"; connection user_a; grant select on `my\_1`.* to mysqltest_2@localhost; grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass'; @@ -20,14 +20,14 @@ ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql disconnect user_a; connection default; grant update on mysql.* to mysqltest_1@localhost; -connect user_b,localhost,mysqltest_1,,; +connect user_b,localhost,mysqltest_1,,"*NO-ONE*"; connection user_b; grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass'; grant select on `my\_1`.* to mysqltest_3@localhost; disconnect user_b; connection default; grant insert on mysql.* to mysqltest_1@localhost; -connect user_c,localhost,mysqltest_1,,; +connect user_c,localhost,mysqltest_1,,"*NO-ONE*"; connection user_c; grant select on `my\_1`.* to mysqltest_3@localhost; grant select on `my\_1`.* to mysqltest_4@localhost identified by 'pass'; @@ -40,7 +40,7 @@ delete from mysql.columns_priv where user like 'mysqltest\_%'; flush privileges; grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option; grant create user on *.* to mysqltest_1@localhost; -connect user1,localhost,mysqltest_1,,; +connect user1,localhost,mysqltest_1,,"*NO-ONE*"; connection user1; select current_user(); current_user() @@ -73,7 +73,7 @@ delete from mysql.db where user like 'mysqltest\_%'; flush privileges; create database mysqltest_1; grant all privileges on `mysqltest\_1`.* to mysqltest_1@localhost with grant option; -connect user2,localhost,mysqltest_1,,; +connect user2,localhost,mysqltest_1,,"*NO-ONE*"; connection user2; select current_user(); current_user() @@ -82,7 +82,6 @@ show databases; Database information_schema mysqltest_1 -test grant all privileges on `mysqltest_1`.* to mysqltest_1@localhost with grant option; ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest_1' disconnect user2; @@ -157,7 +156,7 @@ disconnect con9; connection default; create database mysqltest_1; grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost; -connect con10,localhost,mysqltest_1,,; +connect con10,localhost,mysqltest_1,,"*NO-ONE*"; connection con10; set sql_log_off = 1; ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation @@ -309,7 +308,7 @@ GRANT SELECT ON "mysql".* TO "%@a"@"a" drop user '%@a'@'a'; create user mysqltest_2@localhost; grant create user on *.* to mysqltest_2@localhost; -connect user3,localhost,mysqltest_2,,; +connect user3,localhost,mysqltest_2,,"*NO-ONE*"; connection user3; select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table `mysql`.`user` @@ -321,7 +320,7 @@ connection default; drop user mysqltest_2@localhost; create user mysqltest_3@localhost; grant INSERT,DELETE,UPDATE on mysql.* to mysqltest_3@localhost; -connect user4,localhost,mysqltest_3,,; +connect user4,localhost,mysqltest_3,,"*NO-ONE*"; connection user4; show grants; Grants for mysqltest_3@localhost @@ -390,7 +389,7 @@ revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.0/255.0.0.0'; delete from mysql.user where user like 'mysqltest\_1'; flush privileges; drop database mysqltest_1; -connect n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect n5,localhost,test,,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; connection n5; set password = password("changed"); ERROR 42000: You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings @@ -496,13 +495,13 @@ drop database mysqltest_2; drop user mysqltest_u1@localhost; grant all on `mysqltest\_%`.* to mysqltest_1@localhost with grant option; grant usage on *.* to mysqltest_2@localhost; -connect con18600_1,localhost,mysqltest_1,,; +connect con18600_1,localhost,mysqltest_1,,"*NO-ONE*"; create database mysqltest_1; use mysqltest_1; create table t1 (f1 int); grant create on `mysqltest\_1`.* to mysqltest_2@localhost; grant select on mysqltest_1.t1 to mysqltest_2@localhost; -connect con3,localhost,mysqltest_2,,; +connect con3,localhost,mysqltest_2,,"*NO-ONE*"; connection con3; create database mysqltest_3; ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest_3' @@ -527,7 +526,7 @@ CREATE TABLE t2 (b INT, c INT); INSERT INTO t2 VALUES (1,100),(2,200); GRANT SELECT ON t1 TO mysqltest1@localhost; GRANT SELECT (b) ON t2 TO mysqltest1@localhost; -connect conn1,localhost,mysqltest1,,; +connect conn1,localhost,mysqltest1,,"*NO-ONE*"; connection conn1; USE db1; SELECT c FROM t2; diff --git a/mysql-test/main/grant2.test b/mysql-test/main/grant2.test index b8098488709db..2866aeb348a0c 100644 --- a/mysql-test/main/grant2.test +++ b/mysql-test/main/grant2.test @@ -30,7 +30,7 @@ flush privileges; grant all privileges on `my\_1`.* to mysqltest_1@localhost with grant option; grant create user on *.* to mysqltest_1@localhost; create user mysqltest_2@localhost; -connect (user_a,localhost,mysqltest_1,,); +connect (user_a,localhost,mysqltest_1,,"*NO-ONE*"); connection user_a; grant select on `my\_1`.* to mysqltest_2@localhost; --error ER_DBACCESS_DENIED_ERROR @@ -38,14 +38,14 @@ grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass'; disconnect user_a; connection default; grant update on mysql.* to mysqltest_1@localhost; -connect (user_b,localhost,mysqltest_1,,); +connect (user_b,localhost,mysqltest_1,,"*NO-ONE*"); connection user_b; grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass'; grant select on `my\_1`.* to mysqltest_3@localhost; disconnect user_b; connection default; grant insert on mysql.* to mysqltest_1@localhost; -connect (user_c,localhost,mysqltest_1,,); +connect (user_c,localhost,mysqltest_1,,"*NO-ONE*"); connection user_c; grant select on `my\_1`.* to mysqltest_3@localhost; grant select on `my\_1`.* to mysqltest_4@localhost identified by 'pass'; @@ -63,7 +63,7 @@ flush privileges; grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option; grant create user on *.* to mysqltest_1@localhost; -connect (user1,localhost,mysqltest_1,,); +connect (user1,localhost,mysqltest_1,,"*NO-ONE*"); connection user1; select current_user(); grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; @@ -97,7 +97,7 @@ flush privileges; # create database mysqltest_1; grant all privileges on `mysqltest\_1`.* to mysqltest_1@localhost with grant option; -connect (user2,localhost,mysqltest_1,,); +connect (user2,localhost,mysqltest_1,,"*NO-ONE*"); connection user2; select current_user(); show databases; @@ -198,7 +198,7 @@ connection default; # create database mysqltest_1; grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost; -connect (con10,localhost,mysqltest_1,,); +connect (con10,localhost,mysqltest_1,,"*NO-ONE*"); connection con10; --error ER_SPECIFIC_ACCESS_DENIED_ERROR set sql_log_off = 1; @@ -342,7 +342,7 @@ drop user '%@a'@'a'; # create user mysqltest_2@localhost; grant create user on *.* to mysqltest_2@localhost; -connect (user3,localhost,mysqltest_2,,); +connect (user3,localhost,mysqltest_2,,"*NO-ONE*"); connection user3; --error ER_TABLEACCESS_DENIED_ERROR select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; @@ -356,7 +356,7 @@ drop user mysqltest_2@localhost; # INSERT/UPDATE/DELETE is ok too create user mysqltest_3@localhost; grant INSERT,DELETE,UPDATE on mysql.* to mysqltest_3@localhost; -connect (user4,localhost,mysqltest_3,,); +connect (user4,localhost,mysqltest_3,,"*NO-ONE*"); connection user4; show grants; --error ER_TABLEACCESS_DENIED_ERROR @@ -420,7 +420,7 @@ drop database mysqltest_1; --source include/add_anonymous_users.inc # But anonymous users can't change their password -connect (n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK); +connect (n5,localhost,test,,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); connection n5; --error ER_PASSWORD_ANONYMOUS_USER set password = password("changed"); @@ -589,7 +589,7 @@ drop user mysqltest_u1@localhost; # grant all on `mysqltest\_%`.* to mysqltest_1@localhost with grant option; grant usage on *.* to mysqltest_2@localhost; -connect (con18600_1,localhost,mysqltest_1,,); +connect (con18600_1,localhost,mysqltest_1,,"*NO-ONE*"); create database mysqltest_1; use mysqltest_1; @@ -597,7 +597,7 @@ create table t1 (f1 int); grant create on `mysqltest\_1`.* to mysqltest_2@localhost; grant select on mysqltest_1.t1 to mysqltest_2@localhost; -connect (con3,localhost,mysqltest_2,,); +connect (con3,localhost,mysqltest_2,,"*NO-ONE*"); connection con3; --error ER_DBACCESS_DENIED_ERROR create database mysqltest_3; @@ -631,7 +631,7 @@ INSERT INTO t2 VALUES (1,100),(2,200); GRANT SELECT ON t1 TO mysqltest1@localhost; GRANT SELECT (b) ON t2 TO mysqltest1@localhost; -connect (conn1,localhost,mysqltest1,,); +connect (conn1,localhost,mysqltest1,,"*NO-ONE*"); connection conn1; USE db1; --error ER_COLUMNACCESS_DENIED_ERROR diff --git a/mysql-test/main/grant3.result b/mysql-test/main/grant3.result index 3d0af8a436948..66f081a5689dc 100644 --- a/mysql-test/main/grant3.result +++ b/mysql-test/main/grant3.result @@ -201,6 +201,7 @@ set global sql_mode=default; create database db1; create user foo@localhost; grant create on db1.* to foo@localhost; +grant all privileges on test.* to foo@localhost; connect foo,localhost,foo; create temporary table t as values (1),(2),(3); use db1; diff --git a/mysql-test/main/grant3.test b/mysql-test/main/grant3.test index 5337d59efd863..7842233d9bdc4 100644 --- a/mysql-test/main/grant3.test +++ b/mysql-test/main/grant3.test @@ -214,6 +214,7 @@ set global sql_mode=default; create database db1; create user foo@localhost; grant create on db1.* to foo@localhost; +grant all privileges on test.* to foo@localhost; connect foo,localhost,foo; create temporary table t as values (1),(2),(3); use db1; diff --git a/mysql-test/main/grant_cache_no_prot.result b/mysql-test/main/grant_cache_no_prot.result index 1ecfc3084225a..daf382d65d31d 100644 --- a/mysql-test/main/grant_cache_no_prot.result +++ b/mysql-test/main/grant_cache_no_prot.result @@ -58,15 +58,18 @@ show status like "Qcache_hits%"; Variable_name Value Qcache_hits 0 grant SELECT on mysqltest.* to mysqltest_1@localhost; +grant SELECT on test.t1 to mysqltest_1@localhost; grant SELECT on mysqltest.t1 to mysqltest_2@localhost; grant SELECT on test.t1 to mysqltest_2@localhost; grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost; +grant SELECT(a) on test.t1 to mysqltest_3@localhost; connect user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK; connection user1; show grants for current_user(); Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` GRANT SELECT ON `mysqltest`.* TO `mysqltest_1`@`localhost` +GRANT SELECT ON `test`.`t1` TO `mysqltest_1`@`localhost` show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 6 @@ -127,7 +130,7 @@ Qcache_hits 3 show status like "Qcache_not_cached"; Variable_name Value Qcache_not_cached 1 -connect unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK; +connect unkuser,localhost,unkuser,,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; connection unkuser; show grants for current_user(); Grants for @localhost @@ -199,6 +202,7 @@ show grants; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` GRANT SELECT ON `mysqltest`.* TO `mysqltest_1`@`localhost` +GRANT SELECT ON `test`.`t1` TO `mysqltest_1`@`localhost` select a from t1; ERROR 3D000: No database selected select * from mysqltest.t1,test.t1; diff --git a/mysql-test/main/grant_cache_ps_prot.result b/mysql-test/main/grant_cache_ps_prot.result index d6f343d64597b..0fde04ac0f33b 100644 --- a/mysql-test/main/grant_cache_ps_prot.result +++ b/mysql-test/main/grant_cache_ps_prot.result @@ -58,15 +58,18 @@ show status like "Qcache_hits%"; Variable_name Value Qcache_hits 0 grant SELECT on mysqltest.* to mysqltest_1@localhost; +grant SELECT on test.t1 to mysqltest_1@localhost; grant SELECT on mysqltest.t1 to mysqltest_2@localhost; grant SELECT on test.t1 to mysqltest_2@localhost; grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost; +grant SELECT(a) on test.t1 to mysqltest_3@localhost; connect user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK; connection user1; show grants for current_user(); Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` GRANT SELECT ON `mysqltest`.* TO `mysqltest_1`@`localhost` +GRANT SELECT ON `test`.`t1` TO `mysqltest_1`@`localhost` show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 6 @@ -127,7 +130,7 @@ Qcache_hits 3 show status like "Qcache_not_cached"; Variable_name Value Qcache_not_cached 1 -connect unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK; +connect unkuser,localhost,unkuser,,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; connection unkuser; show grants for current_user(); Grants for @localhost @@ -199,6 +202,7 @@ show grants; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` GRANT SELECT ON `mysqltest`.* TO `mysqltest_1`@`localhost` +GRANT SELECT ON `test`.`t1` TO `mysqltest_1`@`localhost` select a from t1; ERROR 3D000: No database selected select * from mysqltest.t1,test.t1; diff --git a/mysql-test/main/grant_read_only.result b/mysql-test/main/grant_read_only.result index 185325f03a697..18d97cc412f5f 100644 --- a/mysql-test/main/grant_read_only.result +++ b/mysql-test/main/grant_read_only.result @@ -27,10 +27,10 @@ DROP TABLE t1; # CREATE TABLE t1 (a INT); CREATE USER user1@localhost IDENTIFIED BY ''; -GRANT INSERT, UPDATE, DELETE, READ_ONLY ADMIN ON *.* TO user1@localhost; +GRANT SELECT, INSERT, UPDATE, DELETE, READ_ONLY ADMIN ON *.* TO user1@localhost; SHOW GRANTS FOR user1@localhost; Grants for user1@localhost -GRANT INSERT, UPDATE, DELETE, READ_ONLY ADMIN ON *.* TO `user1`@`localhost` +GRANT SELECT, INSERT, UPDATE, DELETE, READ_ONLY ADMIN ON *.* TO `user1`@`localhost` SET @@GLOBAL.read_only=1; connect con1,localhost,user1,,; connection con1; @@ -46,14 +46,14 @@ SET @@GLOBAL.read_only=0; DROP USER user1@localhost; DROP TABLE t1; # -# Test that @@read_only is ignored with SUPER +# Test that @@read_only is not ignored with SUPER # CREATE TABLE t1 (a INT); CREATE USER user1@localhost IDENTIFIED BY ''; -GRANT INSERT, UPDATE, DELETE, SUPER ON *.* TO user1@localhost; +GRANT SELECT, INSERT, UPDATE, DELETE, SUPER ON *.* TO user1@localhost; SHOW GRANTS FOR user1@localhost; Grants for user1@localhost -GRANT INSERT, UPDATE, DELETE, SUPER ON *.* TO `user1`@`localhost` +GRANT SELECT, INSERT, UPDATE, DELETE, SUPER ON *.* TO `user1`@`localhost` SET @@GLOBAL.read_only=1; connect con1,localhost,user1,,; connection con1; @@ -61,7 +61,13 @@ SELECT @@read_only; @@read_only 1 UPDATE t1 SET a=11 WHERE a=10; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement DELETE FROM t1 WHERE a=11; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +connection default; +grant read only admin on *.* to user1@localhost; +disconnect con1; +connect con1,localhost,user1,,; INSERT INTO t1 VALUES (20); disconnect con1; connection default; diff --git a/mysql-test/main/grant_read_only.test b/mysql-test/main/grant_read_only.test index 25ffa3767ba32..f42bb24fe8330 100644 --- a/mysql-test/main/grant_read_only.test +++ b/mysql-test/main/grant_read_only.test @@ -36,7 +36,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT); CREATE USER user1@localhost IDENTIFIED BY ''; ## TODO: it works even without INSERT/UPDATE/DELETE: file a bug report! -GRANT INSERT, UPDATE, DELETE, READ_ONLY ADMIN ON *.* TO user1@localhost; +GRANT SELECT, INSERT, UPDATE, DELETE, READ_ONLY ADMIN ON *.* TO user1@localhost; SHOW GRANTS FOR user1@localhost; SET @@GLOBAL.read_only=1; @@ -55,21 +55,27 @@ DROP TABLE t1; --echo # ---echo # Test that @@read_only is ignored with SUPER +--echo # Test that @@read_only is not ignored with SUPER --echo # CREATE TABLE t1 (a INT); CREATE USER user1@localhost IDENTIFIED BY ''; ## TODO: it works even without INSERT/UPDATE/DELETE: file a bug report! -GRANT INSERT, UPDATE, DELETE, SUPER ON *.* TO user1@localhost; +GRANT SELECT, INSERT, UPDATE, DELETE, SUPER ON *.* TO user1@localhost; SHOW GRANTS FOR user1@localhost; SET @@GLOBAL.read_only=1; connect (con1,localhost,user1,,); connection con1; SELECT @@read_only; +--error ER_OPTION_PREVENTS_STATEMENT UPDATE t1 SET a=11 WHERE a=10; +--error ER_OPTION_PREVENTS_STATEMENT DELETE FROM t1 WHERE a=11; +connection default; +grant read only admin on *.* to user1@localhost; +disconnect con1; +connect (con1,localhost,user1,,); INSERT INTO t1 VALUES (20); disconnect con1; diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result index 7c867078f8f08..e46014e44b96f 100644 --- a/mysql-test/main/information_schema.result +++ b/mysql-test/main/information_schema.result @@ -842,7 +842,7 @@ Database Table In_use Name_locked mysql user 0 0 show status where variable_name like "%database%"; Variable_name Value -Acl_database_grants 2 +Acl_database_grants 0 Com_show_databases 3 show variables where variable_name like "skip_show_databas"; Variable_name Value diff --git a/mysql-test/main/information_schema_db.result b/mysql-test/main/information_schema_db.result index 6a6e5c498515d..725b1a125ad78 100644 --- a/mysql-test/main/information_schema_db.result +++ b/mysql-test/main/information_schema_db.result @@ -40,7 +40,7 @@ create table t1 (f1 int(10) unsigned not null, f2 varchar(100) not null, primary key (f1), unique key (f2)); -connect user1,localhost,mysqltest_1,,; +connect user1,localhost,mysqltest_1,,"*NO-ONE*"; connection user1; select * from information_schema.tables; call mbase.p1(); @@ -93,8 +93,7 @@ create user testdb_1@localhost; grant all on testdb_1.* to testdb_1@localhost with grant option; create user testdb_2@localhost; grant all on test.* to testdb_2@localhost with grant option; -connect testdb_1,localhost,testdb_1,,test; -use testdb_1; +connect testdb_1,localhost,testdb_1,,testdb_1; create table t1 (f1 char(4)); create view v1 as select f1 from t1; grant insert on v1 to testdb_2@localhost; @@ -221,7 +220,7 @@ create table testdb_1.t1 (a int); create view testdb_1.v1 as select * from testdb_1.t1; grant show view on testdb_1.* to mysqltest_1@localhost; grant select on testdb_1.v1 to mysqltest_1@localhost; -connect user1,localhost,mysqltest_1,,test; +connect user1,localhost,mysqltest_1,,"*NO-ONE*"; connection user1; select table_schema, table_name, view_definition from information_schema.views where table_name='v1'; diff --git a/mysql-test/main/information_schema_db.test b/mysql-test/main/information_schema_db.test index e60557a9526c1..fabc42e38b837 100644 --- a/mysql-test/main/information_schema_db.test +++ b/mysql-test/main/information_schema_db.test @@ -62,7 +62,7 @@ create table t1 f2 varchar(100) not null, primary key (f1), unique key (f2)); -connect (user1,localhost,mysqltest_1,,); +connect (user1,localhost,mysqltest_1,,"*NO-ONE*"); connection user1; --disable_result_log select * from information_schema.tables; @@ -122,8 +122,7 @@ grant all on testdb_1.* to testdb_1@localhost with grant option; create user testdb_2@localhost; grant all on test.* to testdb_2@localhost with grant option; -connect (testdb_1,localhost,testdb_1,,test); -use testdb_1; +connect (testdb_1,localhost,testdb_1,,testdb_1); create table t1 (f1 char(4)); create view v1 as select f1 from t1; grant insert on v1 to testdb_2@localhost; @@ -234,7 +233,7 @@ create view testdb_1.v1 as select * from testdb_1.t1; grant show view on testdb_1.* to mysqltest_1@localhost; grant select on testdb_1.v1 to mysqltest_1@localhost; -connect (user1,localhost,mysqltest_1,,test); +connect (user1,localhost,mysqltest_1,,"*NO-ONE*"); connection user1; select table_schema, table_name, view_definition from information_schema.views where table_name='v1'; diff --git a/mysql-test/main/information_schema_parameters.result b/mysql-test/main/information_schema_parameters.result index 7c73c312bd7df..1d00c992e5c8f 100644 --- a/mysql-test/main/information_schema_parameters.result +++ b/mysql-test/main/information_schema_parameters.result @@ -626,3 +626,184 @@ DTD_IDENTIFIER ROW ROUTINE_TYPE PROCEDURE -------- -------- DROP PROCEDURE p1; +# +# MDEV-20609 Full table scan in INFORMATION_SCHEMA.PARAMETERS/ROUTINES +# +DROP DATABASE IF EXISTS i_s_parameters_test; +CREATE DATABASE i_s_parameters_test; +USE i_s_parameters_test; +CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30) +RETURN CONCAT('XYZ, ' ,s); +# +# We cannot use the index due to missing condition on SPECIFIC_SCHEMA, +# but we will use SPECIFIC_NAME for filtering records from mysql.proc +FLUSH STATUS; +SELECT * FROM INFORMATION_SCHEMA.PARAMETERS +WHERE SPECIFIC_NAME = 'test_func5'; +SPECIFIC_CATALOG def +SPECIFIC_SCHEMA i_s_parameters_test +SPECIFIC_NAME test_func5 +ORDINAL_POSITION 0 +PARAMETER_MODE NULL +PARAMETER_NAME NULL +DATA_TYPE varchar +CHARACTER_MAXIMUM_LENGTH 30 +CHARACTER_OCTET_LENGTH 30 +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME latin1 +COLLATION_NAME latin1_swedish_ci +DTD_IDENTIFIER varchar(30) +ROUTINE_TYPE FUNCTION +SPECIFIC_CATALOG def +SPECIFIC_SCHEMA i_s_parameters_test +SPECIFIC_NAME test_func5 +ORDINAL_POSITION 1 +PARAMETER_MODE IN +PARAMETER_NAME s +DATA_TYPE char +CHARACTER_MAXIMUM_LENGTH 20 +CHARACTER_OCTET_LENGTH 20 +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME latin1 +COLLATION_NAME latin1_swedish_ci +DTD_IDENTIFIER char(20) +ROUTINE_TYPE FUNCTION +SHOW STATUS LIKE 'handler_read%next'; +Variable_name Value +Handler_read_next count_routines +Handler_read_rnd_next 3 +# +# We cannot use the index due to CONCAT(), and filtering by SPECIFIC_NAME +# does not work either since SPECIFIC_NAME = 'not_existing_proc'. See +# the difference in counters in comparison to the previous test +FLUSH STATUS; +SELECT * FROM INFORMATION_SCHEMA.PARAMETERS +WHERE CONCAT(SPECIFIC_SCHEMA) = 'i_s_parameters_test' + AND SPECIFIC_NAME = 'not_existing_proc'; +SHOW STATUS LIKE 'handler_read%next'; +Variable_name Value +Handler_read_next count_routines +Handler_read_rnd_next 1 +# +# Now the index must be used +FLUSH STATUS; +SELECT * FROM INFORMATION_SCHEMA.PARAMETERS +WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' + AND SPECIFIC_NAME = 'test_func5'; +SPECIFIC_CATALOG def +SPECIFIC_SCHEMA i_s_parameters_test +SPECIFIC_NAME test_func5 +ORDINAL_POSITION 0 +PARAMETER_MODE NULL +PARAMETER_NAME NULL +DATA_TYPE varchar +CHARACTER_MAXIMUM_LENGTH 30 +CHARACTER_OCTET_LENGTH 30 +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME latin1 +COLLATION_NAME latin1_swedish_ci +DTD_IDENTIFIER varchar(30) +ROUTINE_TYPE FUNCTION +SPECIFIC_CATALOG def +SPECIFIC_SCHEMA i_s_parameters_test +SPECIFIC_NAME test_func5 +ORDINAL_POSITION 1 +PARAMETER_MODE IN +PARAMETER_NAME s +DATA_TYPE char +CHARACTER_MAXIMUM_LENGTH 20 +CHARACTER_OCTET_LENGTH 20 +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME latin1 +COLLATION_NAME latin1_swedish_ci +DTD_IDENTIFIER char(20) +ROUTINE_TYPE FUNCTION +SHOW STATUS LIKE 'handler_read%next'; +Variable_name Value +Handler_read_next 1 +Handler_read_rnd_next 3 +# +# Using the first key part of the index +FLUSH STATUS; +SELECT * FROM INFORMATION_SCHEMA.PARAMETERS +WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test'; +SPECIFIC_CATALOG def +SPECIFIC_SCHEMA i_s_parameters_test +SPECIFIC_NAME test_func5 +ORDINAL_POSITION 0 +PARAMETER_MODE NULL +PARAMETER_NAME NULL +DATA_TYPE varchar +CHARACTER_MAXIMUM_LENGTH 30 +CHARACTER_OCTET_LENGTH 30 +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME latin1 +COLLATION_NAME latin1_swedish_ci +DTD_IDENTIFIER varchar(30) +ROUTINE_TYPE FUNCTION +SPECIFIC_CATALOG def +SPECIFIC_SCHEMA i_s_parameters_test +SPECIFIC_NAME test_func5 +ORDINAL_POSITION 1 +PARAMETER_MODE IN +PARAMETER_NAME s +DATA_TYPE char +CHARACTER_MAXIMUM_LENGTH 20 +CHARACTER_OCTET_LENGTH 20 +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME latin1 +COLLATION_NAME latin1_swedish_ci +DTD_IDENTIFIER char(20) +ROUTINE_TYPE FUNCTION +SHOW STATUS LIKE 'handler_read%next'; +Variable_name Value +Handler_read_next 1 +Handler_read_rnd_next 3 +# +# Test non-latin letters in procedure name +SET NAMES koi8r; +CREATE PROCEDURE `процедурка`(a INT) SELECT a; +# +# The index must be used +FLUSH STATUS; +SELECT * FROM INFORMATION_SCHEMA.PARAMETERS +WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' + AND SPECIFIC_NAME = 'процедурка'; +SPECIFIC_CATALOG def +SPECIFIC_SCHEMA i_s_parameters_test +SPECIFIC_NAME процедурка +ORDINAL_POSITION 1 +PARAMETER_MODE IN +PARAMETER_NAME a +DATA_TYPE int +CHARACTER_MAXIMUM_LENGTH NULL +CHARACTER_OCTET_LENGTH NULL +NUMERIC_PRECISION 10 +NUMERIC_SCALE 0 +DATETIME_PRECISION NULL +CHARACTER_SET_NAME NULL +COLLATION_NAME NULL +DTD_IDENTIFIER int(11) +ROUTINE_TYPE PROCEDURE +SHOW STATUS LIKE 'handler_read%next'; +Variable_name Value +Handler_read_next 1 +Handler_read_rnd_next 2 +SELECT COUNT(*) FROM information_schema.PARAMETERS +WHERE SPECIFIC_CATALOG = NULL; +COUNT(*) +# +DROP DATABASE i_s_parameters_test; +USE test; diff --git a/mysql-test/main/information_schema_parameters.test b/mysql-test/main/information_schema_parameters.test index 81aef66bfcd01..e1c64d4bacd37 100644 --- a/mysql-test/main/information_schema_parameters.test +++ b/mysql-test/main/information_schema_parameters.test @@ -276,3 +276,73 @@ DELIMITER ;$$ SELECT *, '--------' FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME = 'p1'; --horizontal_results DROP PROCEDURE p1; + + +--echo # +--echo # MDEV-20609 Full table scan in INFORMATION_SCHEMA.PARAMETERS/ROUTINES +--echo # +--disable_warnings +DROP DATABASE IF EXISTS i_s_parameters_test; +--enable_warnings + +CREATE DATABASE i_s_parameters_test; +USE i_s_parameters_test; + +CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30) + RETURN CONCAT('XYZ, ' ,s); + +--let count_routines = `select count(*) from information_schema.routines` + +--echo # +--echo # We cannot use the index due to missing condition on SPECIFIC_SCHEMA, +--echo # but we will use SPECIFIC_NAME for filtering records from mysql.proc +FLUSH STATUS; +query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS + WHERE SPECIFIC_NAME = 'test_func5'; +--replace_result $count_routines count_routines +SHOW STATUS LIKE 'handler_read%next'; + +--echo # +--echo # We cannot use the index due to CONCAT(), and filtering by SPECIFIC_NAME +--echo # does not work either since SPECIFIC_NAME = 'not_existing_proc'. See +--echo # the difference in counters in comparison to the previous test +FLUSH STATUS; +query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS + WHERE CONCAT(SPECIFIC_SCHEMA) = 'i_s_parameters_test' + AND SPECIFIC_NAME = 'not_existing_proc'; +--replace_result $count_routines count_routines +SHOW STATUS LIKE 'handler_read%next'; +--echo # +--echo # Now the index must be used +FLUSH STATUS; +query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS + WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' + AND SPECIFIC_NAME = 'test_func5'; +SHOW STATUS LIKE 'handler_read%next'; + +--echo # +--echo # Using the first key part of the index +FLUSH STATUS; +query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS + WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test'; +SHOW STATUS LIKE 'handler_read%next'; + +--echo # +--echo # Test non-latin letters in procedure name +SET NAMES koi8r; +CREATE PROCEDURE `процедурка`(a INT) SELECT a; +--echo # +--echo # The index must be used +FLUSH STATUS; +query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS + WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' + AND SPECIFIC_NAME = 'процедурка'; +SHOW STATUS LIKE 'handler_read%next'; + +--replace_column 1 # +SELECT COUNT(*) FROM information_schema.PARAMETERS + WHERE SPECIFIC_CATALOG = NULL; + +# Cleanup +DROP DATABASE i_s_parameters_test; +USE test; diff --git a/mysql-test/main/information_schema_routines.result b/mysql-test/main/information_schema_routines.result index 35f12510556a9..b5b43db71cec4 100644 --- a/mysql-test/main/information_schema_routines.result +++ b/mysql-test/main/information_schema_routines.result @@ -851,3 +851,269 @@ WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func5'; SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION test_func5 def i_s_routines_test test_func5 FUNCTION varchar 30 90 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(30) SQL RETURN CONCAT('XYZ, ' ,s) NULL NULL SQL NO CONTAINS SQL NULL DEFINER root@localhost latin1 latin1_swedish_ci utf8mb3_general_ci DROP DATABASE i_s_routines_test; +# +# MDEV-20609 Full table scan in INFORMATION_SCHEMA.PARAMETERS/ROUTINES +# +DROP DATABASE IF EXISTS i_s_routines_test; +CREATE DATABASE i_s_routines_test; +USE i_s_routines_test; +CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30) +RETURN CONCAT('XYZ, ' ,s); +# +# We cannot use the index due to missing condition on SPECIFIC_SCHEMA, +# but we will use ROUTINE_NAME for filtering records from mysql.proc +FLUSH STATUS; +SELECT * FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_NAME = 'test_func5'; +SPECIFIC_NAME test_func5 +ROUTINE_CATALOG def +ROUTINE_SCHEMA i_s_routines_test +ROUTINE_NAME test_func5 +ROUTINE_TYPE FUNCTION +DATA_TYPE varchar +CHARACTER_MAXIMUM_LENGTH 30 +CHARACTER_OCTET_LENGTH 30 +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME latin1 +COLLATION_NAME latin1_swedish_ci +DTD_IDENTIFIER varchar(30) +ROUTINE_BODY SQL +ROUTINE_DEFINITION RETURN CONCAT('XYZ, ' ,s) +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE DEFINER +CREATED +LAST_ALTERED +SQL_MODE +ROUTINE_COMMENT +DEFINER root@localhost +CHARACTER_SET_CLIENT latin1 +COLLATION_CONNECTION latin1_swedish_ci +DATABASE_COLLATION latin1_swedish_ci +SHOW STATUS LIKE 'handler_read%next'; +Variable_name Value +Handler_read_next count_routines +Handler_read_rnd_next 2 +# +# We cannot use the index due to CONCAT(), and filtering by ROUTINE_NAME +# does not work either since ROUTINE_NAME = 'not_existing_proc'. See +# the difference in counters in comparison to the previous test +FLUSH STATUS; +SELECT * FROM INFORMATION_SCHEMA.ROUTINES +WHERE CONCAT(ROUTINE_SCHEMA) = 'i_s_routines_test' + AND ROUTINE_NAME = 'not_existing_proc'; +SHOW STATUS LIKE 'handler_read%next'; +Variable_name Value +Handler_read_next count_routines +Handler_read_rnd_next 1 +# +# Now the index must be used +FLUSH STATUS; +SELECT * FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_SCHEMA = 'i_s_routines_test' + AND ROUTINE_NAME = 'test_func5'; +SPECIFIC_NAME test_func5 +ROUTINE_CATALOG def +ROUTINE_SCHEMA i_s_routines_test +ROUTINE_NAME test_func5 +ROUTINE_TYPE FUNCTION +DATA_TYPE varchar +CHARACTER_MAXIMUM_LENGTH 30 +CHARACTER_OCTET_LENGTH 30 +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME latin1 +COLLATION_NAME latin1_swedish_ci +DTD_IDENTIFIER varchar(30) +ROUTINE_BODY SQL +ROUTINE_DEFINITION RETURN CONCAT('XYZ, ' ,s) +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE DEFINER +CREATED +LAST_ALTERED +SQL_MODE +ROUTINE_COMMENT +DEFINER root@localhost +CHARACTER_SET_CLIENT latin1 +COLLATION_CONNECTION latin1_swedish_ci +DATABASE_COLLATION latin1_swedish_ci +SHOW STATUS LIKE 'handler_read%next'; +Variable_name Value +Handler_read_next 1 +Handler_read_rnd_next 2 +# +# Using the first key part of the index +FLUSH STATUS; +SELECT * FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_SCHEMA = 'i_s_routines_test'; +SPECIFIC_NAME test_func5 +ROUTINE_CATALOG def +ROUTINE_SCHEMA i_s_routines_test +ROUTINE_NAME test_func5 +ROUTINE_TYPE FUNCTION +DATA_TYPE varchar +CHARACTER_MAXIMUM_LENGTH 30 +CHARACTER_OCTET_LENGTH 30 +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME latin1 +COLLATION_NAME latin1_swedish_ci +DTD_IDENTIFIER varchar(30) +ROUTINE_BODY SQL +ROUTINE_DEFINITION RETURN CONCAT('XYZ, ' ,s) +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE DEFINER +CREATED +LAST_ALTERED +SQL_MODE +ROUTINE_COMMENT +DEFINER root@localhost +CHARACTER_SET_CLIENT latin1 +COLLATION_CONNECTION latin1_swedish_ci +DATABASE_COLLATION latin1_swedish_ci +SHOW STATUS LIKE 'handler_read%next'; +Variable_name Value +Handler_read_next 1 +Handler_read_rnd_next 2 +# +# Test non-latin letters in procedure name +SET NAMES koi8r; +CREATE PROCEDURE `процедурка`(a INT) SELECT a; +# +# The index must be used +FLUSH STATUS; +SELECT * FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_SCHEMA = 'i_s_routines_test' + AND ROUTINE_NAME = 'процедурка'; +SPECIFIC_NAME процедурка +ROUTINE_CATALOG def +ROUTINE_SCHEMA i_s_routines_test +ROUTINE_NAME процедурка +ROUTINE_TYPE PROCEDURE +DATA_TYPE +CHARACTER_MAXIMUM_LENGTH NULL +CHARACTER_OCTET_LENGTH NULL +NUMERIC_PRECISION NULL +NUMERIC_SCALE NULL +DATETIME_PRECISION NULL +CHARACTER_SET_NAME NULL +COLLATION_NAME NULL +DTD_IDENTIFIER NULL +ROUTINE_BODY SQL +ROUTINE_DEFINITION SELECT a +EXTERNAL_NAME NULL +EXTERNAL_LANGUAGE NULL +PARAMETER_STYLE SQL +IS_DETERMINISTIC NO +SQL_DATA_ACCESS CONTAINS SQL +SQL_PATH NULL +SECURITY_TYPE DEFINER +CREATED +LAST_ALTERED +SQL_MODE +ROUTINE_COMMENT +DEFINER root@localhost +CHARACTER_SET_CLIENT koi8r +COLLATION_CONNECTION koi8r_general_ci +DATABASE_COLLATION latin1_swedish_ci +SHOW STATUS LIKE 'handler_read%next'; +Variable_name Value +Handler_read_next 1 +Handler_read_rnd_next 2 +# +# Test SHOW PROCEDURE STATUS. It's impossible to use the index here +# so don't check Handler_read counters, only the results correctness +SHOW FUNCTION STATUS LIKE 'test_func5'; +Db i_s_routines_test +Name test_func5 +Type FUNCTION +Definer root@localhost +Modified +Created +Security_type DEFINER +Comment +character_set_client latin1 +collation_connection latin1_swedish_ci +Database Collation latin1_swedish_ci +SHOW FUNCTION STATUS LIKE 'test_%'; +Db i_s_routines_test +Name test_func5 +Type FUNCTION +Definer root@localhost +Modified +Created +Security_type DEFINER +Comment +character_set_client latin1 +collation_connection latin1_swedish_ci +Database Collation latin1_swedish_ci +SHOW FUNCTION STATUS LIKE '%func%'; +Db i_s_routines_test +Name test_func5 +Type FUNCTION +Definer root@localhost +Modified +Created +Security_type DEFINER +Comment +character_set_client latin1 +collation_connection latin1_swedish_ci +Database Collation latin1_swedish_ci +SHOW FUNCTION STATUS LIKE 'test'; +SHOW PROCEDURE STATUS LIKE 'процедурка'; +Db i_s_routines_test +Name процедурка +Type PROCEDURE +Definer root@localhost +Modified +Created +Security_type DEFINER +Comment +character_set_client koi8r +collation_connection koi8r_general_ci +Database Collation latin1_swedish_ci +SHOW PROCEDURE STATUS LIKE '%оцедурка'; +Db i_s_routines_test +Name процедурка +Type PROCEDURE +Definer root@localhost +Modified +Created +Security_type DEFINER +Comment +character_set_client koi8r +collation_connection koi8r_general_ci +Database Collation latin1_swedish_ci +SHOW PROCEDURE STATUS LIKE '%оцедур%'; +Db i_s_routines_test +Name процедурка +Type PROCEDURE +Definer root@localhost +Modified +Created +Security_type DEFINER +Comment +character_set_client koi8r +collation_connection koi8r_general_ci +Database Collation latin1_swedish_ci +SHOW PROCEDURE STATUS LIKE 'такой_нет'; +DROP DATABASE i_s_routines_test; +USE test; diff --git a/mysql-test/main/information_schema_routines.test b/mysql-test/main/information_schema_routines.test index a07e54cd70b0a..f95124098113c 100644 --- a/mysql-test/main/information_schema_routines.test +++ b/mysql-test/main/information_schema_routines.test @@ -249,3 +249,94 @@ WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func5'; # final clean up DROP DATABASE i_s_routines_test; + +--echo # +--echo # MDEV-20609 Full table scan in INFORMATION_SCHEMA.PARAMETERS/ROUTINES +--echo # +--disable_warnings +DROP DATABASE IF EXISTS i_s_routines_test; +--enable_warnings + +CREATE DATABASE i_s_routines_test; +USE i_s_routines_test; + +CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30) + RETURN CONCAT('XYZ, ' ,s); + + +--let count_routines = `select count(*) from information_schema.routines` + +--echo # +--echo # We cannot use the index due to missing condition on SPECIFIC_SCHEMA, +--echo # but we will use ROUTINE_NAME for filtering records from mysql.proc +FLUSH STATUS; +--replace_column 24 25 +query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES + WHERE ROUTINE_NAME = 'test_func5'; +--replace_result $count_routines count_routines +SHOW STATUS LIKE 'handler_read%next'; + +--echo # +--echo # We cannot use the index due to CONCAT(), and filtering by ROUTINE_NAME +--echo # does not work either since ROUTINE_NAME = 'not_existing_proc'. See +--echo # the difference in counters in comparison to the previous test +FLUSH STATUS; +query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES + WHERE CONCAT(ROUTINE_SCHEMA) = 'i_s_routines_test' + AND ROUTINE_NAME = 'not_existing_proc'; +--replace_result $count_routines count_routines +SHOW STATUS LIKE 'handler_read%next'; + +--echo # +--echo # Now the index must be used +FLUSH STATUS; +--replace_column 24 25 +query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES + WHERE ROUTINE_SCHEMA = 'i_s_routines_test' + AND ROUTINE_NAME = 'test_func5'; +SHOW STATUS LIKE 'handler_read%next'; + +--echo # +--echo # Using the first key part of the index +FLUSH STATUS; +--replace_column 24 25 +query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES + WHERE ROUTINE_SCHEMA = 'i_s_routines_test'; +SHOW STATUS LIKE 'handler_read%next'; + +--echo # +--echo # Test non-latin letters in procedure name +SET NAMES koi8r; +CREATE PROCEDURE `процедурка`(a INT) SELECT a; +--echo # +--echo # The index must be used +FLUSH STATUS; +--replace_column 24 25 +query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES + WHERE ROUTINE_SCHEMA = 'i_s_routines_test' + AND ROUTINE_NAME = 'процедурка'; +SHOW STATUS LIKE 'handler_read%next'; + +--echo # +--echo # Test SHOW PROCEDURE STATUS. It's impossible to use the index here +--echo # so don't check Handler_read counters, only the results correctness +--replace_column 5 6 +query_vertical SHOW FUNCTION STATUS LIKE 'test_func5'; +--replace_column 5 6 +query_vertical SHOW FUNCTION STATUS LIKE 'test_%'; +--replace_column 5 6 +query_vertical SHOW FUNCTION STATUS LIKE '%func%'; +--replace_column 5 6 +query_vertical SHOW FUNCTION STATUS LIKE 'test'; +--replace_column 5 6 +query_vertical SHOW PROCEDURE STATUS LIKE 'процедурка'; +--replace_column 5 6 +query_vertical SHOW PROCEDURE STATUS LIKE '%оцедурка'; +--replace_column 5 6 +query_vertical SHOW PROCEDURE STATUS LIKE '%оцедур%'; +--replace_column 5 6 +query_vertical SHOW PROCEDURE STATUS LIKE 'такой_нет'; + +# Cleanup +DROP DATABASE i_s_routines_test; +USE test; diff --git a/mysql-test/main/init_connect.result b/mysql-test/main/init_connect.result index 11bb603615647..876a6a14b4e5f 100644 --- a/mysql-test/main/init_connect.result +++ b/mysql-test/main/init_connect.result @@ -3,21 +3,21 @@ connection con0; select hex(@a); hex(@a) NULL -connect con1,localhost,user_1,,; +connect con1,localhost,user_1,,"*NO-ONE*"; connection con1; select hex(@a); hex(@a) 610063 connection con0; set global init_connect="set @a=2;set @b=3"; -connect con2,localhost,user_1,,; +connect con2,localhost,user_1,,"*NO-ONE*"; connection con2; select @a, @b; @a @b 2 3 connection con0; set GLOBAL init_connect=DEFAULT; -connect con3,localhost,user_1,,; +connect con3,localhost,user_1,,"*NO-ONE*"; connection con3; select @a; @a @@ -25,7 +25,9 @@ NULL connection con0; set global init_connect="drop table if exists t1; create table t1(a char(10));\ insert into t1 values ('\0');insert into t1 values('abc')"; -connect con4,localhost,user_1,,; +create user 'user_1'@'localhost'; +GRANT DROP,CREATE,SELECT,INSERT ON test.* TO 'user_1'@'localhost'; +connect con4,localhost,user_1,,test; connection con4; select hex(a) from t1; hex(a) @@ -33,7 +35,7 @@ hex(a) 616263 connection con0; set GLOBAL init_connect="adsfsdfsdfs"; -connect con5,localhost,user_1,,; +connect con5,localhost,user_1,,test; connection con5; select @a; ERROR 08S01: Aborted connection to db: 'test' user: 'user_1' host: 'localhost' (init_connect command failed) @@ -46,6 +48,7 @@ disconnect con2; disconnect con3; disconnect con4; disconnect con5; +drop user 'user_1'@'localhost'; End of 4.1 tests create table t1 (x int); insert into t1 values (3), (5), (7); @@ -53,7 +56,7 @@ create table t2 (y int); create user mysqltest1@localhost; grant all privileges on test.* to mysqltest1@localhost; set global init_connect="create procedure p1() select * from t1"; -connect con1,localhost,mysqltest1,,; +connect con1,localhost,mysqltest1,,test; connection con1; call p1(); x @@ -69,7 +72,7 @@ begin\ select * from t1;\ set @x = x; end"; -connect con1,localhost,mysqltest1,,; +connect con1,localhost,mysqltest1,,test; connection con1; call p1(42); count(*) @@ -84,7 +87,7 @@ select @x; connection con0; disconnect con1; set global init_connect="call p1(4711)"; -connect con1,localhost,mysqltest1,,; +connect con1,localhost,mysqltest1,,test; connection con1; select @x; @x @@ -92,7 +95,7 @@ select @x; connection con0; disconnect con1; set global init_connect="drop procedure if exists p1"; -connect con1,localhost,mysqltest1,,; +connect con1,localhost,mysqltest1,,test; connection con1; call p1(); ERROR 42000: PROCEDURE test.p1 does not exist @@ -119,7 +122,7 @@ end; end loop; end| set global init_connect="call p1(@sum)"; -connect con1,localhost,mysqltest1,,; +connect con1,localhost,mysqltest1,,test; connection con1; select @sum; @sum @@ -136,7 +139,7 @@ execute stmt1 using @v; deallocate prepare stmt1; end| set global init_connect="call p1('t1', 11)"; -connect con1,localhost,mysqltest1,,; +connect con1,localhost,mysqltest1,,test; connection con1; select * from t1; x @@ -154,7 +157,7 @@ select count(*) into n from t1; return n; end| set global init_connect="set @x = f1()"; -connect con1,localhost,mysqltest1,,; +connect con1,localhost,mysqltest1,,test; connection con1; select @x; @x @@ -162,7 +165,7 @@ select @x; connection con0; disconnect con1; set global init_connect="create view v1 as select f1()"; -connect con1,localhost,mysqltest1,,; +connect con1,localhost,mysqltest1,,test; connection con1; select * from v1; f1() @@ -170,7 +173,7 @@ f1() connection con0; disconnect con1; set global init_connect="drop view v1"; -connect con1,localhost,mysqltest1,,; +connect con1,localhost,mysqltest1,,test; connection con1; select * from v1; ERROR 42S02: Table 'test.v1' doesn't exist @@ -182,7 +185,7 @@ after insert on t2 for each row insert into t1 values (new.y); set global init_connect="insert into t2 values (13), (17), (19)"; -connect con1,localhost,mysqltest1,,; +connect con1,localhost,mysqltest1,,test; connection con1; select * from t1; x diff --git a/mysql-test/main/init_connect.test b/mysql-test/main/init_connect.test index e96d02fe0d1ba..c210ea10850d8 100644 --- a/mysql-test/main/init_connect.test +++ b/mysql-test/main/init_connect.test @@ -13,28 +13,30 @@ connect (con0,localhost,root,,); connection con0; select hex(@a); -connect (con1,localhost,user_1,,); +connect (con1,localhost,user_1,,"*NO-ONE*"); connection con1; select hex(@a); connection con0; set global init_connect="set @a=2;set @b=3"; -connect (con2,localhost,user_1,,); +connect (con2,localhost,user_1,,"*NO-ONE*"); connection con2; select @a, @b; connection con0; set GLOBAL init_connect=DEFAULT; -connect (con3,localhost,user_1,,); +connect (con3,localhost,user_1,,"*NO-ONE*"); connection con3; select @a; connection con0; set global init_connect="drop table if exists t1; create table t1(a char(10));\ insert into t1 values ('\0');insert into t1 values('abc')"; -connect (con4,localhost,user_1,,); +create user 'user_1'@'localhost'; +GRANT DROP,CREATE,SELECT,INSERT ON test.* TO 'user_1'@'localhost'; +connect (con4,localhost,user_1,,test); connection con4; select hex(a) from t1; connection con0; set GLOBAL init_connect="adsfsdfsdfs"; -connect (con5,localhost,user_1,,); +connect (con5,localhost,user_1,,test); connection con5; # BUG#11755281/47032: ERROR 2006 / ERROR 2013 INSTEAD OF PROPER ERROR MESSAGE # We now throw a proper error message here: @@ -54,6 +56,7 @@ disconnect con2; disconnect con3; disconnect con4; disconnect con5; +drop user 'user_1'@'localhost'; --source include/delete_anonymous_users.inc @@ -72,7 +75,7 @@ grant all privileges on test.* to mysqltest1@localhost; # Create a simple procedure # set global init_connect="create procedure p1() select * from t1"; -connect (con1,localhost,mysqltest1,,); +connect (con1,localhost,mysqltest1,,test); connection con1; call p1(); drop procedure p1; @@ -88,7 +91,7 @@ begin\ select * from t1;\ set @x = x; end"; -connect (con1,localhost,mysqltest1,,); +connect (con1,localhost,mysqltest1,,test); connection con1; call p1(42); select @x; @@ -99,7 +102,7 @@ disconnect con1; # Just call it - this will not generate any output # set global init_connect="call p1(4711)"; -connect (con1,localhost,mysqltest1,,); +connect (con1,localhost,mysqltest1,,test); connection con1; select @x; @@ -109,7 +112,7 @@ disconnect con1; # Drop the procedure # set global init_connect="drop procedure if exists p1"; -connect (con1,localhost,mysqltest1,,); +connect (con1,localhost,mysqltest1,,test); connection con1; --error ER_SP_DOES_NOT_EXIST call p1(); @@ -145,7 +148,7 @@ end| delimiter ;| # Call the procedure with a cursor set global init_connect="call p1(@sum)"; -connect (con1,localhost,mysqltest1,,); +connect (con1,localhost,mysqltest1,,test); connection con1; select @sum; @@ -167,7 +170,7 @@ end| delimiter ;| # Call the procedure with prepared statements set global init_connect="call p1('t1', 11)"; -connect (con1,localhost,mysqltest1,,); +connect (con1,localhost,mysqltest1,,test); connection con1; select * from t1; @@ -188,7 +191,7 @@ end| delimiter ;| # Invoke a function set global init_connect="set @x = f1()"; -connect (con1,localhost,mysqltest1,,); +connect (con1,localhost,mysqltest1,,test); connection con1; select @x; @@ -198,7 +201,7 @@ disconnect con1; # Create a view # set global init_connect="create view v1 as select f1()"; -connect (con1,localhost,mysqltest1,,); +connect (con1,localhost,mysqltest1,,test); connection con1; select * from v1; @@ -208,7 +211,7 @@ disconnect con1; # Drop the view # set global init_connect="drop view v1"; -connect (con1,localhost,mysqltest1,,); +connect (con1,localhost,mysqltest1,,test); connection con1; --error ER_NO_SUCH_TABLE select * from v1; @@ -225,7 +228,7 @@ drop function f1; # after insert on t2\ # for each row\ # insert into t1 values (new.y)"; -#connect (con1,localhost,mysqltest1,,); +#connect (con1,localhost,mysqltest1,,test); #connection con1; #insert into t2 values (2), (4); #select * from t1; @@ -240,7 +243,7 @@ create trigger trg1 # Invoke trigger set global init_connect="insert into t2 values (13), (17), (19)"; -connect (con1,localhost,mysqltest1,,); +connect (con1,localhost,mysqltest1,,test); connection con1; select * from t1; diff --git a/mysql-test/main/intersect.result b/mysql-test/main/intersect.result index c7858b49cd445..425f6940a354c 100644 --- a/mysql-test/main/intersect.result +++ b/mysql-test/main/intersect.result @@ -102,6 +102,9 @@ EXPLAIN ANALYZE format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -184,6 +187,9 @@ ANALYZE ANALYZE format=json select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -388,6 +394,9 @@ EXPLAIN ANALYZE format=json (select a,b from t1) intersect (select c,e from t2,t3); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -466,6 +475,9 @@ ANALYZE ANALYZE format=json select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/intersect_all.result b/mysql-test/main/intersect_all.result index 6c7a9c1cdd26a..aecd5b1ac18ad 100644 --- a/mysql-test/main/intersect_all.result +++ b/mysql-test/main/intersect_all.result @@ -114,6 +114,9 @@ EXPLAIN ANALYZE format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -196,6 +199,9 @@ ANALYZE ANALYZE format=json select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -419,6 +425,9 @@ EXPLAIN ANALYZE format=json (select a,b from t1) intersect all (select c,e from t2,t3); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -497,6 +506,9 @@ ANALYZE ANALYZE format=json select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/invisible_field_grant_completely.result b/mysql-test/main/invisible_field_grant_completely.result index b1b313072b2b3..f0992baf7b14b 100644 --- a/mysql-test/main/invisible_field_grant_completely.result +++ b/mysql-test/main/invisible_field_grant_completely.result @@ -19,12 +19,11 @@ grant insert(a) on t1 to user_1; grant update(a) on t1 to user_1; grant select(a) on t1 to user_1; grant delete on t1 to user_1; -connect con1, localhost, user_1,,test; +connect con1, localhost, user_1,,d; connection con1; select user(); user() user_1@localhost -use d; select * from t1; a 1 diff --git a/mysql-test/main/invisible_field_grant_completely.test b/mysql-test/main/invisible_field_grant_completely.test index aeca66b97d26f..b27071ada5672 100644 --- a/mysql-test/main/invisible_field_grant_completely.test +++ b/mysql-test/main/invisible_field_grant_completely.test @@ -21,10 +21,9 @@ grant insert(a) on t1 to user_1; grant update(a) on t1 to user_1; grant select(a) on t1 to user_1; grant delete on t1 to user_1; -connect (con1, localhost, user_1,,test); +connect (con1, localhost, user_1,,d); connection con1; select user(); -use d; select * from t1; insert into t1 values(2); select * from t1; diff --git a/mysql-test/main/invisible_field_grant_system.result b/mysql-test/main/invisible_field_grant_system.result index d2e40c391c42f..86e40736f1116 100644 --- a/mysql-test/main/invisible_field_grant_system.result +++ b/mysql-test/main/invisible_field_grant_system.result @@ -19,12 +19,11 @@ grant insert(a) on t1 to user_1; grant update(a) on t1 to user_1; grant select(a) on t1 to user_1; grant delete on t1 to user_1; -connect con1, localhost, user_1,,test; +connect con1, localhost, user_1,,d; connection con1; select user(); user() user_1@localhost -use d; select * from t1; a 1 diff --git a/mysql-test/main/invisible_field_grant_system.test b/mysql-test/main/invisible_field_grant_system.test index fd54ea72a5ac9..04ea5f14be130 100644 --- a/mysql-test/main/invisible_field_grant_system.test +++ b/mysql-test/main/invisible_field_grant_system.test @@ -18,10 +18,9 @@ grant insert(a) on t1 to user_1; grant update(a) on t1 to user_1; grant select(a) on t1 to user_1; grant delete on t1 to user_1; -connect (con1, localhost, user_1,,test); +connect (con1, localhost, user_1,,d); connection con1; select user(); -use d; select * from t1; insert into t1 values(2); select * from t1; diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index b32a278d3a187..938167035a254 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -6056,8 +6056,7 @@ SET join_cache_level = 3; explain SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.db WHERE Select_priv = PAGE_FAULTS_MINOR; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL Using where -1 SIMPLE db hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 2 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables set join_cache_level=@save_join_cache_level; create table t1 (c1 date not null, key (c1)) engine=innodb; insert t1 values ('2017-12-27'); diff --git a/mysql-test/main/lock_multi.result b/mysql-test/main/lock_multi.result index 30cd63e60ed73..52196d835ec79 100644 --- a/mysql-test/main/lock_multi.result +++ b/mysql-test/main/lock_multi.result @@ -128,7 +128,6 @@ mysql.global_priv optimize status OK UNLOCK TABLES; connection reader; host -localhost USE test; connection locker; use test; diff --git a/mysql-test/main/lock_view.result b/mysql-test/main/lock_view.result index 47a7e58ea0d46..8137300f3e364 100644 --- a/mysql-test/main/lock_view.result +++ b/mysql-test/main/lock_view.result @@ -181,7 +181,6 @@ information_schema mysqltest1 mysqltest2 performance_schema -test lock table mysqltest3.v3ps write; select * from mysqltest3.v3ps; user diff --git a/mysql-test/main/log_slow.result b/mysql-test/main/log_slow.result index 6b9fddb7fb63e..8f2d3194a271f 100644 --- a/mysql-test/main/log_slow.result +++ b/mysql-test/main/log_slow.result @@ -13,6 +13,10 @@ Variable_name Value log_slow_admin_statements ON log_slow_disabled_statements sp log_slow_filter admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk +log_slow_min_examined_row_limit 0 +log_slow_query ON +log_slow_query_file $PATH/mysqld-slow.log +log_slow_query_time 10.000000 log_slow_rate_limit 1 log_slow_slave_statements ON log_slow_verbosity diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test index d2e314cf66723..f79a406a964c8 100644 --- a/mysql-test/main/log_slow.test +++ b/mysql-test/main/log_slow.test @@ -9,6 +9,7 @@ set @@log_slow_verbosity=""; select @@log_slow_filter; select @@log_slow_rate_limit; select @@log_slow_verbosity; +--replace_regex /\S+mysqld-slow.log/$PATH\/mysqld-slow.log/ show variables like "log_slow%"; set @org_slow_query_log= @@global.slow_query_log; diff --git a/mysql-test/main/long_host.result b/mysql-test/main/long_host.result index 57b637de5874f..52b479b66f7c8 100644 --- a/mysql-test/main/long_host.result +++ b/mysql-test/main/long_host.result @@ -20,7 +20,7 @@ create table mariadbtestdb.t3 (a int); SET @saved_dbug = @@GLOBAL.debug_dbug; set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_long_host,getaddrinfo_fake_good_ipv4"; # check connect -connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,; +connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,; connection con1; select current_user(); current_user() @@ -43,7 +43,7 @@ a connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; -connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,; +connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,; connection con1; select * from mariadbtestdb.t1; ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1` @@ -53,7 +53,7 @@ ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_3456 connection default; grant SELECT ON mariadbtestdb.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; -connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,; +connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,; connection con1; select * from mariadbtestdb.t1; a b @@ -66,7 +66,7 @@ connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; grant SELECT ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; -connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,; +connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,; connection con1; select * from mariadbtestdb.t1; a b @@ -79,7 +79,7 @@ connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; grant SELECT (a) ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; -connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,; +connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,; connection con1; select * from mariadbtestdb.t1; ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1` @@ -96,6 +96,7 @@ CREATE ROLE role5678901_345678902_345678903_345678904_345678905_345678906_345678 ERROR HY000: String 'role5678901_345678902_345678903_345678904_345678905_345678906_34567...' is too long for user name (should be no longer than 128) grant SELECT (a) ON mariadbtestdb.t1 TO role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; +GRANT CREATE ROUTINE on test.* to user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; grant role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678 to user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,; diff --git a/mysql-test/main/long_host.test b/mysql-test/main/long_host.test index 0c082bf6fb41b..301744a1f11f0 100644 --- a/mysql-test/main/long_host.test +++ b/mysql-test/main/long_host.test @@ -36,7 +36,7 @@ set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_long_host,ge --echo # check connect -connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,); +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,); connection con1; select current_user(); @@ -61,7 +61,7 @@ select * from mariadbtestdb2.t2; connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; -connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,); +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,); connection con1; --error ER_TABLEACCESS_DENIED_ERROR select * from mariadbtestdb.t1; @@ -74,7 +74,7 @@ select * from mariadbtestdb2.t2; connection default; grant SELECT ON mariadbtestdb.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; -connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,); +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,); connection con1; select * from mariadbtestdb.t1; --error ER_TABLEACCESS_DENIED_ERROR @@ -87,7 +87,7 @@ connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; grant SELECT ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; -connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,); +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,); connection con1; select * from mariadbtestdb.t1; --error ER_TABLEACCESS_DENIED_ERROR @@ -101,7 +101,7 @@ connection default; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; grant SELECT (a) ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; -connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,); +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,); connection con1; --error ER_TABLEACCESS_DENIED_ERROR select * from mariadbtestdb.t1; @@ -126,6 +126,8 @@ grant SELECT (a) ON mariadbtestdb.t1 TO role5678901_345678902_345678903_34567890 REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; +GRANT CREATE ROUTINE on test.* to user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; + grant role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678 to user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; disconnect con1; diff --git a/mysql-test/main/mysql_install_db_win.result b/mysql-test/main/mysql_install_db_win.result index 2440ff351eac6..511be75e131c1 100644 --- a/mysql-test/main/mysql_install_db_win.result +++ b/mysql-test/main/mysql_install_db_win.result @@ -1,3 +1,7 @@ +select database(); +database() +test +use mysql; Running bootstrap Creating my.ini file Removing default user @@ -29,3 +33,4 @@ skip-name-resolve [client] port=3307 # restart +use test; diff --git a/mysql-test/main/mysql_install_db_win.test b/mysql-test/main/mysql_install_db_win.test index c400dbf3fb9fd..fd3bf6d24b0dd 100644 --- a/mysql-test/main/mysql_install_db_win.test +++ b/mysql-test/main/mysql_install_db_win.test @@ -1,4 +1,6 @@ --source include/windows.inc +select database(); +use mysql; # Create database in tmp directory using mysql_install_db.exe, # and start server from this directory. @@ -87,4 +89,5 @@ perl; EOF rmdir $_BASEDIR; --source include/start_mysqld.inc +use test; diff --git a/mysql-test/main/mysql_install_db_win_admin.result b/mysql-test/main/mysql_install_db_win_admin.result new file mode 100644 index 0000000000000..06d3d6779774e --- /dev/null +++ b/mysql-test/main/mysql_install_db_win_admin.result @@ -0,0 +1,12 @@ +use mysql; +Running bootstrap +Creating my.ini file +Removing default user +Allowing remote access for user root +Setting root password +Creation of the database was successful +# Kill the server +# restart: --datadir=MYSQLTEST_VARDIR/tmp/ddir +connect root,localhost,root,wrongpass,mysql; +# Kill the server +# restart diff --git a/mysql-test/main/mysql_install_db_win_admin.test b/mysql-test/main/mysql_install_db_win_admin.test new file mode 100644 index 0000000000000..a6b98f9705837 --- /dev/null +++ b/mysql-test/main/mysql_install_db_win_admin.test @@ -0,0 +1,21 @@ +--source include/windows.inc +--source include/check_windows_admin.inc +--source include/have_innodb.inc + +# Create database in tmp directory using mysql_install_db.exe, +# and start server from this directory. +let $ddir= $MYSQLTEST_VARDIR/tmp/ddir; +use mysql; +exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R; +--source include/kill_mysqld.inc +let $restart_parameters=--datadir=$ddir; +--source include/start_mysqld.inc + +# Check that connect with wrong password succeeds +connect (root,localhost,root,wrongpass,mysql); + +--source include/kill_mysqld.inc +let $restart_parameters=; +rmdir $ddir; +--source include/start_mysqld.inc + diff --git a/mysql-test/main/mysql_install_db_win_utf8.result b/mysql-test/main/mysql_install_db_win_utf8.result index 744c982b2917e..edcc69aaeb718 100644 --- a/mysql-test/main/mysql_install_db_win_utf8.result +++ b/mysql-test/main/mysql_install_db_win_utf8.result @@ -1,3 +1,4 @@ +use mysql; Running bootstrap Creating my.ini file Removing default user @@ -12,3 +13,4 @@ DATADIR/ # Kill the server connection default; # restart +use test; diff --git a/mysql-test/main/mysql_install_db_win_utf8.test b/mysql-test/main/mysql_install_db_win_utf8.test index fc67b66d3caa5..0dc75af39145d 100644 --- a/mysql-test/main/mysql_install_db_win_utf8.test +++ b/mysql-test/main/mysql_install_db_win_utf8.test @@ -1,6 +1,6 @@ --source include/windows.inc --source include/check_utf8_cli.inc - +use mysql; # Create database in tmp directory using mysql_install_db.exe, # and start server from this directory. let $ddir= $MYSQLTEST_VARDIR/tmp/датадир; @@ -32,4 +32,5 @@ rmdir $ddir; connection default; --source include/start_mysqld.inc +use test; diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test index b9ff05401f712..b149038067d66 100644 --- a/mysql-test/main/mysql_upgrade.test +++ b/mysql-test/main/mysql_upgrade.test @@ -337,14 +337,12 @@ EOF --echo # MDEV-27279: mariadb_upgrade check-if-upgrade with major version change --echo # -# take 2rd number of version and change to 0 - let DATADIR= $MYSQLD_DATADIR; perl; my $ver= $ENV{'MYSQL_SERVER_VERSION'} or die "MYSQL_SERVER_VERSION not set"; my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set"; - $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.0.$3$4/; + $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/10.11.2$4/; open(FILE, ">$file/mysql_upgrade_info") or die "Failed to open $file"; print FILE "$ver\n"; close(FILE); diff --git a/mysql-test/main/mysql_upgrade_to_100502.result b/mysql-test/main/mysql_upgrade_to_100502.result index 1509580909283..7235b16aa5aa6 100644 --- a/mysql-test/main/mysql_upgrade_to_100502.result +++ b/mysql-test/main/mysql_upgrade_to_100502.result @@ -84,15 +84,15 @@ GRANT BINLOG MONITOR, SLAVE MONITOR ON *.* TO `user_replclient`@`localhost` SHOW GRANTS FOR user_replslave@localhost; Grants for user_replslave@localhost GRANT REPLICATION SLAVE, SLAVE MONITOR ON *.* TO `user_replslave`@`localhost` -connect con1,localhost,user_super_replslave,,test; +connect con1,localhost,user_super_replslave,,"*NO-ONE*"; connection con1; SHOW SLAVE STATUS; disconnect con1; -connect con1,localhost,user_replclient,,test; +connect con1,localhost,user_replclient,,"*NO-ONE*"; connection con1; SHOW SLAVE STATUS; disconnect con1; -connect con1,localhost,user_replslave,,test; +connect con1,localhost,user_replslave,,"*NO-ONE*"; connection con1; SHOW RELAYLOG EVENTS; disconnect con1; diff --git a/mysql-test/main/mysql_upgrade_to_100502.test b/mysql-test/main/mysql_upgrade_to_100502.test index b5a44080f171a..fc47f0c94aa38 100644 --- a/mysql-test/main/mysql_upgrade_to_100502.test +++ b/mysql-test/main/mysql_upgrade_to_100502.test @@ -87,21 +87,21 @@ SHOW GRANTS FOR user_replclient@localhost; --echo # SHOW GRANTS FOR user_replslave@localhost; ---connect (con1,localhost,user_super_replslave,,test) +--connect (con1,localhost,user_super_replslave,,"*NO-ONE*") --connection con1 --disable_result_log SHOW SLAVE STATUS; --enable_result_log --disconnect con1 ---connect (con1,localhost,user_replclient,,test) +--connect (con1,localhost,user_replclient,,"*NO-ONE*") --connection con1 --disable_result_log SHOW SLAVE STATUS; --enable_result_log --disconnect con1 ---connect (con1,localhost,user_replslave,,test) +--connect (con1,localhost,user_replslave,,"*NO-ONE*") --connection con1 --disable_ps_protocol --disable_result_log diff --git a/mysql-test/main/mysqlbinlog-innodb.result b/mysql-test/main/mysqlbinlog-innodb.result index 6f0b4dd40b664..4587ac572b09f 100644 --- a/mysql-test/main/mysqlbinlog-innodb.result +++ b/mysql-test/main/mysqlbinlog-innodb.result @@ -20,7 +20,7 @@ a 2 FLUSH LOGS; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -29,7 +29,7 @@ START TRANSACTION use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -51,7 +51,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -60,7 +60,7 @@ START TRANSACTION use `foo`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/main/mysqlbinlog.result b/mysql-test/main/mysqlbinlog.result index 2093f8d2fa03a..f7c7b2c677e2e 100644 --- a/mysql-test/main/mysqlbinlog.result +++ b/mysql-test/main/mysqlbinlog.result @@ -15,14 +15,14 @@ flush logs; --- Local -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -94,7 +94,7 @@ ROLLBACK /* added by mysqlbinlog */; --- Broken LOAD DATA -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; START TRANSACTION @@ -102,7 +102,7 @@ START TRANSACTION use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -130,7 +130,7 @@ ROLLBACK /* added by mysqlbinlog */; --- --database -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -138,7 +138,7 @@ START TRANSACTION /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -181,7 +181,7 @@ ROLLBACK /* added by mysqlbinlog */; --- --start-position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; START TRANSACTION @@ -189,7 +189,7 @@ START TRANSACTION use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -209,14 +209,14 @@ ROLLBACK /* added by mysqlbinlog */; --- Remote -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -288,7 +288,7 @@ ROLLBACK /* added by mysqlbinlog */; --- Broken LOAD DATA -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; START TRANSACTION @@ -296,7 +296,7 @@ START TRANSACTION use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -324,7 +324,7 @@ ROLLBACK /* added by mysqlbinlog */; --- --database -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -332,7 +332,7 @@ START TRANSACTION /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -375,7 +375,7 @@ ROLLBACK /* added by mysqlbinlog */; --- --start-position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; START TRANSACTION @@ -383,7 +383,7 @@ START TRANSACTION use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -403,7 +403,7 @@ ROLLBACK /* added by mysqlbinlog */; --- reading stdin -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -424,7 +424,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; SET TIMESTAMP=1108844556/*!*/; @@ -486,13 +486,13 @@ drop procedure p1; call p1(); ERROR 42000: PROCEDURE test.p1 does not exist /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -538,13 +538,13 @@ D0AA drop table t1; flush logs; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -626,6 +626,8 @@ FLUSH LOGS; INSERT INTO t1 VALUES ('0123456789'); FLUSH LOGS; DROP TABLE t1; +Warnings: +Warning 1262 Row 98 was truncated; it contained more data than there were input columns We expect this value to be 2 (one for the INSERT, one for COMMIT). The bug being tested was that 'Query' lines were not preceded by '#' If the line is in the table, it had to have been preceded by a '#' @@ -717,14 +719,14 @@ FLUSH LOGS; # # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified exists /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1253783037/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -772,13 +774,13 @@ ROLLBACK /* added by mysqlbinlog */; # # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified does not exist /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; SET TIMESTAMP=1253783037/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -808,12 +810,12 @@ ROLLBACK /* added by mysqlbinlog */; # # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified exists /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; SET TIMESTAMP=1266652094/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -850,12 +852,12 @@ ROLLBACK /* added by mysqlbinlog */; # # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified does not exist /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; SET TIMESTAMP=1266652094/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -936,7 +938,7 @@ SET GLOBAL SERVER_ID = 1; # FDE corrupted in relay log # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 @@ -973,7 +975,7 @@ AAAAAAAAAAAAAAAAAAAgrgJSFzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC # Event: Query thread_id=1 exec_time=0 error_code=0 xid=0 SET TIMESTAMP=1375907364/*!*/; SET @@session.pseudo_thread_id=1/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1019,7 +1021,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 @@ -1056,7 +1058,7 @@ AAAAAAAAAAAAAAAAAAA/rQJSGzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC # Event: Query thread_id=1 exec_time=1 error_code=0 xid=0 SET TIMESTAMP=1375907141/*!*/; SET @@session.pseudo_thread_id=1/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1102,7 +1104,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 @@ -1139,7 +1141,7 @@ AAAAAAAAAAAAAAAAAAAnrAJSHzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC # Event: Query thread_id=1 exec_time=0 error_code=0 xid=0 SET TIMESTAMP=1375906879/*!*/; SET @@session.pseudo_thread_id=1/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1185,7 +1187,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 @@ -1222,7 +1224,7 @@ AAAAAAAAAAAAAAAAAABbsAJSEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC # Event: Query thread_id=1 exec_time=0 error_code=0 xid=0 SET TIMESTAMP=1375907933/*!*/; SET @@session.pseudo_thread_id=1/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1276,13 +1278,8 @@ CREATE TABLE t1 (a int); INSERT INTO t1 values(1); DROP TABLE t1; FLUSH LOGS; -ERROR: Bad syntax in rewrite-db: missing '->' - -ERROR: Bad syntax in rewrite-db: empty TO db - -ERROR: Bad syntax in rewrite-db: empty TO db - -ERROR: Bad syntax in rewrite-db: empty FROM db - -ERROR: Bad syntax in rewrite-db: empty FROM db - +ERROR: Bad syntax in rewrite-db. Expected syntax is FROM->TO. +ERROR: Bad syntax in rewrite-db. Expected syntax is FROM->TO. +ERROR: Bad syntax in rewrite-db. Expected syntax is FROM->TO. +ERROR: Bad syntax in rewrite-db. Expected syntax is FROM->TO. +ERROR: Bad syntax in rewrite-db. Expected syntax is FROM->TO. diff --git a/mysql-test/main/mysqlbinlog_row_compressed.result b/mysql-test/main/mysqlbinlog_row_compressed.result index ca815a518c7c5..a360ba3f1e768 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.result +++ b/mysql-test/main/mysqlbinlog_row_compressed.result @@ -12,7 +12,7 @@ DELETE FROM t1; DELETE FROM t2; FLUSH BINARY LOGS; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 @@ -33,7 +33,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result index 4d9ca93012bbe..d7bbb3d45fe42 100644 --- a/mysql-test/main/mysqlbinlog_row_minimal.result +++ b/mysql-test/main/mysqlbinlog_row_minimal.result @@ -10,7 +10,7 @@ DELETE FROM t1; DELETE FROM t2; FLUSH BINARY LOGS; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 @@ -31,7 +31,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -366,7 +366,7 @@ SET t1.is_deleted = TRUE WHERE t1.id = 1; FLUSH BINARY LOGS; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at POS @@ -397,7 +397,7 @@ START TRANSACTION # server id 1 end_log_pos END_LOG_POS CRC32 XXX Query thread_id=TID exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=TID/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/main/mysqlbinlog_stmt_compressed.result b/mysql-test/main/mysqlbinlog_stmt_compressed.result index 5f3e82648c625..b2790e5a0792d 100644 --- a/mysql-test/main/mysqlbinlog_stmt_compressed.result +++ b/mysql-test/main/mysqlbinlog_stmt_compressed.result @@ -12,7 +12,7 @@ DELETE FROM t1; DELETE FROM t2; FLUSH BINARY LOGS; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 @@ -33,7 +33,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/main/mysqld--help,win.rdiff b/mysql-test/main/mysqld--help,win.rdiff index 337755252ba5d..a43d7f0d86c50 100644 --- a/mysql-test/main/mysqld--help,win.rdiff +++ b/mysql-test/main/mysqld--help,win.rdiff @@ -1,6 +1,6 @@ --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result -@@ -647,6 +646,7 @@ +@@ -685,6 +685,7 @@ Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns. (Defaults to on; use --skip-mysql56-temporal-format to disable.) @@ -8,10 +8,10 @@ --net-buffer-length=# Buffer length for TCP/IP and socket communication --net-read-timeout=# -@@ -1236,6 +1236,10 @@ - Log slow queries to given log file. Defaults logging to - 'hostname'-slow.log. Must be enabled to activate other - slow log options +@@ -1327,6 +1328,10 @@ + Alias for log_slow_query_file. Log slow queries to given + log file. Defaults logging to 'hostname'-slow.log. Must + be enabled to activate other slow log options + --slow-start-timeout=# + Maximum number of milliseconds that the service control + manager should wait before trying to kill the windows @@ -19,7 +19,7 @@ --socket=name Socket file to use for connection --sort-buffer-size=# Each thread that needs to do a sort allocates a buffer of -@@ -1260,6 +1264,7 @@ +@@ -1351,6 +1356,7 @@ deleting or updating every row in a table. --stack-trace Print a symbolic stack trace on failure (Defaults to on; use --skip-stack-trace to disable.) @@ -27,7 +27,7 @@ --standard-compliant-cte Allow only CTEs compliant to SQL standard (Defaults to on; use --skip-standard-compliant-cte to disable.) -@@ -1330,6 +1335,11 @@ +@@ -1426,6 +1432,11 @@ --thread-pool-max-threads=# Maximum allowed number of worker threads in the thread pool @@ -39,7 +39,7 @@ --thread-pool-oversubscribe=# How many additional active worker threads in a group are allowed. -@@ -1370,8 +1380,8 @@ +@@ -1464,8 +1475,8 @@ automatically convert it to an on-disk MyISAM or Aria table. -t, --tmpdir=name Path for temporary files. Several paths may be specified, @@ -50,7 +50,7 @@ --transaction-alloc-block-size=# Allocation block size for transactions to be stored in binary log -@@ -1587,6 +1596,7 @@ +@@ -1685,6 +1696,7 @@ myisam-stats-method NULLS_UNEQUAL myisam-use-mmap FALSE mysql56-temporal-format TRUE @@ -58,7 +58,7 @@ net-buffer-length 16384 net-read-timeout 30 net-retry-count 10 -@@ -1726,6 +1736,7 @@ +@@ -1841,6 +1853,7 @@ slave-type-conversions slow-launch-time 2 slow-query-log FALSE @@ -66,8 +66,8 @@ sort-buffer-size 2097152 sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION sql-safe-updates FALSE -@@ -1753,6 +1764,8 @@ - thread-cache-size 151 +@@ -1867,6 +1880,8 @@ + thread-pool-exact-stats FALSE thread-pool-idle-timeout 60 thread-pool-max-threads 65536 +thread-pool-min-threads 1 diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index c92c1cd3cd225..5720988df2ff9 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -42,7 +42,8 @@ The following specify which files/extra groups are read (specified before remain by saving all temporary sets to disk, avoiding 'table full' errors. No longer needed, as the server now handles this automatically. - --bind-address=name IP address to bind to. + --bind-address=name IP address to bind to. Several addresses may be + specified, separated by a comma (,). --binlog-alter-two-phase When set, split ALTER at binary logging into 2 statements: START ALTER and COMMIT/ROLLBACK ALTER @@ -460,8 +461,7 @@ The following specify which files/extra groups are read (specified before remain the only option you need for specifying log files. Sets names for --log-bin, --log-bin-index, --relay-log, --relay-log-index, --general-log-file, - --log-slow-query-log-file, --log-error-file, and - --pid-file + --log-slow-query-file, --log-error-file, and --pid-file --log-bin[=name] Log update queries in binary format. Optional argument should be name for binary log. If not given 'datadir'/'log-basename'-bin or 'datadir'/mysql-bin will @@ -523,6 +523,22 @@ The following specify which files/extra groups are read (specified before remain filesort_priority_queue, full_join, full_scan, not_using_index, query_cache, query_cache_miss, tmp_table, tmp_table_on_disk + --log-slow-min-examined-row-limit=# + Don't write queries to slow log that examine fewer rows + than that + --log-slow-query Log slow queries to a table or log file. Defaults logging + to a file 'hostname'-slow.log or a table mysql.slow_log + if --log-output=TABLE is used. Must be enabled to + activate other slow log options. + --log-slow-query-file=name + Log slow queries to given log file. Defaults logging to + 'hostname'-slow.log. Must be enabled to activate other + slow log options + --log-slow-query-time=# + Log all queries that have taken more than + log_slow_query_time seconds to execute to the slow query + log file. The argument will be treated as a decimal value + with microsecond precision --log-slow-rate-limit=# Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or @@ -543,10 +559,10 @@ The following specify which files/extra groups are read (specified before remain Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity - --long-query-time=# Log all queries that have taken more than long_query_time - seconds to execute to the slow query log file. The - argument will be treated as a decimal value with - microsecond precision + --long-query-time=# Alias for log_slow_query_time. Log all queries that have + taken more than long_query_time seconds to execute to the + slow query log file. The argument will be treated as a + decimal value with microsecond precision --low-priority-updates INSERT/DELETE/UPDATE has lower priority than selects --lower-case-table-names[=#] @@ -635,8 +651,8 @@ The following specify which files/extra groups are read (specified before remain --metadata-locks-hash-instances=# Unused --min-examined-row-limit=# - Don't write queries to slow log that examine fewer rows - than that + Alias for log_slow_min_examined_row_limit. Don't write + queries to slow log that examine fewer rows than that --mrr-buffer-size=# Size of buffer to use when using MRR with range access --myisam-block-size=# Block size to be used for MyISAM index pages @@ -1003,7 +1019,7 @@ The following specify which files/extra groups are read (specified before remain value --read-only Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with - the SUPER privilege + the 'READ ONLY ADMIN' privilege --read-rnd-buffer-size=# When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks @@ -1304,14 +1320,14 @@ The following specify which files/extra groups are read (specified before remain If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented - --slow-query-log Log slow queries to a table or log file. Defaults logging - to a file 'hostname'-slow.log or a table mysql.slow_log - if --log-output=TABLE is used. Must be enabled to - activate other slow log options. + --slow-query-log Alias for log_slow_query. Log slow queries to a table or + log file. Defaults logging to a file 'hostname'-slow.log + or a table mysql.slow_log if --log-output=TABLE is used. + Must be enabled to activate other slow log options. --slow-query-log-file=name - Log slow queries to given log file. Defaults logging to - 'hostname'-slow.log. Must be enabled to activate other - slow log options + Alias for log_slow_query_file. Log slow queries to given + log file. Defaults logging to 'hostname'-slow.log. Must + be enabled to activate other slow log options --socket=name Socket file to use for connection --sort-buffer-size=# Each thread that needs to do a sort allocates a buffer of @@ -1369,6 +1385,9 @@ The following specify which files/extra groups are read (specified before remain Versioning ALTER TABLE mode. ERROR: Fail ALTER with error; KEEP: Keep historical system rows and subject them to ALTER + --system-versioning-insert-history + Allows direct inserts into ROW_START and ROW_END columns + if secure_timestamp allows changing @@timestamp --table-cache=# Deprecated; use --table-open-cache instead. --table-definition-cache=# The number of cached table definitions @@ -1617,6 +1636,9 @@ log-slave-updates FALSE log-slow-admin-statements TRUE log-slow-disabled-statements sp log-slow-filter admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk +log-slow-min-examined-row-limit 0 +log-slow-query FALSE +log-slow-query-time 10 log-slow-rate-limit 1 log-slow-slave-statements TRUE log-slow-verbosity @@ -1838,6 +1860,7 @@ sync-relay-log 10000 sync-relay-log-info 10000 sysdate-is-now FALSE system-versioning-alter-history ERROR +system-versioning-insert-history FALSE table-definition-cache 400 tc-heuristic-recover OFF tcp-keepalive-interval 0 diff --git a/mysql-test/main/mysqld--help.test b/mysql-test/main/mysqld--help.test index 9bf53c7200bb0..a73562e424916 100644 --- a/mysql-test/main/mysqld--help.test +++ b/mysql-test/main/mysqld--help.test @@ -23,6 +23,7 @@ perl; # their paths may vary: @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir plugin-maturity log-slow-queries pid-file slow-query-log-file log-basename + log-slow-query-file datadir slave-load-tmpdir tmpdir socket thread-pool-size large-files-support lower-case-file-system system-time-zone collation-server character-set-server log-tc-size table-cache @@ -40,7 +41,7 @@ perl; wsrep file-key-management cracklib-password-check user-variables provider-bzip2 provider-lzma provider-lzo thread-pool-groups thread-pool-queues thread-pool-stats - thread-pool-waits hashicorp provider/; + thread-pool-waits hashicorp provider gssapi/; # And substitute the content some environment variables with their # names: diff --git a/mysql-test/main/mysqldump-header.result b/mysql-test/main/mysqldump-header.result new file mode 100644 index 0000000000000..945791790c0db --- /dev/null +++ b/mysql-test/main/mysqldump-header.result @@ -0,0 +1,101 @@ +CREATE TABLE `courses` ( +`course_id` smallint(20) PRIMARY KEY, +`name` varchar(50), +`description` varchar(100), +`num_years` tinyint(1), +`escape_çÇÁá!#%"'` varchar(10) +); +desc courses; +Field Type Null Key Default Extra +course_id smallint(20) NO PRI NULL +name varchar(50) YES NULL +description varchar(100) YES NULL +num_years tinyint(1) YES NULL +escape_çÇÁá!#%"' varchar(10) YES NULL +INSERT INTO `courses` VALUES (5, 'Course 1', 'Course Description 1', 3, NULL); +# +# Dump only data rows into outfile with default options +# +5 Course 1 Course Description 1 3 \N +# +# Dump header and data rows into outfile with default options +# +course_id name description num_years escape_çÇÁá!#%"' +5 Course 1 Course Description 1 3 \N +# +# Dump header and data rows into outfile with comma delimited fields +# +course_id,name,description,num_years,escape_çÇÁá!#%"' +5,Course 1,Course Description 1,3,\N +# +# Dump header and data rows into outfile with single quote enclosed fields +# +'course_id' 'name' 'description' 'num_years' 'escape_çÇÁá!#%"\'' +'5' 'Course 1' 'Course Description 1' '3' \N +# +# Dump header and data rows into outfile with optional single quote enclosed fields +# +'course_id' 'name' 'description' 'num_years' 'escape_çÇÁá!#%"\'' +'5' 'Course 1' 'Course Description 1' '3' \N +# +# Dump header and data rows into outfile with semicolon terminated data rows +# +course_id name description num_years escape_çÇÁá!#%"';5 Course 1 Course Description 1 3 \N; +# +# Dump header and data rows into outfile with several options above combined +# +'course_id','name','description','num_years','escape_çÇÁá!#%"\'';'5','Course 1','Course Description 1','3',\N; +'course_id','name','description','num_years','escape_çÇÁá!#%"\'';'5','Course 1','Course Description 1','3',\N; +# +# --skip-quote-names +# +course_id name description num_years escape_çÇÁá!#%"' +5 Course 1 Course Description 1 3 \N +# +# --compatible=ansi +# +course_id name description num_years escape_çÇÁá!#%"' +5 Course 1 Course Description 1 3 \N +INSERT INTO `courses` VALUES (4, 'Course 2', 'Course Description 2', 4, NULL); +INSERT INTO `courses` VALUES (3, 'Course 3', 'Course Description 3', 3, NULL); +INSERT INTO `courses` VALUES (2, 'Course 4', 'Course Description 4', 5, NULL); +INSERT INTO `courses` VALUES (1, 'Course 5', 'Course Description 5', 3, NULL); + +# +# Dump data rows into outfile with --where clause +# +2 Course 4 Course Description 4 5 \N +# +# Dump header and data rows into outfile with --where clause. The header must remain on top and not meddle among data rows +# +course_id name description num_years escape_çÇÁá!#%"' +2 Course 4 Course Description 4 5 \N +# +# Dump data rows ordered by primary key. +# +1 Course 5 Course Description 5 3 \N +2 Course 4 Course Description 4 5 \N +3 Course 3 Course Description 3 3 \N +4 Course 2 Course Description 2 4 \N +5 Course 1 Course Description 1 3 \N +# +# Dump header and data rows ordered by primary key. The header must remain on top and not meddle among data rows +# +course_id name description num_years escape_çÇÁá!#%"' +1 Course 5 Course Description 5 3 \N +2 Course 4 Course Description 4 5 \N +3 Course 3 Course Description 3 3 \N +4 Course 2 Course Description 2 4 \N +5 Course 1 Course Description 1 3 \N +# +# Dump data rows from an empty table, must generate no output +# +DELETE FROM `courses`; +# +# Dump header and data rows from an empty table, must generate a single header line as output +# +course_id name description num_years escape_çÇÁá!#%"' +# +# Use header without the --tab option. Must produce an error +# +DROP TABLE `courses`; diff --git a/mysql-test/main/mysqldump-header.test b/mysql-test/main/mysqldump-header.test new file mode 100644 index 0000000000000..b1886174153c1 --- /dev/null +++ b/mysql-test/main/mysqldump-header.test @@ -0,0 +1,125 @@ +--source include/not_embedded.inc + +CREATE TABLE `courses` ( + `course_id` smallint(20) PRIMARY KEY, + `name` varchar(50), + `description` varchar(100), + `num_years` tinyint(1), + `escape_çÇÁá!#%"'` varchar(10) +); + +desc courses; + +INSERT INTO `courses` VALUES (5, 'Course 1', 'Course Description 1', 3, NULL); + +--echo # +--echo # Dump only data rows into outfile with default options +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Dump header and data rows into outfile with default options +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --header test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Dump header and data rows into outfile with comma delimited fields +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --header --fields-terminated-by , test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Dump header and data rows into outfile with single quote enclosed fields +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --header --fields-enclosed-by \' test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Dump header and data rows into outfile with optional single quote enclosed fields +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --header --fields-optionally-enclosed-by \' test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Dump header and data rows into outfile with semicolon terminated data rows +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --header --lines-terminated-by \; test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo +--echo # +--echo # Dump header and data rows into outfile with several options above combined +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --header --fields-terminated-by , --fields-enclosed-by \' --lines-terminated-by \; test +--cat_file $MYSQLTEST_VARDIR/courses.txt +--echo +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --header --fields-terminated-by , --fields-optionally-enclosed-by \' --lines-terminated-by \; test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo +--echo # +--echo # --skip-quote-names +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --header --skip-quote-names test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # --compatible=ansi +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --header --compatible=ansi test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +INSERT INTO `courses` VALUES (4, 'Course 2', 'Course Description 2', 4, NULL); +INSERT INTO `courses` VALUES (3, 'Course 3', 'Course Description 3', 3, NULL); +INSERT INTO `courses` VALUES (2, 'Course 4', 'Course Description 4', 5, NULL); +INSERT INTO `courses` VALUES (1, 'Course 5', 'Course Description 5', 3, NULL); + +--echo +--echo # +--echo # Dump data rows into outfile with --where clause +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --where "num_years=5" test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Dump header and data rows into outfile with --where clause. The header must remain on top and not meddle among data rows +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --where "num_years=5" --header test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Dump data rows ordered by primary key. +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --order-by-primary test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Dump header and data rows ordered by primary key. The header must remain on top and not meddle among data rows +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --order-by-primary --header test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Dump data rows from an empty table, must generate no output +--echo # +DELETE FROM `courses`; +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Dump header and data rows from an empty table, must generate a single header line as output +--echo # +--exec $MYSQL_DUMP -u root --tab $MYSQLTEST_VARDIR/ --header test +--cat_file $MYSQLTEST_VARDIR/courses.txt + +--echo # +--echo # Use header without the --tab option. Must produce an error +--echo # +--error 1 +--exec $MYSQL_DUMP -u root --header test + +DROP TABLE `courses`; +--remove_file $MYSQLTEST_VARDIR/courses.txt +--remove_file $MYSQLTEST_VARDIR/courses.sql diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index 3f8d1c404d73e..13fc0cc9fe684 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -3727,6 +3727,7 @@ use test; # Bug#21215 mysqldump creating incomplete backups without warning # create user mysqltest_1@localhost; +grant all on test.* to mysqltest_1@localhost; create table t1(a int, b varchar(34)); reset master; mariadb-dump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) @@ -5785,6 +5786,8 @@ drop tables t2, t1; # MDEV-22037: Add ability to skip content of some tables # (work around for MDEV-20939) # +create user a; +grant SELECT on test.* to a; use mysql; # check that all tables we need are not empty select count(*) >= 1 from mysql.proc; @@ -5798,6 +5801,7 @@ FOUND 1 /INSERT INTO `proc`/ in MDEV-20939.sql NOT FOUND /INSERT INTO `db`/ in MDEV-20939.sql FOUND 1 /CREATE TABLE `db`/ in MDEV-20939.sql FOUND 1 /CREATE TABLE `proc`/ in MDEV-20939.sql +drop user a; use test; # End of 10.1 tests # @@ -6585,3 +6589,4 @@ SET GLOBAL LOG_OUTPUT=DEFAULT, GLOBAL GENERAL_LOG=@save_general_log; TRUNCATE TABLE mysql.general_log; DROP DATABASE test1; # End of 10.3 tests +mariadb-dump: --xml can't be used with --tab. diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index 238d90e4cdc21..7819c005aa83b 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -1381,6 +1381,7 @@ use test; # Create user without sufficient privs to perform the requested operation create user mysqltest_1@localhost; +grant all on test.* to mysqltest_1@localhost; create table t1(a int, b varchar(34)); # To get consistent output, reset the master, starts over from first log @@ -2699,6 +2700,8 @@ drop tables t2, t1; --echo # (work around for MDEV-20939) --echo # +create user a; +grant SELECT on test.* to a; use mysql; --echo # check that all tables we need are not empty @@ -2724,6 +2727,7 @@ let SEARCH_PATTERN=CREATE TABLE `proc`; source include/search_pattern_in_file.inc; --remove_file $MYSQLTEST_VARDIR/tmp/MDEV-20939.sql +drop user a; use test; --echo # End of 10.1 tests @@ -2983,3 +2987,10 @@ DROP DATABASE test1; --remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql --echo # End of 10.3 tests + +# +# MDEV-16733 mysqldump --tab and --xml options are conflicting +# +--replace_result mariadb-dump.exe mariadb-dump +--error 1 +--exec $MYSQL_DUMP --xml --tab=$MYSQLTEST_VARDIR/tmp 2>&1 diff --git a/mysql-test/main/not_embedded_server.result b/mysql-test/main/not_embedded_server.result index 0b952f93ad830..19e862e07a5c8 100644 --- a/mysql-test/main/not_embedded_server.result +++ b/mysql-test/main/not_embedded_server.result @@ -31,6 +31,7 @@ CREATE TABLE t2 (key2 INT); INSERT INTO t1 VALUES (1),(2); CREATE FUNCTION f() RETURNS INT RETURN 1; GRANT FILE ON *.* TO 'nopriv_user'@'localhost'; +GRANT SELECT,INSERT,CREATE ON test.* TO 'nopriv_user'@'localhost'; FLUSH PRIVILEGES; connect con1,localhost,nopriv_user,,; connection con1; diff --git a/mysql-test/main/not_embedded_server.test b/mysql-test/main/not_embedded_server.test index 20f75db25d507..079c0c85bcd96 100644 --- a/mysql-test/main/not_embedded_server.test +++ b/mysql-test/main/not_embedded_server.test @@ -59,6 +59,7 @@ INSERT INTO t1 VALUES (1),(2); CREATE FUNCTION f() RETURNS INT RETURN 1; GRANT FILE ON *.* TO 'nopriv_user'@'localhost'; +GRANT SELECT,INSERT,CREATE ON test.* TO 'nopriv_user'@'localhost'; FLUSH PRIVILEGES; diff --git a/mysql-test/main/openssl_1.result b/mysql-test/main/openssl_1.result index a5ac8956b2f65..be6c299892782 100644 --- a/mysql-test/main/openssl_1.result +++ b/mysql-test/main/openssl_1.result @@ -199,7 +199,7 @@ DROP USER bug42158@localhost; set global sql_mode=default; End of 5.1 tests /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ERROR: Failed on connect: TLS/SSL error \ No newline at end of file diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index b6345cd142e4d..1311f42dac21f 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -3396,6 +3396,9 @@ INSERT INTO t1 SELECT seq,seq from seq_1_to_100; ANALYZE FORMAT=JSON SELECT * FROM t1 ORDER BY a LIMIT 5; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -3750,6 +3753,9 @@ insert into t1 select seq, seq, seq from seq_1_to_100; ANALYZE FORMAT=JSON select * from t1 order by a,b,c; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -3913,6 +3919,9 @@ analyze format=json select a, substr(b, @save_max_sort_length+1) from t1 order by b desc; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -3959,6 +3968,9 @@ insert into t1 values ('def', 4, 4) , ('efg', 5, 5), ('fgh', 6, 6); ANALYZE FORMAT=JSON select a, b, c from t1 order by a, b; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -4011,6 +4023,9 @@ Warning 1292 Truncated incorrect max_sort_length value: '5' ANALYZE FORMAT=JSON select a, b, c from t1 order by a, b; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -4077,6 +4092,9 @@ a b analyze format=json select * from t1 order by a; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -4256,6 +4274,9 @@ ANALYZE FORMAT=JSON SELECT (SELECT sum(t2.b) FROM t2 WHERE t1.b=t2.b GROUP BY t2.a) FROM t1; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/order_by_pack_big.result b/mysql-test/main/order_by_pack_big.result index e34b1a4a90a4a..6b33d7d820288 100644 --- a/mysql-test/main/order_by_pack_big.result +++ b/mysql-test/main/order_by_pack_big.result @@ -89,6 +89,9 @@ FROM t3 GROUP BY x; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -250,6 +253,9 @@ FROM t3 GROUP BY x; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -409,6 +415,9 @@ set sort_buffer_size= 2097152; ANALYZE FORMAT=JSON SELECT id, names, address FROM t3 ORDER BY names, address; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -462,6 +471,9 @@ set sort_buffer_size= 1097152; ANALYZE FORMAT=JSON SELECT id, names, address FROM t3 ORDER BY names, address; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/partition_exchange.result b/mysql-test/main/partition_exchange.result index b7c9be3480eda..f68267c0f55d2 100644 --- a/mysql-test/main/partition_exchange.result +++ b/mysql-test/main/partition_exchange.result @@ -1231,7 +1231,7 @@ DROP TABLE t, t2, tp; # failed during EXCHANGE PARTITION with different TABLESPACE. # CREATE TABLE t1 (a VARCHAR(200)) PARTITION BY KEY(a) partitions 10; -ALTER TABLE t1 ADD PARTITION (PARTITION pm TABLESPACE = `innodb_file_per_table`); +ALTER TABLE t1 ADD PARTITION (PARTITION pm); CREATE TABLE t2 like t1; ALTER TABLE t2 REMOVE PARTITIONING; ALTER TABLE t1 EXCHANGE PARTITION pm WITH TABLE t2; diff --git a/mysql-test/main/partition_exchange.test b/mysql-test/main/partition_exchange.test index 82ccc29e00ef9..e35d8e1f9d1ce 100644 --- a/mysql-test/main/partition_exchange.test +++ b/mysql-test/main/partition_exchange.test @@ -525,7 +525,7 @@ DROP TABLE t, t2, tp; --echo # failed during EXCHANGE PARTITION with different TABLESPACE. --echo # CREATE TABLE t1 (a VARCHAR(200)) PARTITION BY KEY(a) partitions 10; -ALTER TABLE t1 ADD PARTITION (PARTITION pm TABLESPACE = `innodb_file_per_table`); +ALTER TABLE t1 ADD PARTITION (PARTITION pm); CREATE TABLE t2 like t1; ALTER TABLE t2 REMOVE PARTITIONING; # The following works as table spaces are not checked anymore diff --git a/mysql-test/main/partition_innodb_plugin.result b/mysql-test/main/partition_innodb_plugin.result index 8211f0aac8981..25b69212e5b66 100644 --- a/mysql-test/main/partition_innodb_plugin.result +++ b/mysql-test/main/partition_innodb_plugin.result @@ -42,6 +42,8 @@ SET @old_innodb_file_per_table = @@global.innodb_file_per_table; SET @old_innodb_strict_mode = @@global.innodb_strict_mode; SET @@global.innodb_file_per_table = ON, @@global.innodb_strict_mode = ON; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release connect con1,localhost,root,,; CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, @@ -62,6 +64,8 @@ t1 CREATE TABLE `t1` ( PARTITION BY HASH (`id`) PARTITIONS 1 SET GLOBAL innodb_file_per_table = OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release disconnect con1; connect con2,localhost,root,,; LOCK TABLE t1 WRITE; @@ -104,6 +108,8 @@ disconnect con2; connection default; SET @@global.innodb_strict_mode = @old_innodb_strict_mode; SET @@global.innodb_file_per_table = @old_innodb_file_per_table; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SET @save_detect= @@GLOBAL.innodb_deadlock_detect; SET @save_report= @@GLOBAL.innodb_deadlock_report; SET GLOBAL innodb_deadlock_detect=ON; diff --git a/mysql-test/main/partition_symlink.result b/mysql-test/main/partition_symlink.result index 17ddecbe19d14..06aef8ea4c6e1 100644 --- a/mysql-test/main/partition_symlink.result +++ b/mysql-test/main/partition_symlink.result @@ -47,6 +47,7 @@ DROP TABLE t1, t2; # test.t1 have partitions in mysqltest2-directory! # user root: CREATE USER mysqltest_1@localhost; +GRANT ALL ON test.* to mysqltest_1@localhost; CREATE DATABASE mysqltest2; USE mysqltest2; CREATE TABLE t1 (a INT) ENGINE = MyISAM; diff --git a/mysql-test/main/partition_symlink.test b/mysql-test/main/partition_symlink.test index 07d653ee4d64e..5eba9658b1ca6 100644 --- a/mysql-test/main/partition_symlink.test +++ b/mysql-test/main/partition_symlink.test @@ -77,6 +77,7 @@ DROP TABLE t1, t2; -- echo # user root: --disable_service_connection CREATE USER mysqltest_1@localhost; + GRANT ALL ON test.* to mysqltest_1@localhost; CREATE DATABASE mysqltest2; USE mysqltest2; CREATE TABLE t1 (a INT) ENGINE = MyISAM; diff --git a/mysql-test/main/plugin_auth.result b/mysql-test/main/plugin_auth.result index ac10bd067071b..12a5156eeb136 100644 --- a/mysql-test/main/plugin_auth.result +++ b/mysql-test/main/plugin_auth.result @@ -11,8 +11,8 @@ SELECT plugin,authentication_string FROM mysql.user WHERE User='plug'; plugin authentication_string test_plugin_server plug_dest ## test plugin auth -connect(localhost,plug,plug_dest,test,MYSQL_PORT,MYSQL_SOCK); -connect plug_con,localhost,plug,plug_dest; +connect(localhost,plug,plug_dest,,MYSQL_PORT,MYSQL_SOCK); +connect plug_con,localhost,plug,plug_dest,"*NO-ONE*"; ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES) GRANT PROXY ON plug_dest TO plug; test proxies_priv columns @@ -33,7 +33,7 @@ proxies_priv CREATE TABLE `proxies_priv` ( PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`), KEY `Grantor` (`Grantor`) ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User proxy privileges' -connect plug_con,localhost,plug,plug_dest; +connect plug_con,localhost,plug,plug_dest,"*NO-ONE*"; select USER(),CURRENT_USER(); USER() CURRENT_USER() plug@localhost plug_dest@% @@ -46,14 +46,14 @@ connect(localhost,plug,bad_credentials,test,MYSQL_PORT,MYSQL_SOCK); connect plug_con,localhost,plug,bad_credentials; ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES) ## test bad default plugin : nothing bad happens, as that plugin was't required by the server -connect plug_con_wrongp,localhost,plug,plug_dest,,,,,wrong_plugin_name; +connect plug_con_wrongp,localhost,plug,plug_dest,"*NO-ONE*",,,,wrong_plugin_name; select USER(),CURRENT_USER(); USER() CURRENT_USER() plug@localhost plug_dest@% connection default; disconnect plug_con_wrongp; ## test correct default plugin -connect plug_con_rightp,localhost,plug,plug_dest,,,,,auth_test_plugin; +connect plug_con_rightp,localhost,plug,plug_dest,"*NO-ONE*",,,,auth_test_plugin; select USER(),CURRENT_USER(); USER() CURRENT_USER() plug@localhost plug_dest@% @@ -67,7 +67,7 @@ DROP USER grant_user; ## test utf-8 user name CREATE USER `Ÿ` IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; GRANT PROXY ON plug_dest TO `Ÿ`; -connect non_ascii,localhost,Ÿ,plug_dest; +connect non_ascii,localhost,Ÿ,plug_dest,"*NO-ONE*"; select USER(),CURRENT_USER(); USER() CURRENT_USER() Ÿ@localhost plug_dest@% @@ -80,7 +80,8 @@ CREATE DATABASE test_grant_db; GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; GRANT PROXY ON plug_dest TO new_grant_user; -connect plug_con_grant,localhost,new_grant_user,plug_dest; +GRANT CREATE, DROP ON test_grant_db.* TO 'plug_dest'@'%'; +connect plug_con_grant,localhost,new_grant_user,plug_dest,"*NO-ONE*"; select USER(),CURRENT_USER(); USER() CURRENT_USER() new_grant_user@localhost plug_dest@% @@ -96,11 +97,10 @@ IDENTIFIED BY 'new_password'; connect(localhost,new_grant_user,plug_dest,test,MYSQL_PORT,MYSQL_SOCK); connect plug_con_grant_deny,localhost,new_grant_user,plug_dest; ERROR 28000: Access denied for user 'new_grant_user'@'localhost' (using password: YES) -connect plug_con_grant,localhost,new_grant_user,new_password; +connect plug_con_grant,localhost,new_grant_user,new_password,test_grant_db; select USER(),CURRENT_USER(); USER() CURRENT_USER() new_grant_user@localhost new_grant_user@% -USE test_grant_db; CREATE TABLE t1 (a INT); DROP TABLE t1; connection default; @@ -137,7 +137,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp # this should fail : no such grant REVOKE PROXY ON grant_plug_dest FROM grant_plug; ERROR 42000: There is no such grant defined for user 'grant_plug' on host '%' -connect grant_plug_dest_con,localhost,grant_plug_dest,grant_plug_dest_passwd; +connect grant_plug_dest_con,localhost,grant_plug_dest,grant_plug_dest_passwd,"*NO-ONE*"; ## testing what an ordinary user can grant this should fail : no rights to grant all GRANT PROXY ON ''@'%%' TO grant_plug; @@ -219,7 +219,7 @@ ERROR HY000: Variable 'proxy_user' is a read only variable SELECT @@LOCAL.proxy_user; @@LOCAL.proxy_user NULL -connect plug_con,localhost,plug,plug_dest; +connect plug_con,localhost,plug,plug_dest,"*NO-ONE*"; SELECT @@LOCAL.proxy_user; @@LOCAL.proxy_user 'plug'@'%' @@ -248,7 +248,7 @@ ERROR HY000: Variable 'external_user' is a read only variable SELECT @@LOCAL.external_user; @@LOCAL.external_user NULL -connect plug_con,localhost,plug,plug_dest; +connect plug_con,localhost,plug,plug_dest,"*NO-ONE*"; SELECT @@LOCAL.external_user; @@LOCAL.external_user plug_dest @@ -347,7 +347,7 @@ CREATE USER uplain@localhost IDENTIFIED WITH 'cleartext_plugin_server' AS 'cleartext_test'; ## test plugin auth ERROR 28000: Access denied for user 'uplain'@'localhost' (using password: YES) -connect cleartext_con,localhost,uplain,cleartext_test; +connect cleartext_con,localhost,uplain,cleartext_test,"*NO-ONE*"; select USER(),CURRENT_USER(); USER() CURRENT_USER() uplain@localhost uplain@localhost @@ -453,7 +453,7 @@ ERROR 1045 (28000): Access denied for user 'unknown'@'localhost' (using password CREATE USER bug12610784@localhost; SET PASSWORD FOR bug12610784@localhost = PASSWORD('secret'); ERROR 28000: Access denied for user 'bug12610784'@'localhost' (using password: NO) -connect b12610784,localhost,bug12610784,secret,test; +connect b12610784,localhost,bug12610784,secret,"*NO-ONE*"; connection default; disconnect b12610784; DROP USER bug12610784@localhost; @@ -466,14 +466,14 @@ IDENTIFIED WITH 'test_plugin_server' AS 'bug12818542_dest'; CREATE USER bug12818542_dest@localhost IDENTIFIED BY 'bug12818542_dest_passwd'; GRANT PROXY ON bug12818542_dest@localhost TO bug12818542@localhost; -connect bug12818542_con,localhost,bug12818542,bug12818542_dest; +connect bug12818542_con,localhost,bug12818542,bug12818542_dest,"*NO-ONE*"; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() bug12818542@localhost bug12818542_dest@localhost SET PASSWORD = PASSWORD('bruhaha'); connection default; disconnect bug12818542_con; -connect bug12818542_con2,localhost,bug12818542,bug12818542_dest; +connect bug12818542_con2,localhost,bug12818542,bug12818542_dest,"*NO-ONE*"; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() bug12818542@localhost bug12818542_dest@localhost diff --git a/mysql-test/main/plugin_auth.test b/mysql-test/main/plugin_auth.test index 48f35ac65e255..1c471cab9b56f 100644 --- a/mysql-test/main/plugin_auth.test +++ b/mysql-test/main/plugin_auth.test @@ -21,7 +21,7 @@ SELECT plugin,authentication_string FROM mysql.user WHERE User='plug'; --echo ## test plugin auth --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --error ER_ACCESS_DENIED_ERROR : this should fail : no grant -connect(plug_con,localhost,plug,plug_dest); +connect(plug_con,localhost,plug,plug_dest,"*NO-ONE*"); GRANT PROXY ON plug_dest TO plug; --echo test proxies_priv columns @@ -30,7 +30,7 @@ SELECT * FROM mysql.proxies_priv WHERE user !='root'; --echo test mysql.proxies_priv; SHOW CREATE TABLE mysql.proxies_priv; -connect(plug_con,localhost,plug,plug_dest); +connect(plug_con,localhost,plug,plug_dest,"*NO-ONE*"); select USER(),CURRENT_USER(); --echo ## test SET PASSWORD @@ -46,13 +46,13 @@ disconnect plug_con; connect(plug_con,localhost,plug,bad_credentials); --echo ## test bad default plugin : nothing bad happens, as that plugin was't required by the server -connect(plug_con_wrongp,localhost,plug,plug_dest,,,,,wrong_plugin_name); +connect(plug_con_wrongp,localhost,plug,plug_dest,"*NO-ONE*",,,,wrong_plugin_name); select USER(),CURRENT_USER(); connection default; disconnect plug_con_wrongp; --echo ## test correct default plugin -connect(plug_con_rightp,localhost,plug,plug_dest,,,,,auth_test_plugin); +connect(plug_con_rightp,localhost,plug,plug_dest,"*NO-ONE*",,,,auth_test_plugin); select USER(),CURRENT_USER(); connection default; disconnect plug_con_rightp; @@ -68,7 +68,7 @@ CREATE USER `Ÿ` IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; GRANT PROXY ON plug_dest TO `Ÿ`; -connect(non_ascii,localhost,Ÿ,plug_dest); +connect(non_ascii,localhost,Ÿ,plug_dest,"*NO-ONE*"); select USER(),CURRENT_USER(); connection default; @@ -84,8 +84,9 @@ GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; GRANT PROXY ON plug_dest TO new_grant_user; +GRANT CREATE, DROP ON test_grant_db.* TO 'plug_dest'@'%'; -connect(plug_con_grant,localhost,new_grant_user,plug_dest); +connect(plug_con_grant,localhost,new_grant_user,plug_dest,"*NO-ONE*"); select USER(),CURRENT_USER(); USE test_grant_db; CREATE TABLE t1 (a INT); @@ -102,9 +103,8 @@ GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user --error ER_ACCESS_DENIED_ERROR connect(plug_con_grant_deny,localhost,new_grant_user,plug_dest); -connect(plug_con_grant,localhost,new_grant_user,new_password); +connect(plug_con_grant,localhost,new_grant_user,new_password,test_grant_db); select USER(),CURRENT_USER(); -USE test_grant_db; CREATE TABLE t1 (a INT); DROP TABLE t1; connection default; @@ -159,7 +159,7 @@ GRANT ALL SELECT,PROXY ON grant_plug_dest TO grant_plug; --error ER_NONEXISTING_GRANT REVOKE PROXY ON grant_plug_dest FROM grant_plug; -connect(grant_plug_dest_con,localhost,grant_plug_dest,grant_plug_dest_passwd); +connect(grant_plug_dest_con,localhost,grant_plug_dest,grant_plug_dest_passwd,"*NO-ONE*"); --echo ## testing what an ordinary user can grant --echo this should fail : no rights to grant all @@ -262,7 +262,7 @@ SET GLOBAL proxy_user = 'test'; SET LOCAL proxy_user = 'test'; SELECT @@LOCAL.proxy_user; -connect(plug_con,localhost,plug,plug_dest); +connect(plug_con,localhost,plug,plug_dest,"*NO-ONE*"); SELECT @@LOCAL.proxy_user; connection default; disconnect plug_con; @@ -288,7 +288,7 @@ SET GLOBAL external_user = 'test'; SET LOCAL external_user = 'test'; SELECT @@LOCAL.external_user; -connect(plug_con,localhost,plug,plug_dest); +connect(plug_con,localhost,plug,plug_dest,"*NO-ONE*"); SELECT @@LOCAL.external_user; connection default; disconnect plug_con; @@ -418,7 +418,7 @@ CREATE USER uplain@localhost IDENTIFIED WITH 'cleartext_plugin_server' connect(cleartext_fail_con,localhost,uplain,cleartext_test2); --enable_query_log -connect(cleartext_con,localhost,uplain,cleartext_test); +connect(cleartext_con,localhost,uplain,cleartext_test,"*NO-ONE*"); select USER(),CURRENT_USER(); connection default; @@ -533,7 +533,7 @@ SET PASSWORD FOR bug12610784@localhost = PASSWORD('secret'); --error ER_ACCESS_DENIED_ERROR connect(b12610784,localhost,bug12610784,,test); --enable_query_log -connect(b12610784,localhost,bug12610784,secret,test); +connect(b12610784,localhost,bug12610784,secret,"*NO-ONE*"); connection default; disconnect b12610784; DROP USER bug12610784@localhost; @@ -550,7 +550,7 @@ CREATE USER bug12818542_dest@localhost IDENTIFIED BY 'bug12818542_dest_passwd'; GRANT PROXY ON bug12818542_dest@localhost TO bug12818542@localhost; -connect(bug12818542_con,localhost,bug12818542,bug12818542_dest); +connect(bug12818542_con,localhost,bug12818542,bug12818542_dest,"*NO-ONE*"); SELECT USER(),CURRENT_USER(); SET PASSWORD = PASSWORD('bruhaha'); @@ -558,7 +558,7 @@ SET PASSWORD = PASSWORD('bruhaha'); connection default; disconnect bug12818542_con; -connect(bug12818542_con2,localhost,bug12818542,bug12818542_dest); +connect(bug12818542_con2,localhost,bug12818542,bug12818542_dest,"*NO-ONE*"); SELECT USER(),CURRENT_USER(); connection default; diff --git a/mysql-test/main/plugin_auth_qa_1.result b/mysql-test/main/plugin_auth_qa_1.result index 24c86f1e2a8f5..d33662ab618e8 100644 --- a/mysql-test/main/plugin_auth_qa_1.result +++ b/mysql-test/main/plugin_auth_qa_1.result @@ -6,9 +6,11 @@ mariadb.sys mysql_native_password CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; GRANT PROXY ON `plug%dest` TO plug_user; +GRANT ALL ON test_user_db.* TO plug_user; ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) REVOKE PROXY ON `plug%dest` FROM plug_user; GRANT PROXY ON plug_dest TO plug_user; +GRANT ALL ON test_user_db.* TO 'plug_dest'@'%'; current_user() plug_dest@% user() @@ -52,6 +54,7 @@ CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; 1) ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) GRANT PROXY ON plug_dest TO plug_user; +GRANT ALL ON test_user_db.* TO 'plug_dest'@'%'; 2) current_user() plug_dest@% @@ -103,14 +106,14 @@ CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; GRANT PROXY ON plug_dest TO plug_user; -connect plug_user,localhost,plug_user,plug_dest; +connect plug_user,localhost,plug_user,plug_dest,"*NO-ONE*"; select USER(),CURRENT_USER(); USER() CURRENT_USER() plug_user@localhost plug_dest@% connection default; disconnect plug_user; RENAME USER plug_user TO new_user; -connect plug_user,localhost,new_user,plug_dest; +connect plug_user,localhost,new_user,plug_dest,"*NO-ONE*"; select USER(),CURRENT_USER(); USER() CURRENT_USER() new_user@localhost plug_dest@% @@ -134,7 +137,7 @@ CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; GRANT PROXY ON plug_dest TO plug_user; -connect plug_user,localhost,plug_user,plug_dest; +connect plug_user,localhost,plug_user,plug_dest,"*NO-ONE*"; select USER(),CURRENT_USER(); USER() CURRENT_USER() plug_user@localhost plug_dest@% @@ -176,7 +179,7 @@ User plugin authentication_string mariadb.sys mysql_native_password new_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 new_user test_plugin_server new_dest -connect plug_user,localhost,new_user,new_dest; +connect plug_user,localhost,new_user,new_dest,"*NO-ONE*"; select USER(),CURRENT_USER(); USER() CURRENT_USER() new_user@localhost new_dest@% @@ -192,7 +195,7 @@ new_dest mysql_native_password *01422E86A6FFF84618914AF149F9AEF64B84170A new_user test_plugin_server new_dest plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 GRANT ALL PRIVILEGES ON test.* TO new_user; -connect plug_user,localhost,new_dest,new_dest_passwd; +connect plug_user,localhost,new_dest,new_dest_passwd,"*NO-ONE*"; select USER(),CURRENT_USER(); USER() CURRENT_USER() new_dest@localhost new_dest@% @@ -207,7 +210,7 @@ User plugin authentication_string test_plugin_server proxied_user mariadb.sys mysql_native_password proxied_user mysql_native_password *D7A51428CD38DB3C5293B9321DA1228BFB1611DD -connect proxy_con,localhost,proxied_user,proxied_user_passwd; +connect proxy_con,localhost,proxied_user,proxied_user_passwd,"*NO-ONE*"; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() proxied_user@localhost proxied_user@% @@ -219,13 +222,13 @@ connection default; disconnect proxy_con; ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES) GRANT PROXY ON proxied_user TO ''@'%%'; -connect proxy_con,localhost,proxied_user,proxied_user_passwd; +connect proxy_con,localhost,proxied_user,proxied_user_passwd,"*NO-ONE*"; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() proxied_user@localhost proxied_user@% connection default; disconnect proxy_con; -connect proxy_con,localhost,proxy_user,proxied_user; +connect proxy_con,localhost,proxy_user,proxied_user,"*NO-ONE*"; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() proxy_user@localhost proxied_user@% @@ -244,7 +247,7 @@ User plugin authentication_string test_plugin_server proxied_user mariadb.sys mysql_native_password proxied_user mysql_native_password *D7A51428CD38DB3C5293B9321DA1228BFB1611DD -connect proxy_con,localhost,proxied_user,proxied_user_passwd; +connect proxy_con,localhost,proxied_user,proxied_user_passwd,"*NO-ONE*"; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() proxied_user@localhost proxied_user@% @@ -255,13 +258,13 @@ connection default; disconnect proxy_con; ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES) GRANT PROXY ON proxied_user TO ''@'%%'; -connect proxy_con,localhost,proxied_user,proxied_user_passwd; +connect proxy_con,localhost,proxied_user,proxied_user_passwd,"*NO-ONE*"; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() proxied_user@localhost proxied_user@% connection default; disconnect proxy_con; -connect proxy_con,localhost,proxy_user,proxied_user; +connect proxy_con,localhost,proxy_user,proxied_user,"*NO-ONE*"; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() proxy_user@localhost proxied_user@% @@ -291,11 +294,11 @@ proxied_user_2 mysql_native_password *3D948F77C6A988AFDCA9755AB2A6724362557220 proxied_user_3 mysql_native_password *41A18925D237DEE738C76581153990B037F462E3 proxied_user_4 mysql_native_password *F990073A9B96FF535C2D0721406042B8751E593F proxied_user_5 mysql_native_password *5AA915C5D0B5B1336336FD2BF7768BC09FD1F5B2 -connect proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd'; -connect proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd; -connect proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd; -connect proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd; -connect proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd; +connect proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd',"*NO-ONE*"; +connect proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd,"*NO-ONE*"; +connect proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd,"*NO-ONE*"; +connect proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd,"*NO-ONE*"; +connect proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd,"*NO-ONE*"; connection proxy_con_1; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() diff --git a/mysql-test/main/plugin_auth_qa_1.test b/mysql-test/main/plugin_auth_qa_1.test index 1c53da598443c..100670dc8e743 100644 --- a/mysql-test/main/plugin_auth_qa_1.test +++ b/mysql-test/main/plugin_auth_qa_1.test @@ -16,10 +16,12 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; GRANT PROXY ON `plug%dest` TO plug_user; +GRANT ALL ON test_user_db.* TO plug_user; --error 1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 REVOKE PROXY ON `plug%dest` FROM plug_user; GRANT PROXY ON plug_dest TO plug_user; +GRANT ALL ON test_user_db.* TO 'plug_dest'@'%'; --replace_result $MASTER_MYSOCK MASTER_MYSOCK --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 REVOKE PROXY ON plug_dest FROM plug_user; @@ -56,6 +58,7 @@ CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; --error 1 --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 GRANT PROXY ON plug_dest TO plug_user; +GRANT ALL ON test_user_db.* TO 'plug_dest'@'%'; --echo 2) --replace_result $MASTER_MYSOCK MASTER_MYSOCK --exec $MYSQL -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1 @@ -105,12 +108,12 @@ CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; GRANT PROXY ON plug_dest TO plug_user; -connect(plug_user,localhost,plug_user,plug_dest); +connect(plug_user,localhost,plug_user,plug_dest,"*NO-ONE*"); select USER(),CURRENT_USER(); connection default; disconnect plug_user; RENAME USER plug_user TO new_user; -connect(plug_user,localhost,new_user,plug_dest); +connect(plug_user,localhost,new_user,plug_dest,"*NO-ONE*"); select USER(),CURRENT_USER(); connection default; --sorted_result @@ -128,7 +131,7 @@ CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; GRANT PROXY ON plug_dest TO plug_user; -connect(plug_user,localhost,plug_user,plug_dest); +connect(plug_user,localhost,plug_user,plug_dest,"*NO-ONE*"); select USER(),CURRENT_USER(); connection default; disconnect plug_user; @@ -156,7 +159,7 @@ FLUSH PRIVILEGES; GRANT PROXY ON new_dest TO new_user; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -connect(plug_user,localhost,new_user,new_dest); +connect(plug_user,localhost,new_user,new_dest,"*NO-ONE*"); select USER(),CURRENT_USER(); connection default; disconnect plug_user; @@ -166,7 +169,7 @@ CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd'; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; GRANT ALL PRIVILEGES ON test.* TO new_user; -connect(plug_user,localhost,new_dest,new_dest_passwd); +connect(plug_user,localhost,new_dest,new_dest_passwd,"*NO-ONE*"); select USER(),CURRENT_USER(); connection default; disconnect plug_user; @@ -178,7 +181,7 @@ CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -connect(proxy_con,localhost,proxied_user,proxied_user_passwd); +connect(proxy_con,localhost,proxied_user,proxied_user_passwd,"*NO-ONE*"); SELECT USER(),CURRENT_USER(); --echo ========== test 2.2.1 ====================================== SELECT @@proxy_user; @@ -189,11 +192,11 @@ disconnect proxy_con; connect(proxy_con,localhost,proxy_user,proxied_user); --enable_query_log GRANT PROXY ON proxied_user TO ''@'%%'; -connect(proxy_con,localhost,proxied_user,proxied_user_passwd); +connect(proxy_con,localhost,proxied_user,proxied_user_passwd,"*NO-ONE*"); SELECT USER(),CURRENT_USER(); connection default; disconnect proxy_con; -connect(proxy_con,localhost,proxy_user,proxied_user); +connect(proxy_con,localhost,proxy_user,proxied_user,"*NO-ONE*"); SELECT USER(),CURRENT_USER(); --echo ========== test 2.2.1 ====================================== SELECT @@proxy_user; @@ -206,7 +209,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'%%' CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -connect(proxy_con,localhost,proxied_user,proxied_user_passwd); +connect(proxy_con,localhost,proxied_user,proxied_user_passwd,"*NO-ONE*"); SELECT USER(),CURRENT_USER(); SELECT @@proxy_user; connection default; @@ -216,11 +219,11 @@ disconnect proxy_con; connect(proxy_con,localhost,proxy_user,proxied_user); --enable_query_log GRANT PROXY ON proxied_user TO ''@'%%'; -connect(proxy_con,localhost,proxied_user,proxied_user_passwd); +connect(proxy_con,localhost,proxied_user,proxied_user_passwd,"*NO-ONE*"); SELECT USER(),CURRENT_USER(); connection default; disconnect proxy_con; -connect(proxy_con,localhost,proxy_user,proxied_user); +connect(proxy_con,localhost,proxy_user,proxied_user,"*NO-ONE*"); SELECT USER(),CURRENT_USER(); SELECT @@proxy_user; connection default; @@ -240,11 +243,11 @@ GRANT PROXY ON proxied_user_4 TO ''@'%%'; GRANT PROXY ON proxied_user_5 TO ''@'%%'; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd'); -connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd); -connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd); -connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd); -connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd); +connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd',"*NO-ONE*"); +connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd,"*NO-ONE*"); +connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd,"*NO-ONE*"); +connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd,"*NO-ONE*"); +connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd,"*NO-ONE*"); connection proxy_con_1; SELECT USER(),CURRENT_USER(); SELECT @@proxy_user; diff --git a/mysql-test/main/plugin_auth_qa_2.result b/mysql-test/main/plugin_auth_qa_2.result index de3023a3e4285..c4ec8c0a36482 100644 --- a/mysql-test/main/plugin_auth_qa_2.result +++ b/mysql-test/main/plugin_auth_qa_2.result @@ -5,6 +5,7 @@ CREATE USER qa_test_1_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_1_dest' CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd'; GRANT PROXY ON qa_test_1_dest TO qa_test_1_user; +GRANT ALL ON test_user_db.* TO 'qa_test_1_user'@'%'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; User plugin authentication_string mariadb.sys mysql_native_password @@ -33,6 +34,7 @@ CREATE USER authenticated_as IDENTIFIED BY 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_passwd'; GRANT PROXY ON qa_test_2_dest TO qa_test_2_user; GRANT PROXY ON authenticated_as TO qa_test_2_user; +GRANT ALL ON test_user_db.* TO 'authenticated_as'@'%'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; User plugin authentication_string authenticated_as mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 diff --git a/mysql-test/main/plugin_auth_qa_2.test b/mysql-test/main/plugin_auth_qa_2.test index 17e627ab77387..bed5eec59e9cf 100644 --- a/mysql-test/main/plugin_auth_qa_2.test +++ b/mysql-test/main/plugin_auth_qa_2.test @@ -17,6 +17,7 @@ CREATE USER qa_test_1_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_1_dest' CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd'; GRANT PROXY ON qa_test_1_dest TO qa_test_1_user; +GRANT ALL ON test_user_db.* TO 'qa_test_1_user'@'%'; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT @@proxy_user; @@ -39,6 +40,7 @@ CREATE USER authenticated_as IDENTIFIED BY 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_passwd'; GRANT PROXY ON qa_test_2_dest TO qa_test_2_user; GRANT PROXY ON authenticated_as TO qa_test_2_user; +GRANT ALL ON test_user_db.* TO 'authenticated_as'@'%'; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; SELECT @@proxy_user; diff --git a/mysql-test/main/ps_show_log.result b/mysql-test/main/ps_show_log.result index 63cd7789de4d0..dbe078e7d1b6f 100644 --- a/mysql-test/main/ps_show_log.result +++ b/mysql-test/main/ps_show_log.result @@ -51,7 +51,7 @@ DEALLOCATE PREPARE stmt_1; # and check that attempt to execute the statements SHOW BINLOG EVENTS/ # SHOW RELAYLOG EVENTS as a prepred statements by a user without required # privileges results in error. -connect con2,localhost,u1,,test; +connect con2,localhost,u1,,"*NO-ONE*"; PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS'; EXECUTE stmt_1; ERROR 42000: Access denied; you need (at least one of) the BINLOG MONITOR privilege(s) for this operation diff --git a/mysql-test/main/ps_show_log.test b/mysql-test/main/ps_show_log.test index 95000d2d7e0e5..411b15600e130 100644 --- a/mysql-test/main/ps_show_log.test +++ b/mysql-test/main/ps_show_log.test @@ -51,7 +51,7 @@ DEALLOCATE PREPARE stmt_1; --echo # SHOW RELAYLOG EVENTS as a prepred statements by a user without required --echo # privileges results in error. ---connect (con2,localhost,u1,,test) +--connect (con2,localhost,u1,,"*NO-ONE*") PREPARE stmt_1 FROM 'SHOW BINLOG EVENTS'; --error ER_SPECIFIC_ACCESS_DENIED_ERROR diff --git a/mysql-test/main/public_basic.result b/mysql-test/main/public_basic.result new file mode 100644 index 0000000000000..380e07a7b7e33 --- /dev/null +++ b/mysql-test/main/public_basic.result @@ -0,0 +1,122 @@ +# +# MDEV-5215 Granted to PUBLIC +# +SHOW GRANTS FOR PUBLIC; +Grants for PUBLIC +# it is not PUBLIC but an user +# (this should work as it allowed for roles for example) +create user PUBLIC; +create user PUBLIC@localhost; +GRANT SELECT on test.* to PUBLIC@localhost; +drop user PUBLIC@localhost; +drop user PUBLIC; +select * from mysql.global_priv where user="PUBLIC" ; +Host User Priv +GRANT SELECT on test.* to PUBLIC; +GRANT SELECT on mysql.db to PUBLIC; +select * from mysql.global_priv where user="PUBLIC" ; +Host User Priv + PUBLIC {"access":0,"version_id":VERSION,"is_role":true} +SHOW GRANTS FOR PUBLIC; +Grants for PUBLIC +GRANT SELECT ON `test`.* TO PUBLIC +GRANT SELECT ON `mysql`.`db` TO PUBLIC +GRANT UPDATE on test.* to PUBLIC; +grant update on mysql.db to public; +show grants for public; +Grants for PUBLIC +GRANT SELECT, UPDATE ON `test`.* TO PUBLIC +GRANT SELECT, UPDATE ON `mysql`.`db` TO PUBLIC +revoke select on test.* from public; +REVOKE SELECT on mysql.db from PUBLIC; +SHOW GRANTS FOR PUBLIC; +Grants for PUBLIC +GRANT UPDATE ON `test`.* TO PUBLIC +GRANT UPDATE ON `mysql`.`db` TO PUBLIC +REVOKE UPDATE on test.* from PUBLIC; +REVOKE UPDATE on mysql.db from PUBLIC; +SHOW GRANTS FOR PUBLIC; +Grants for PUBLIC +GRANT XXXXXX TO CURRENT_USER; +ERROR OP000: Invalid role specification `XXXXXX` +# following should fail with the same error as above +GRANT PUBLIC TO CURRENT_USER; +ERROR OP000: Invalid role specification `PUBLIC` +revoke xxxxxx from current_user; +ERROR OP000: Invalid role specification `xxxxxx` +# following should fail with the same error as above +revoke public from current_user; +ERROR OP000: Invalid role specification `PUBLIC` +drop role XXXXXX; +ERROR HY000: Operation DROP ROLE failed for 'XXXXXX' +# following should fail with the same error as above +drop role public; +ERROR HY000: Operation DROP ROLE failed for PUBLIC +SET ROLE XXXXXX; +ERROR OP000: Invalid role specification `XXXXXX` +# following should fail with the same error as above +SET ROLE PUBLIC; +ERROR OP000: Invalid role specification `PUBLIC` +SET DEFAULT ROLE XXXXXX; +ERROR OP000: Invalid role specification `XXXXXX` +# following should fail with the same error as above +SET DEFAULT ROLE PUBLIC; +ERROR OP000: Invalid role specification `PUBLIC` +set default role public; +ERROR OP000: Invalid role specification `PUBLIC` +# +# check prohibition of change security context to PUBLIC +# +# be sure that we have PUBLIC +GRANT SELECT on test.* to PUBLIC; +# try with a view +create table t1( a int); +create definer = PUBLIC view v1 as select * from t1; +ERROR OP000: Invalid role specification `PUBLIC` +drop table t1; +# try with a stored procedure +create definer='PUBLIC' PROCEDURE p1() SELECT 1; +ERROR OP000: Invalid role specification `PUBLIC` +# this test cleanup +revoke select on test.* from public; +# +# check autocreation of PUBLIC on GRANT role TO PUBLIC +# +# make sure that the privilege will be added automatically +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +create role roletest; +grant roletest to public; +drop role roletest; +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +grant select on mysql.global_priv to public; +revoke select on mysql.global_priv from public; +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +grant select (user) on mysql.global_priv to public; +revoke select (user) on mysql.global_priv from public; +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +grant execute on procedure mtr.add_suppression to public; +revoke execute on procedure mtr.add_suppression from public; +# +# MDEV-30154: Assertion `strcasecmp(rolename, public_name.str) || +# acl_public == role' failed in acl_update_role on GRANT ... TO PUBLIC +# +call mtr.add_suppression("Can't open and lock privilege tables"); +USE test; +GRANT SELECT ON *.* TO PUBLIC; +LOCK TABLES mysql.time_zone WRITE,mysql.proc WRITE; +FLUSH PRIVILEGES; +ERROR HY000: Table 'db' was not locked with LOCK TABLES +LOCK TABLE nonexisting WRITE; +ERROR 42S02: Table 'test.nonexisting' doesn't exist +GRANT SELECT ON *.* TO PUBLIC; +REVOKE SELECT ON *.* FROM PUBLIC; +# +# End of 10.11 test +# +# clean up +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; diff --git a/mysql-test/main/public_basic.test b/mysql-test/main/public_basic.test new file mode 100644 index 0000000000000..fb175820ee0d5 --- /dev/null +++ b/mysql-test/main/public_basic.test @@ -0,0 +1,134 @@ +--source include/not_embedded.inc +--echo # +--echo # MDEV-5215 Granted to PUBLIC +--echo # + +SHOW GRANTS FOR PUBLIC; + +--echo # it is not PUBLIC but an user +--echo # (this should work as it allowed for roles for example) +create user PUBLIC; +create user PUBLIC@localhost; +GRANT SELECT on test.* to PUBLIC@localhost; +drop user PUBLIC@localhost; +drop user PUBLIC; + +select * from mysql.global_priv where user="PUBLIC" ; +GRANT SELECT on test.* to PUBLIC; +GRANT SELECT on mysql.db to PUBLIC; +--replace_regex /"version_id"\:[0-9]+/"version_id":VERSION/ +select * from mysql.global_priv where user="PUBLIC" ; + +SHOW GRANTS FOR PUBLIC; + +GRANT UPDATE on test.* to PUBLIC; +grant update on mysql.db to public; + +show grants for public; + +revoke select on test.* from public; +REVOKE SELECT on mysql.db from PUBLIC; + +SHOW GRANTS FOR PUBLIC; + +REVOKE UPDATE on test.* from PUBLIC; +REVOKE UPDATE on mysql.db from PUBLIC; + +SHOW GRANTS FOR PUBLIC; + +--error ER_INVALID_ROLE +GRANT XXXXXX TO CURRENT_USER; +--echo # following should fail with the same error as above +--error ER_INVALID_ROLE +GRANT PUBLIC TO CURRENT_USER; + +--error ER_INVALID_ROLE +revoke xxxxxx from current_user; +--echo # following should fail with the same error as above +--error ER_INVALID_ROLE +revoke public from current_user; + +--error ER_CANNOT_USER +drop role XXXXXX; +--echo # following should fail with the same error as above +--error ER_CANNOT_USER +drop role public; + +--error ER_INVALID_ROLE +SET ROLE XXXXXX; +--echo # following should fail with the same error as above +--error ER_INVALID_ROLE +SET ROLE PUBLIC; + +--error ER_INVALID_ROLE +SET DEFAULT ROLE XXXXXX; +--echo # following should fail with the same error as above +--error ER_INVALID_ROLE +SET DEFAULT ROLE PUBLIC; +--error ER_INVALID_ROLE +set default role public; + +--echo # +--echo # check prohibition of change security context to PUBLIC +--echo # +--echo # be sure that we have PUBLIC +GRANT SELECT on test.* to PUBLIC; +--echo # try with a view +create table t1( a int); +--error ER_INVALID_ROLE +create definer = PUBLIC view v1 as select * from t1; +drop table t1; +--echo # try with a stored procedure +--error ER_INVALID_ROLE +create definer='PUBLIC' PROCEDURE p1() SELECT 1; +--echo # this test cleanup +revoke select on test.* from public; + +--echo # +--echo # check autocreation of PUBLIC on GRANT role TO PUBLIC +--echo # +--echo # make sure that the privilege will be added automatically +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +create role roletest; +grant roletest to public; +drop role roletest; + +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +grant select on mysql.global_priv to public; +revoke select on mysql.global_priv from public; + +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +grant select (user) on mysql.global_priv to public; +revoke select (user) on mysql.global_priv from public; + +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +grant execute on procedure mtr.add_suppression to public; +revoke execute on procedure mtr.add_suppression from public; + +--echo # +--echo # MDEV-30154: Assertion `strcasecmp(rolename, public_name.str) || +--echo # acl_public == role' failed in acl_update_role on GRANT ... TO PUBLIC +--echo # +call mtr.add_suppression("Can't open and lock privilege tables"); +USE test; +GRANT SELECT ON *.* TO PUBLIC; +LOCK TABLES mysql.time_zone WRITE,mysql.proc WRITE; +--error 1100 +FLUSH PRIVILEGES; +--error 1146 +LOCK TABLE nonexisting WRITE; +GRANT SELECT ON *.* TO PUBLIC; + +REVOKE SELECT ON *.* FROM PUBLIC; + +--echo # +--echo # End of 10.11 test +--echo # + +-- echo # clean up +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; diff --git a/mysql-test/main/public_privileges.result b/mysql-test/main/public_privileges.result new file mode 100644 index 0000000000000..18a45a1231f56 --- /dev/null +++ b/mysql-test/main/public_privileges.result @@ -0,0 +1,344 @@ +# +# MDEV-5215 Granted to PUBLIC +# +# +# Test DB/TABLE/COLUMN privileges in queries +# +SHOW GRANTS FOR PUBLIC; +Grants for PUBLIC +create user testuser; +create database testdb1; +use testdb1; +create table t1 (a int, b int); +insert into t1 values (1,2); +create database testdb2; +use testdb2; +create table t2 (a int, b int); +insert into t2 values (1,2); +create table t3 (a int, b int); +insert into t3 values (1,2); +connect testuser,localhost,testuser,,; +select * from testdb1.t1; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `testdb1`.`t1` +select * from testdb2.t2; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `testdb2`.`t2` +select b from testdb2.t3; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `testdb2`.`t3` +select a from testdb2.t3; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `testdb2`.`t3` +connection default; +GRANT SELECT ON testdb1.* to PUBLIC; +GRANT SELECT ON testdb2.t2 to PUBLIC; +GRANT SELECT (b) ON testdb2.t3 to PUBLIC; +connection testuser; +select * from testdb1.t1; +a b +1 2 +select * from testdb2.t2; +a b +1 2 +select b from testdb2.t3; +b +2 +select a from testdb2.t3; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'a' in table 't3' +show grants; +Grants for testuser@% +GRANT USAGE ON *.* TO `testuser`@`%` +GRANT SELECT ON `testdb1`.* TO PUBLIC +GRANT SELECT ON `testdb2`.`t2` TO PUBLIC +GRANT SELECT (`b`) ON `testdb2`.`t3` TO PUBLIC +show grants for testuser@'%'; +Grants for testuser@% +GRANT USAGE ON *.* TO `testuser`@`%` +connection default; +disconnect testuser; +# check that the privileges are correctly read by acl_load +flush privileges; +connect testuser,localhost,testuser,,; +select * from testdb1.t1; +a b +1 2 +select * from testdb2.t2; +a b +1 2 +select b from testdb2.t3; +b +2 +select a from testdb2.t3; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'a' in table 't3' +connection default; +use test; +disconnect testuser; +REVOKE SELECT ON testdb1.* from PUBLIC; +REVOKE SELECT ON testdb2.t2 from PUBLIC; +REVOKE SELECT (b) ON testdb2.t3 from PUBLIC; +drop user testuser; +drop database testdb1; +drop database testdb2; +# +# test global process list privilege and EXECUTE db level +# +create user testuser; +create database testdb; +use testdb; +create procedure p1 () select 1; +connect testuser,localhost,testuser,,; +select user,db from information_schema.processlist where user='root'; +user db +call testdb.p1(); +ERROR 42000: execute command denied to user 'testuser'@'%' for routine 'testdb.p1' +connection default; +GRANT PROCESS ON *.* to PUBLIC; +GRANT EXECUTE ON testdb.* to PUBLIC; +disconnect testuser; +connect testuser,localhost,testuser,,; +select user,db from information_schema.processlist where user='root'; +user db +root testdb +call testdb.p1(); +1 +1 +connection default; +disconnect testuser; +# check that the privileges are correctly read by acl_load +flush privileges; +connect testuser,localhost,testuser,,; +select user,db from information_schema.processlist where user='root'; +user db +root testdb +call testdb.p1(); +1 +1 +connection default; +use test; +disconnect testuser; +REVOKE PROCESS ON *.* from PUBLIC; +REVOKE EXECUTE ON testdb.* from PUBLIC; +drop user testuser; +drop database testdb; +# +# test DB privilege to allow USE statement +# +create user testuser; +create database testdb; +connect testuser,localhost,testuser,,; +use testdb; +ERROR 42000: Access denied for user 'testuser'@'%' to database 'testdb' +connection default; +GRANT LOCK TABLES ON testdb.* to PUBLIC; +connection testuser; +use testdb; +connection default; +disconnect testuser; +# check that the privileges are correctly read by acl_load +flush privileges; +connect testuser,localhost,testuser,,; +use testdb; +connection default; +use test; +disconnect testuser; +REVOKE LOCK TABLES ON testdb.* from PUBLIC; +drop user testuser; +drop database testdb; +# +# test DB privilege to allow USE statement (as above) +# test current db privileges +# +create user testuser; +create database testdb; +use testdb; +create table t1 (a int); +insert into t1 values (1); +GRANT LOCK TABLES ON testdb.* to PUBLIC; +connect testuser,localhost,testuser,,; +use testdb; +update t1 set a=a+1; +ERROR 42000: UPDATE command denied to user 'testuser'@'localhost' for table `testdb`.`t1` +connection default; +GRANT UPDATE,SELECT ON testdb.* to PUBLIC; +connection testuser; +use testdb; +update t1 set a=a+1; +connection default; +select * from testdb.t1; +a +2 +use test; +disconnect testuser; +REVOKE LOCK TABLES ON testdb.* from PUBLIC; +REVOKE UPDATE,SELECT ON testdb.* from PUBLIC; +drop user testuser; +drop database testdb; +# +# test DB privilege to allow USE statement (as above) +# test table/column privileges in current DB +# +create user testuser; +create database testdb; +use testdb; +create table t1 (a int); +insert into t1 values (1); +create table t2 (a int, b int); +insert into t2 values (1,2); +GRANT LOCK TABLES ON testdb.* to PUBLIC; +connect testuser,localhost,testuser,,; +use testdb; +delete from t1; +ERROR 42000: DELETE command denied to user 'testuser'@'localhost' for table `testdb`.`t1` +select b from t2; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `testdb`.`t2` +select a from t2; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `testdb`.`t2` +connection default; +GRANT DELETE ON testdb.t1 to PUBLIC; +GRANT SELECT (a) ON testdb.t2 to PUBLIC; +connection testuser; +use testdb; +delete from t1; +select a from t2; +a +1 +select b from t2; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't2' +connection default; +select * from testdb.t1; +a +insert into t1 values (1); +disconnect testuser; +# check that the privileges are correctly read by acl_load +flush privileges; +connect testuser,localhost,testuser,,; +use testdb; +delete from t1; +select a from t2; +a +1 +select b from t2; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't2' +connection default; +select * from testdb.t1; +a +use test; +disconnect testuser; +REVOKE ALL PRIVILEGES, GRANT OPTION from `PUBLIC`; +SHOW GRANTS FOR PUBLIC; +Grants for PUBLIC +drop user testuser; +drop database testdb; +# +# test function privilege +# +create user testuser; +create database testdb; +use testdb; +create function f1() returns int return 2; +connect testuser,localhost,testuser,,; +alter function testdb.f1 comment "A stupid function"; +ERROR 42000: alter routine command denied to user 'testuser'@'%' for routine 'testdb.f1' +select testdb.f1(); +ERROR 42000: execute command denied to user 'testuser'@'%' for routine 'testdb.f1' +connection default; +GRANT ALTER ROUTINE ON testdb.* to PUBLIC; +connection testuser; +alter function testdb.f1 comment "A stupid function"; +select testdb.f1(); +ERROR 42000: execute command denied to user 'testuser'@'%' for routine 'testdb.f1' +connection default; +disconnect testuser; +# check that the privileges are correctly read by acl_load +flush privileges; +connect testuser,localhost,testuser,,; +alter function testdb.f1 comment "A stupid function"; +select testdb.f1(); +ERROR 42000: execute command denied to user 'testuser'@'%' for routine 'testdb.f1' +connection default; +use test; +disconnect testuser; +REVOKE ALTER ROUTINE ON testdb.* from PUBLIC; +drop function testdb.f1; +drop user testuser; +drop database testdb; +# +# bug with automatically added PUBLIC role +# +# automaticly added PUBLIC +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +GRANT SELECT on test.* to PUBLIC; +REVOKE SELECT on test.* from PUBLIC; +create user testuser; +create database testdb1; +use testdb1; +create table t1 (a int, b int); +insert into t1 values (1,2); +connect testuser,localhost,testuser,,; +select * from testdb1.t1; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `testdb1`.`t1` +connection default; +disconnect testuser; +drop user testuser; +drop database testdb1; +# +# check assigning privileges via GRAND role TO PUBLIC +# +create user testuser; +create database testdb1; +use testdb1; +create table t1 (a int, b int); +# check that user do not have rights +connect testuser,localhost,testuser,,*NO-ONE*; +select * from testdb1.t1; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `testdb1`.`t1` +connection default; +give rights to everyone via assigning the role to public +create role roletest; +GRANT SELECT ON testdb1.* TO roletest; +GRANT roletest TO PUBLIC; +connection testuser; +select * from testdb1.t1; +a b +connection default; +disconnect testuser; +# check that the privileges are correctly read by acl_load +flush privileges; +connect testuser,localhost,testuser,,*NO-ONE*; +select * from testdb1.t1; +a b +connection default; +# drop role... +drop role roletest; +# ... and check that user does not have rights again +connection testuser; +select * from testdb1.t1; +ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for table `testdb1`.`t1` +connection default; +disconnect testuser; +drop user testuser; +drop database testdb1; +# clean up +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +# +# MDEV-29752 SHOW GRANTS FOR PUBLIC should work for all users +# +create database dbtest; +create user `testuser`@`%`; +GRANT USAGE ON *.* TO `testuser`@`%`; +GRANT ALL PRIVILEGES ON `dbtest`.* TO `PUBLIC`; +connect testuser,localhost,testuser,,; +show grants for public; +Grants for PUBLIC +GRANT ALL PRIVILEGES ON `dbtest`.* TO PUBLIC +show grants for testuser; +Grants for testuser@% +GRANT USAGE ON *.* TO `testuser`@`%` +connection default; +disconnect testuser; +REVOKE ALL PRIVILEGES ON `dbtest`.* FROM `PUBLIC`; +REVOKE USAGE ON *.* FROM `testuser`@`%`; +drop user `testuser`@`%`; +drop database dbtest; +# clean up +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; diff --git a/mysql-test/main/public_privileges.test b/mysql-test/main/public_privileges.test new file mode 100644 index 0000000000000..9465cc9bfaddf --- /dev/null +++ b/mysql-test/main/public_privileges.test @@ -0,0 +1,409 @@ +--source include/not_embedded.inc +--echo # +--echo # MDEV-5215 Granted to PUBLIC +--echo # + +--echo # +--echo # Test DB/TABLE/COLUMN privileges in queries +--echo # + +SHOW GRANTS FOR PUBLIC; + +create user testuser; +create database testdb1; +use testdb1; +create table t1 (a int, b int); +insert into t1 values (1,2); +create database testdb2; +use testdb2; +create table t2 (a int, b int); +insert into t2 values (1,2); +create table t3 (a int, b int); +insert into t3 values (1,2); + +connect (testuser,localhost,testuser,,); +--error ER_TABLEACCESS_DENIED_ERROR +select * from testdb1.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from testdb2.t2; +--error ER_TABLEACCESS_DENIED_ERROR +select b from testdb2.t3; +--error ER_TABLEACCESS_DENIED_ERROR +select a from testdb2.t3; + +connection default; + +GRANT SELECT ON testdb1.* to PUBLIC; +GRANT SELECT ON testdb2.t2 to PUBLIC; +GRANT SELECT (b) ON testdb2.t3 to PUBLIC; + +connection testuser; +select * from testdb1.t1; +select * from testdb2.t2; +select b from testdb2.t3; +--error ER_COLUMNACCESS_DENIED_ERROR +select a from testdb2.t3; + +show grants; +show grants for testuser@'%'; + +connection default; +disconnect testuser; + +--echo # check that the privileges are correctly read by acl_load +flush privileges; + +connect (testuser,localhost,testuser,,); +select * from testdb1.t1; +select * from testdb2.t2; +select b from testdb2.t3; +--error ER_COLUMNACCESS_DENIED_ERROR +select a from testdb2.t3; + +connection default; +use test; +disconnect testuser; +REVOKE SELECT ON testdb1.* from PUBLIC; +REVOKE SELECT ON testdb2.t2 from PUBLIC; +REVOKE SELECT (b) ON testdb2.t3 from PUBLIC; +drop user testuser; +drop database testdb1; +drop database testdb2; + +--echo # +--echo # test global process list privilege and EXECUTE db level +--echo # + +create user testuser; +create database testdb; +use testdb; +create procedure p1 () select 1; + +connect (testuser,localhost,testuser,,); + +select user,db from information_schema.processlist where user='root'; +--error ER_PROCACCESS_DENIED_ERROR +call testdb.p1(); + +connection default; + +GRANT PROCESS ON *.* to PUBLIC; +GRANT EXECUTE ON testdb.* to PUBLIC; + +# need to reconnect because of PROCESS +disconnect testuser; +connect (testuser,localhost,testuser,,); + +select user,db from information_schema.processlist where user='root'; +call testdb.p1(); + +connection default; +disconnect testuser; + +--echo # check that the privileges are correctly read by acl_load +flush privileges; + +connect (testuser,localhost,testuser,,); + +select user,db from information_schema.processlist where user='root'; +call testdb.p1(); + +connection default; +use test; +disconnect testuser; +REVOKE PROCESS ON *.* from PUBLIC; +REVOKE EXECUTE ON testdb.* from PUBLIC; +drop user testuser; +drop database testdb; + +--echo # +--echo # test DB privilege to allow USE statement +--echo # + +create user testuser; +create database testdb; + +connect (testuser,localhost,testuser,,); + +--error ER_DBACCESS_DENIED_ERROR +use testdb; + +connection default; + +GRANT LOCK TABLES ON testdb.* to PUBLIC; + +connection testuser; + +use testdb; + +connection default; +disconnect testuser; + +--echo # check that the privileges are correctly read by acl_load +flush privileges; + +connect (testuser,localhost,testuser,,); + +use testdb; + +connection default; + +use test; +disconnect testuser; +REVOKE LOCK TABLES ON testdb.* from PUBLIC; +drop user testuser; +drop database testdb; + + +--echo # +--echo # test DB privilege to allow USE statement (as above) +--echo # test current db privileges +--echo # + +create user testuser; +create database testdb; +use testdb; +create table t1 (a int); +insert into t1 values (1); +GRANT LOCK TABLES ON testdb.* to PUBLIC; + +connect (testuser,localhost,testuser,,); + +use testdb; +--error ER_TABLEACCESS_DENIED_ERROR +update t1 set a=a+1; + +connection default; + +GRANT UPDATE,SELECT ON testdb.* to PUBLIC; + +connection testuser; + +use testdb; +update t1 set a=a+1; + +connection default; +select * from testdb.t1; + +use test; +disconnect testuser; +REVOKE LOCK TABLES ON testdb.* from PUBLIC; +REVOKE UPDATE,SELECT ON testdb.* from PUBLIC; +drop user testuser; +drop database testdb; + + +--echo # +--echo # test DB privilege to allow USE statement (as above) +--echo # test table/column privileges in current DB +--echo # + +create user testuser; +create database testdb; +use testdb; +create table t1 (a int); +insert into t1 values (1); +create table t2 (a int, b int); +insert into t2 values (1,2); +GRANT LOCK TABLES ON testdb.* to PUBLIC; + +connect (testuser,localhost,testuser,,); + +use testdb; +--error ER_TABLEACCESS_DENIED_ERROR +delete from t1; +--error ER_TABLEACCESS_DENIED_ERROR +select b from t2; +--error ER_TABLEACCESS_DENIED_ERROR +select a from t2; + +connection default; + +GRANT DELETE ON testdb.t1 to PUBLIC; +GRANT SELECT (a) ON testdb.t2 to PUBLIC; + +connection testuser; + +use testdb; +delete from t1; +select a from t2; +--error ER_COLUMNACCESS_DENIED_ERROR +select b from t2; + +connection default; +select * from testdb.t1; +insert into t1 values (1); +disconnect testuser; + +--echo # check that the privileges are correctly read by acl_load +flush privileges; + +connect (testuser,localhost,testuser,,); + +use testdb; +delete from t1; +select a from t2; +--error ER_COLUMNACCESS_DENIED_ERROR +select b from t2; + +connection default; +select * from testdb.t1; + + +use test; +disconnect testuser; +REVOKE ALL PRIVILEGES, GRANT OPTION from `PUBLIC`; +SHOW GRANTS FOR PUBLIC; + +drop user testuser; +drop database testdb; + +--echo # +--echo # test function privilege +--echo # + +create user testuser; +create database testdb; +use testdb; +create function f1() returns int return 2; + +connect (testuser,localhost,testuser,,); + +--error ER_PROCACCESS_DENIED_ERROR +alter function testdb.f1 comment "A stupid function"; +--error ER_PROCACCESS_DENIED_ERROR +select testdb.f1(); + +connection default; + +GRANT ALTER ROUTINE ON testdb.* to PUBLIC; + +connection testuser; + +alter function testdb.f1 comment "A stupid function"; +--error ER_PROCACCESS_DENIED_ERROR +select testdb.f1(); + +connection default; +disconnect testuser; + +--echo # check that the privileges are correctly read by acl_load +flush privileges; + +connect (testuser,localhost,testuser,,); + +alter function testdb.f1 comment "A stupid function"; +--error ER_PROCACCESS_DENIED_ERROR +select testdb.f1(); + +connection default; + +use test; +disconnect testuser; +REVOKE ALTER ROUTINE ON testdb.* from PUBLIC; +drop function testdb.f1; +drop user testuser; +drop database testdb; + +--echo # +--echo # bug with automatically added PUBLIC role +--echo # + +--echo # automaticly added PUBLIC +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; +GRANT SELECT on test.* to PUBLIC; + +REVOKE SELECT on test.* from PUBLIC; + +create user testuser; +create database testdb1; +use testdb1; +create table t1 (a int, b int); +insert into t1 values (1,2); + +connect (testuser,localhost,testuser,,); +--error ER_TABLEACCESS_DENIED_ERROR +select * from testdb1.t1; + +connection default; + +disconnect testuser; +drop user testuser; +drop database testdb1; + +--echo # +--echo # check assigning privileges via GRAND role TO PUBLIC +--echo # +create user testuser; +create database testdb1; +use testdb1; +create table t1 (a int, b int); + +--echo # check that user do not have rights +connect (testuser,localhost,testuser,,*NO-ONE*); +--error ER_TABLEACCESS_DENIED_ERROR +select * from testdb1.t1; +connection default; + +--echo give rights to everyone via assigning the role to public +create role roletest; +GRANT SELECT ON testdb1.* TO roletest; +GRANT roletest TO PUBLIC; + +connection testuser; +select * from testdb1.t1; +connection default; +disconnect testuser; + +--echo # check that the privileges are correctly read by acl_load +flush privileges; + +connect (testuser,localhost,testuser,,*NO-ONE*); +select * from testdb1.t1; +connection default; + + +--echo # drop role... +drop role roletest; + +--echo # ... and check that user does not have rights again +connection testuser; +--error ER_TABLEACCESS_DENIED_ERROR +select * from testdb1.t1; +connection default; +disconnect testuser; + +drop user testuser; +drop database testdb1; + +-- echo # clean up +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; + +--echo # +--echo # MDEV-29752 SHOW GRANTS FOR PUBLIC should work for all users +--echo # + +create database dbtest; +create user `testuser`@`%`; + +GRANT USAGE ON *.* TO `testuser`@`%`; +GRANT ALL PRIVILEGES ON `dbtest`.* TO `PUBLIC`; + +connect (testuser,localhost,testuser,,); + +show grants for public; +show grants for testuser; + +connection default; +disconnect testuser; + +REVOKE ALL PRIVILEGES ON `dbtest`.* FROM `PUBLIC`; +REVOKE USAGE ON *.* FROM `testuser`@`%`; +drop user `testuser`@`%`; +drop database dbtest; + +-- echo # clean up +delete from mysql.global_priv where user="PUBLIC"; +flush privileges; diff --git a/mysql-test/main/read_only.result b/mysql-test/main/read_only.result index 83dfada5f2988..65cc12ffce99c 100644 --- a/mysql-test/main/read_only.result +++ b/mysql-test/main/read_only.result @@ -2,6 +2,7 @@ set @start_read_only= @@global.read_only; DROP TABLE IF EXISTS t1,t2,t3; create user test@localhost; grant CREATE, SELECT, DROP on *.* to test@localhost; +grant ALL on test.* to test@localhost; connect con1,localhost,test,,test; connection default; set global read_only=0; @@ -151,6 +152,7 @@ create user `mysqltest_u1`@`%`; grant all on mysqltest_db2.* to `mysqltest_u1`@`%`; create database mysqltest_db1; grant all on mysqltest_db1.* to `mysqltest_u1`@`%`; +grant select on test.* to `mysqltest_u1`@`%`; flush privileges; connect con_bug27440,127.0.0.1,mysqltest_u1,,test,$MASTER_MYPORT,; connection con_bug27440; @@ -191,6 +193,7 @@ USE test; CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1), (2); CREATE USER user1; +GRANT ALL on test.* to user1; connect con1, localhost, user1; connection default; SET GLOBAL read_only= 1; diff --git a/mysql-test/main/read_only.test b/mysql-test/main/read_only.test index 5314b11154ffb..107a67c31fa33 100644 --- a/mysql-test/main/read_only.test +++ b/mysql-test/main/read_only.test @@ -17,6 +17,7 @@ DROP TABLE IF EXISTS t1,t2,t3; create user test@localhost; grant CREATE, SELECT, DROP on *.* to test@localhost; +grant ALL on test.* to test@localhost; connect (con1,localhost,test,,test); @@ -265,6 +266,7 @@ create user `mysqltest_u1`@`%`; grant all on mysqltest_db2.* to `mysqltest_u1`@`%`; create database mysqltest_db1; grant all on mysqltest_db1.* to `mysqltest_u1`@`%`; +grant select on test.* to `mysqltest_u1`@`%`; flush privileges; connect (con_bug27440,127.0.0.1,mysqltest_u1,,test,$MASTER_MYPORT,); connection con_bug27440; @@ -312,6 +314,7 @@ CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1), (2); CREATE USER user1; +GRANT ALL on test.* to user1; connect (con1, localhost, user1); connection default; diff --git a/mysql-test/main/read_only_innodb.result b/mysql-test/main/read_only_innodb.result index abfc5322ed0a6..cfc8f2ecb1740 100644 --- a/mysql-test/main/read_only_innodb.result +++ b/mysql-test/main/read_only_innodb.result @@ -1,6 +1,6 @@ DROP TABLE IF EXISTS table_11733 ; create user test@localhost; -grant CREATE, SELECT, DROP on *.* to test@localhost; +grant CREATE, SELECT, DROP, INSERT on *.* to test@localhost; connect con1,localhost,test,,test; connection default; set global read_only=0; @@ -25,7 +25,7 @@ drop table table_11733 ; drop user test@localhost; disconnect con1; create user test@localhost; -GRANT CREATE, SELECT, DROP ON *.* TO test@localhost; +GRANT CREATE, SELECT, DROP, LOCK TABLES ON *.* TO test@localhost; connect con1, localhost, test, , test; connection default; CREATE TABLE t1(a INT) ENGINE=INNODB; diff --git a/mysql-test/main/read_only_innodb.test b/mysql-test/main/read_only_innodb.test index 4b00c32b1853d..e2c2979c39353 100644 --- a/mysql-test/main/read_only_innodb.test +++ b/mysql-test/main/read_only_innodb.test @@ -15,7 +15,7 @@ DROP TABLE IF EXISTS table_11733 ; # so we use a non-SUPER one: create user test@localhost; -grant CREATE, SELECT, DROP on *.* to test@localhost; +grant CREATE, SELECT, DROP, INSERT on *.* to test@localhost; connect (con1,localhost,test,,test); @@ -50,7 +50,7 @@ disconnect con1; # # Test 1: read only mode create user test@localhost; -GRANT CREATE, SELECT, DROP ON *.* TO test@localhost; +GRANT CREATE, SELECT, DROP, LOCK TABLES ON *.* TO test@localhost; connect(con1, localhost, test, , test); connection default; diff --git a/mysql-test/main/rowid_filter.result b/mysql-test/main/rowid_filter.result index 2a546f126d12f..8447ed8622f83 100644 --- a/mysql-test/main/rowid_filter.result +++ b/mysql-test/main/rowid_filter.result @@ -113,6 +113,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -257,6 +260,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -412,6 +418,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -542,6 +551,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -686,6 +698,9 @@ l_quantity > 45 AND o_totalprice between 180000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -843,6 +858,9 @@ l_quantity > 45 AND o_totalprice between 180000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -989,6 +1007,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1158,6 +1179,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1331,6 +1355,9 @@ l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1465,6 +1492,9 @@ l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1605,6 +1635,9 @@ o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1740,6 +1773,9 @@ o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1883,6 +1919,9 @@ o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2028,6 +2067,9 @@ o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2441,6 +2483,9 @@ analyze format=json select * from t1 where nm like '500%' AND fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2491,6 +2536,9 @@ analyze format=json select * from t1 where nm like '500%' AND fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2566,6 +2614,9 @@ analyze format=json select * from t1 where nm like '75%' AND fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2677,6 +2728,9 @@ nm like '3448%' ) and fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2740,6 +2794,9 @@ nm like '3448%' ) and fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index 990c6b4e894ed..e10ddd6658b91 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -116,6 +116,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -260,6 +263,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -416,6 +422,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -548,6 +557,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -693,6 +705,9 @@ l_quantity > 45 AND o_totalprice between 180000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -850,6 +865,9 @@ l_quantity > 45 AND o_totalprice between 180000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -989,6 +1007,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1147,6 +1168,9 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1321,6 +1345,9 @@ l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1455,6 +1482,9 @@ l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1595,6 +1625,9 @@ o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1730,6 +1763,9 @@ o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1873,6 +1909,9 @@ o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2018,6 +2057,9 @@ o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2431,6 +2473,9 @@ analyze format=json select * from t1 where nm like '500%' AND fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2481,6 +2526,9 @@ analyze format=json select * from t1 where nm like '500%' AND fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2556,6 +2604,9 @@ analyze format=json select * from t1 where nm like '75%' AND fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2667,6 +2718,9 @@ nm like '3448%' ) and fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2730,6 +2784,9 @@ nm like '3448%' ) and fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -3830,6 +3887,9 @@ fi.fh in (6311439873746261694,-397087483897438286, 8518228073041491534,-5420422472375069774); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/set_statement.result b/mysql-test/main/set_statement.result index 7e8266d2ab3a2..f0a362e9fe21a 100644 --- a/mysql-test/main/set_statement.result +++ b/mysql-test/main/set_statement.result @@ -1147,6 +1147,16 @@ sql_text select sleep(0.1) set statement long_query_time=0.01 for select sleep(0.1) #--- +#should be written +set statement log_slow_query_time=0.01 for select sleep(0.1); +sleep(0.1) +0 +select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%'; +sql_text +select sleep(0.1) +set statement long_query_time=0.01 for select sleep(0.1) +set statement log_slow_query_time=0.01 for select sleep(0.1) +#--- set @@long_query_time=0.01; #should NOT be written set statement slow_query_log=0 for select sleep(0.1); @@ -1157,6 +1167,7 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti sql_text select sleep(0.1) set statement long_query_time=0.01 for select sleep(0.1) +set statement log_slow_query_time=0.01 for select sleep(0.1) #--- #should NOT be written set statement long_query_time=0.01,log_slow_filter='full_scan' for select sleep(0.1); @@ -1166,6 +1177,7 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti sql_text select sleep(0.1) set statement long_query_time=0.01 for select sleep(0.1) +set statement log_slow_query_time=0.01 for select sleep(0.1) #--- #should NOT be written set statement long_query_time=0.01,log_slow_rate_limit=9999 for select sleep(0.1); @@ -1175,6 +1187,7 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti sql_text select sleep(0.1) set statement long_query_time=0.01 for select sleep(0.1) +set statement log_slow_query_time=0.01 for select sleep(0.1) #--- #should NOT be written set statement long_query_time=0.01,min_examined_row_limit=50 for select sleep(0.1); @@ -1184,6 +1197,17 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti sql_text select sleep(0.1) set statement long_query_time=0.01 for select sleep(0.1) +set statement log_slow_query_time=0.01 for select sleep(0.1) +#--- +#should NOT be written +set statement long_query_time=0.01,log_slow_min_examined_row_limit=50 for select sleep(0.1); +sleep(0.1) +0 +select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%'; +sql_text +select sleep(0.1) +set statement long_query_time=0.01 for select sleep(0.1) +set statement log_slow_query_time=0.01 for select sleep(0.1) #--- set global log_output= @save_log_output; set @@slow_query_log= @save_slow_query_log; diff --git a/mysql-test/main/set_statement.test b/mysql-test/main/set_statement.test index aae7cea40d159..cc191a014a148 100644 --- a/mysql-test/main/set_statement.test +++ b/mysql-test/main/set_statement.test @@ -1019,6 +1019,10 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti set statement long_query_time=0.01 for select sleep(0.1); select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%'; --echo #--- +--echo #should be written +set statement log_slow_query_time=0.01 for select sleep(0.1); +select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%'; +--echo #--- set @@long_query_time=0.01; --echo #should NOT be written set statement slow_query_log=0 for select sleep(0.1); @@ -1037,6 +1041,10 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti set statement long_query_time=0.01,min_examined_row_limit=50 for select sleep(0.1); select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%'; --echo #--- +--echo #should NOT be written +set statement long_query_time=0.01,log_slow_min_examined_row_limit=50 for select sleep(0.1); +select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%'; +--echo #--- --enable_view_protocol # # log_slow_verbosity is impossible to check because results are not written diff --git a/mysql-test/main/show_analyze.result b/mysql-test/main/show_analyze.result index 56dac487117b9..5595fadd60b89 100644 --- a/mysql-test/main/show_analyze.result +++ b/mysql-test/main/show_analyze.result @@ -400,6 +400,9 @@ ANALYZE format=json SELECT 1 FROM t1 GROUP BY convert_tz('1969-12-31 22:00:00',a,'+10:00'); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/show_analyze_json.result b/mysql-test/main/show_analyze_json.result index dc8ae2aa66b5e..8506c4b94027b 100644 --- a/mysql-test/main/show_analyze_json.result +++ b/mysql-test/main/show_analyze_json.result @@ -39,6 +39,9 @@ show analyze format=JSON for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -69,6 +72,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -100,6 +106,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -138,6 +147,9 @@ show analyze FORMAT= json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -204,6 +216,9 @@ show analyze format=JSON for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -271,6 +286,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -340,6 +358,9 @@ show analyze FORMAT=JSON for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -415,6 +436,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -472,6 +496,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -535,6 +562,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "nested_loop": [ @@ -594,6 +624,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -655,6 +688,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -737,6 +773,9 @@ show analyze FORMAT=JSON for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "table": { @@ -777,6 +816,9 @@ show analyze FORMAT=JSON for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "table": { @@ -829,6 +871,9 @@ show analyze FORMAT=JSON for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "table": { @@ -869,6 +914,9 @@ show analyze FORMAT=JSON for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "table": { @@ -921,6 +969,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -970,6 +1021,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1020,6 +1074,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1084,6 +1141,9 @@ show analyze format=JSON for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1140,6 +1200,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -1186,6 +1249,9 @@ show analyze format=json for $thr2; SHOW ANALYZE { "r_query_time_in_progress_ms": "REPLACED", + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/show_check.result b/mysql-test/main/show_check.result index 35428b34599f6..5058f6d6db096 100644 --- a/mysql-test/main/show_check.result +++ b/mysql-test/main/show_check.result @@ -545,7 +545,7 @@ ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table `my drop database mysqltest; ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest' disconnect con1; -connect con2,localhost,mysqltest_2,,test; +connect con2,localhost,mysqltest_2,,"*NO-ONE*"; connection con2; select * from mysqltest.t1; ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table `mysqltest`.`t1` @@ -556,7 +556,7 @@ ERROR 42000: DROP command denied to user 'mysqltest_2'@'localhost' for table `my drop database mysqltest; ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' disconnect con2; -connect con3,localhost,mysqltest_3,,test; +connect con3,localhost,mysqltest_3,,"*NO-ONE*"; connection con3; select * from mysqltest.t1; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table `mysqltest`.`t1` @@ -1471,7 +1471,7 @@ DROP EVENT ev1; SHOW STORAGE ENGINES; CREATE USER test_u@localhost; GRANT PROCESS ON *.* TO test_u@localhost; -connect conn1, localhost, test_u,,; +connect conn1, localhost, test_u,,"*NO-ONE*"; SHOW ENGINE MYISAM MUTEX; SHOW ENGINE MYISAM STATUS; disconnect conn1; diff --git a/mysql-test/main/show_check.test b/mysql-test/main/show_check.test index 15beaaf04015c..2a001866186fc 100644 --- a/mysql-test/main/show_check.test +++ b/mysql-test/main/show_check.test @@ -349,7 +349,7 @@ drop database mysqltest; disconnect con1; --source include/wait_until_disconnected.inc -connect (con2,localhost,mysqltest_2,,test); +connect (con2,localhost,mysqltest_2,,"*NO-ONE*"); connection con2; --error ER_TABLEACCESS_DENIED_ERROR select * from mysqltest.t1; @@ -362,7 +362,7 @@ drop database mysqltest; disconnect con2; --source include/wait_until_disconnected.inc -connect (con3,localhost,mysqltest_3,,test); +connect (con3,localhost,mysqltest_3,,"*NO-ONE*"); connection con3; --error ER_TABLEACCESS_DENIED_ERROR select * from mysqltest.t1; @@ -1255,7 +1255,7 @@ SHOW STORAGE ENGINES; CREATE USER test_u@localhost; GRANT PROCESS ON *.* TO test_u@localhost; -connect (conn1, localhost, test_u,,); +connect (conn1, localhost, test_u,,"*NO-ONE*"); --disable_result_log SHOW ENGINE MYISAM MUTEX; diff --git a/mysql-test/main/sp-security.result b/mysql-test/main/sp-security.result index 5c62a95b34ab3..eb186dd7faf84 100644 --- a/mysql-test/main/sp-security.result +++ b/mysql-test/main/sp-security.result @@ -42,8 +42,8 @@ set sql_mode=''; grant execute on procedure db1_secret.stamp to ''@'%'; grant execute on function db1_secret.db to ''@'%'; set sql_mode=default; -connect con2user1,localhost,user1,,; -connect con3anon,localhost,anon,,; +connect con2user1,localhost,user1,,"*NO-ONE*"; +connect con3anon,localhost,anon,,"*NO-ONE*"; connection con2user1; call db1_secret.stamp(2); select db1_secret.db(); @@ -128,7 +128,7 @@ use db2; create procedure p () insert into t2 values (1); call p(); ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table `db2`.`t2` -connect con4user2,localhost,user2,,; +connect con4user2,localhost,user2,,"*NO-ONE*"; connection con4user2; use db2; call p(); @@ -203,9 +203,9 @@ show grants for userc@localhost; Grants for userc@localhost GRANT USAGE ON *.* TO `userc`@`localhost` GRANT EXECUTE ON PROCEDURE `sptest`.`p1` TO `userc`@`localhost` WITH GRANT OPTION -connect con2usera,localhost,usera,,; -connect con3userb,localhost,userb,,; -connect con4userc,localhost,userc,,; +connect con2usera,localhost,usera,,"*NO-ONE*"; +connect con3userb,localhost,userb,,"*NO-ONE*"; +connect con4userc,localhost,userc,,"*NO-ONE*"; connection con2usera; call sptest.p1(1); grant execute on procedure sptest.p1 to userb@localhost; @@ -270,6 +270,7 @@ use mysqltest// create table t1 (s1 int)// create user user1@localhost// grant select on t1 to user1@localhost// +grant select on test.* to user1@localhost// create function bug_9503 () returns int sql security invoker begin declare v int; select min(s1) into v from t1; return v; end// connect user1,localhost,user1,,test; @@ -349,6 +350,7 @@ return 'ok'; end; | create user user_bug12812@localhost IDENTIFIED BY 'ABC'| +grant select,create view on test.* to user_bug12812@localhost| connect test_user_12812,localhost,user_bug12812,ABC,test; SELECT test.bug12812()| ERROR 42000: execute command denied to user 'user_bug12812'@'localhost' for routine 'test.bug12812' @@ -398,6 +400,7 @@ sql security definer select * from db_bug14533.t1; grant execute on procedure db_bug14533.bug14533_1 to user_bug14533@localhost; grant execute on procedure db_bug14533.bug14533_2 to user_bug14533@localhost; +grant select on test.* to user_bug14533@localhost; connect user_bug14533,localhost,user_bug14533,,test; call db_bug14533.bug14533_1(); Field Type Null Key Default Extra @@ -672,7 +675,7 @@ create database mysqltest_db; create user bug57061_user@localhost; create function mysqltest_db.f1() returns int return 0; create procedure mysqltest_db.p1() begin end; -connect conn1, localhost, bug57061_user,,; +connect conn1, localhost, bug57061_user,,"*NO-ONE*"; # Attempt to drop routine on which user doesn't have privileges # should result in the same 'access denied' type of error whether # routine exists or not. @@ -697,7 +700,7 @@ CREATE DATABASE db1; CREATE PROCEDURE db1.p1() SELECT 1; CREATE USER user2@localhost IDENTIFIED BY ''; GRANT SELECT(db) ON mysql.proc TO user2@localhost; -connect con2, localhost, user2; +connect con2, localhost, user2,,"*NO-ONE*"; # The statement below before disclosed info from body_utf8 column. SHOW CREATE PROCEDURE db1.p1; ERROR 42000: PROCEDURE p1 does not exist @@ -716,6 +719,7 @@ DROP USER user2@localhost; DROP DATABASE db1; create user foo@local_ost; create user foo@`local\_ost` identified via mysql_old_password using '0123456789ABCDEF'; +grant select,create routine on test.* to foo@local_ost; create database foodb; grant create routine on foodb.* to foo@local_ost; connect con1,localhost,foo; @@ -725,11 +729,13 @@ foo@localhost foo@local_ost show grants; Grants for foo@local_ost GRANT USAGE ON *.* TO `foo`@`local_ost` +GRANT SELECT, CREATE ROUTINE ON `test`.* TO `foo`@`local_ost` GRANT CREATE ROUTINE ON `foodb`.* TO `foo`@`local_ost` create procedure fooproc() select 'i am fooproc'; show grants; Grants for foo@local_ost GRANT USAGE ON *.* TO `foo`@`local_ost` +GRANT SELECT, CREATE ROUTINE ON `test`.* TO `foo`@`local_ost` GRANT CREATE ROUTINE ON `foodb`.* TO `foo`@`local_ost` GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO `foo`@`local_ost` disconnect con1; @@ -749,6 +755,7 @@ create function mysqltest_db.f1() returns int return 0; create procedure mysqltest_db.p1() begin end; # Create user with no privileges on mysqltest_db database. create user bug12602983_user@localhost; +grant create view on test.* to bug12602983_user@localhost; connect conn1, localhost, bug12602983_user,,; # Attempt to execute routine on which user doesn't have privileges # should result in the same 'access denied' error whether @@ -796,8 +803,7 @@ CREATE USER u1@localhost; GRANT CREATE ROUTINE ON u1.* TO u1@localhost; GRANT ALTER ROUTINE ON FUNCTION u1.f1 TO u1@localhost; GRANT ALTER ROUTINE ON PROCEDURE u1.p1 TO u1@localhost; -connect u1, localhost, u1,,; -USE u1; +connect u1, localhost, u1,,u1; CREATE OR REPLACE FUNCTION f1() RETURNS INT BEGIN RETURN 2; END; $$ CREATE OR REPLACE PROCEDURE p1() BEGIN SELECT 1; END; $$ disconnect u1; diff --git a/mysql-test/main/sp-security.test b/mysql-test/main/sp-security.test index 13fdbd68a5527..85f21835c92da 100644 --- a/mysql-test/main/sp-security.test +++ b/mysql-test/main/sp-security.test @@ -67,8 +67,8 @@ grant execute on procedure db1_secret.stamp to ''@'%'; grant execute on function db1_secret.db to ''@'%'; set sql_mode=default; -connect (con2user1,localhost,user1,,); -connect (con3anon,localhost,anon,,); +connect (con2user1,localhost,user1,,"*NO-ONE*"); +connect (con3anon,localhost,anon,,"*NO-ONE*"); # @@ -195,7 +195,7 @@ create procedure p () insert into t2 values (1); --error ER_TABLEACCESS_DENIED_ERROR call p(); -connect (con4user2,localhost,user2,,); +connect (con4user2,localhost,user2,,"*NO-ONE*"); connection con4user2; use db2; @@ -284,9 +284,9 @@ show grants for usera@localhost; grant execute on procedure sptest.p1 to userc@localhost with grant option; show grants for userc@localhost; -connect (con2usera,localhost,usera,,); -connect (con3userb,localhost,userb,,); -connect (con4userc,localhost,userc,,); +connect (con2usera,localhost,usera,,"*NO-ONE*"); +connect (con3userb,localhost,userb,,"*NO-ONE*"); +connect (con4userc,localhost,userc,,"*NO-ONE*"); connection con2usera; call sptest.p1(1); @@ -357,6 +357,7 @@ use mysqltest// create table t1 (s1 int)// create user user1@localhost// grant select on t1 to user1@localhost// +grant select on test.* to user1@localhost// create function bug_9503 () returns int sql security invoker begin declare v int; select min(s1) into v from t1; return v; end// delimiter ;// @@ -467,6 +468,7 @@ begin end; | create user user_bug12812@localhost IDENTIFIED BY 'ABC'| +grant select,create view on test.* to user_bug12812@localhost| --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (test_user_12812,localhost,user_bug12812,ABC,test)| --error ER_PROCACCESS_DENIED_ERROR @@ -543,6 +545,7 @@ create procedure bug14533_2() grant execute on procedure db_bug14533.bug14533_1 to user_bug14533@localhost; grant execute on procedure db_bug14533.bug14533_2 to user_bug14533@localhost; +grant select on test.* to user_bug14533@localhost; connect (user_bug14533,localhost,user_bug14533,,test); @@ -927,7 +930,7 @@ create database mysqltest_db; create user bug57061_user@localhost; create function mysqltest_db.f1() returns int return 0; create procedure mysqltest_db.p1() begin end; -connect (conn1, localhost, bug57061_user,,); +connect (conn1, localhost, bug57061_user,,"*NO-ONE*"); --echo # Attempt to drop routine on which user doesn't have privileges --echo # should result in the same 'access denied' type of error whether --echo # routine exists or not. @@ -959,7 +962,7 @@ CREATE PROCEDURE db1.p1() SELECT 1; CREATE USER user2@localhost IDENTIFIED BY ''; GRANT SELECT(db) ON mysql.proc TO user2@localhost; -connect (con2, localhost, user2); +connect (con2, localhost, user2,,"*NO-ONE*"); --echo # The statement below before disclosed info from body_utf8 column. --error ER_SP_DOES_NOT_EXIST SHOW CREATE PROCEDURE db1.p1; @@ -982,6 +985,7 @@ DROP DATABASE db1; # create user foo@local_ost; create user foo@`local\_ost` identified via mysql_old_password using '0123456789ABCDEF'; +grant select,create routine on test.* to foo@local_ost; create database foodb; grant create routine on foodb.* to foo@local_ost; connect con1,localhost,foo; @@ -1010,6 +1014,7 @@ create procedure mysqltest_db.p1() begin end; --echo # Create user with no privileges on mysqltest_db database. create user bug12602983_user@localhost; +grant create view on test.* to bug12602983_user@localhost; connect (conn1, localhost, bug12602983_user,,); @@ -1067,8 +1072,7 @@ GRANT CREATE ROUTINE ON u1.* TO u1@localhost; GRANT ALTER ROUTINE ON FUNCTION u1.f1 TO u1@localhost; GRANT ALTER ROUTINE ON PROCEDURE u1.p1 TO u1@localhost; -connect (u1, localhost, u1,,); -USE u1; +connect (u1, localhost, u1,,u1); DELIMITER $$; CREATE OR REPLACE FUNCTION f1() RETURNS INT BEGIN RETURN 2; END; $$ CREATE OR REPLACE PROCEDURE p1() BEGIN SELECT 1; END; $$ diff --git a/mysql-test/main/sql_mode.result b/mysql-test/main/sql_mode.result index 6ac65302d47f5..31308cd6a2f51 100644 --- a/mysql-test/main/sql_mode.result +++ b/mysql-test/main/sql_mode.result @@ -505,7 +505,7 @@ connection default; set @OLD_SQL_MODE=@@SESSION.SQL_MODE; set session sql_mode='PAD_CHAR_TO_FULL_LENGTH'; flush privileges; -connect user_32753,localhost,mysqltest_32753,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect user_32753,localhost,mysqltest_32753,,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; select current_user(); current_user() mysqltest_32753@localhost diff --git a/mysql-test/main/sql_mode.test b/mysql-test/main/sql_mode.test index b1c5f05e6181a..bfcaff392539d 100644 --- a/mysql-test/main/sql_mode.test +++ b/mysql-test/main/sql_mode.test @@ -302,7 +302,7 @@ flush privileges; # if user-table is affected by PAD_CHAR_TO_FULL_LENGTH, our connect will fail # --error 1045 -connect (user_32753,localhost,mysqltest_32753,,test,$MASTER_MYPORT,$MASTER_MYSOCK); +connect (user_32753,localhost,mysqltest_32753,,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); select current_user(); # clean up diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index d00f7ccd69024..5589272d066ce 100644 --- a/mysql-test/main/subselect4.result +++ b/mysql-test/main/subselect4.result @@ -2917,6 +2917,9 @@ SELECT DISTINCT FROM t1; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/subselect_cache.result b/mysql-test/main/subselect_cache.result index e859ebbd2e8ee..5c2fd3e66fcd5 100644 --- a/mysql-test/main/subselect_cache.result +++ b/mysql-test/main/subselect_cache.result @@ -44,6 +44,9 @@ analyze format=json select a, (select d from t2 where b=c) from t1; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -98,6 +101,9 @@ analyze format=json select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/system_mysql_db_fix40123.result b/mysql-test/main/system_mysql_db_fix40123.result index 31a334878ece0..2ed1e8ae618ca 100644 --- a/mysql-test/main/system_mysql_db_fix40123.result +++ b/mysql-test/main/system_mysql_db_fix40123.result @@ -100,7 +100,7 @@ db CREATE TABLE `db` ( ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges' show create table user; View Create View character_set_client collation_connection -user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY DEFINER VIEW `user` AS select `global_priv`.`Host` AS `Host`,`global_priv`.`User` AS `User`,if(json_value(`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,if(ifnull(json_value(`global_priv`.`Priv`,'$.password_last_changed'),1) = 0,'Y','N') AS `password_expired`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` latin1 latin1_swedish_ci +user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY DEFINER VIEW `user` AS select `test`.`global_priv`.`Host` AS `Host`,`test`.`global_priv`.`User` AS `User`,if(json_value(`test`.`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`test`.`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,if(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.password_last_changed'),1) = 0,'Y','N') AS `password_expired`,elt(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` latin1 latin1_swedish_ci show create table func; Table Create Table func CREATE TABLE `func` ( diff --git a/mysql-test/main/system_mysql_db_fix50030.result b/mysql-test/main/system_mysql_db_fix50030.result index 8055211e5b2c3..b99b8678b1aad 100644 --- a/mysql-test/main/system_mysql_db_fix50030.result +++ b/mysql-test/main/system_mysql_db_fix50030.result @@ -104,7 +104,7 @@ db CREATE TABLE `db` ( ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges' show create table user; View Create View character_set_client collation_connection -user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY DEFINER VIEW `user` AS select `global_priv`.`Host` AS `Host`,`global_priv`.`User` AS `User`,if(json_value(`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,if(ifnull(json_value(`global_priv`.`Priv`,'$.password_last_changed'),1) = 0,'Y','N') AS `password_expired`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` latin1 latin1_swedish_ci +user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY DEFINER VIEW `user` AS select `test`.`global_priv`.`Host` AS `Host`,`test`.`global_priv`.`User` AS `User`,if(json_value(`test`.`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`test`.`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,if(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.password_last_changed'),1) = 0,'Y','N') AS `password_expired`,elt(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` latin1 latin1_swedish_ci show create table func; Table Create Table func CREATE TABLE `func` ( diff --git a/mysql-test/main/system_mysql_db_fix50117.result b/mysql-test/main/system_mysql_db_fix50117.result index 214b7ee572dbf..8e48c2accb74b 100644 --- a/mysql-test/main/system_mysql_db_fix50117.result +++ b/mysql-test/main/system_mysql_db_fix50117.result @@ -84,7 +84,7 @@ db CREATE TABLE `db` ( ) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges' show create table user; View Create View character_set_client collation_connection -user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY DEFINER VIEW `user` AS select `global_priv`.`Host` AS `Host`,`global_priv`.`User` AS `User`,if(json_value(`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,if(ifnull(json_value(`global_priv`.`Priv`,'$.password_last_changed'),1) = 0,'Y','N') AS `password_expired`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` latin1 latin1_swedish_ci +user CREATE ALGORITHM=UNDEFINED DEFINER=`mariadb.sys`@`localhost` SQL SECURITY DEFINER VIEW `user` AS select `test`.`global_priv`.`Host` AS `Host`,`test`.`global_priv`.`User` AS `User`,if(json_value(`test`.`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`test`.`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`test`.`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,if(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.password_last_changed'),1) = 0,'Y','N') AS `password_expired`,elt(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`test`.`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`test`.`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` latin1 latin1_swedish_ci show create table func; Table Create Table func CREATE TABLE `func` ( diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result index b90b5c86c15e8..e6d973d53eec1 100644 --- a/mysql-test/main/table_value_constr.result +++ b/mysql-test/main/table_value_constr.result @@ -1667,6 +1667,9 @@ analyze format=json values (1,2); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "query_specifications": [ @@ -1713,6 +1716,9 @@ union values (1,2),(3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -1747,6 +1753,9 @@ union select 1,2; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -1781,6 +1790,9 @@ union values (1,2),(3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -1828,6 +1840,9 @@ union values (1,2); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -1894,6 +1909,9 @@ union all select 1,2; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "query_specifications": [ @@ -1924,6 +1942,9 @@ union values (1,2),(3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -1958,6 +1979,9 @@ union all values (1,2),(3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "query_specifications": [ @@ -2000,6 +2024,9 @@ union all values (1,2); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "query_specifications": [ diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test index 07197329e1064..331cfb8b7db10 100644 --- a/mysql-test/main/table_value_constr.test +++ b/mysql-test/main/table_value_constr.test @@ -932,6 +932,7 @@ values (1,2); analyze values (1,2); +--source include/analyze-format.inc analyze format=json values (1,2); @@ -952,16 +953,19 @@ values (5,6) union values (1,2),(3,4); +--source include/analyze-format.inc analyze format=json select 1,2 union values (1,2),(3,4); +--source include/analyze-format.inc analyze format=json values (1,2),(3,4) union select 1,2; +--source include/analyze-format.inc analyze format=json values (5,6) union @@ -974,6 +978,7 @@ values (3,4) union values (1,2); +--source include/analyze-format.inc analyze format=json select 1,2 union @@ -998,16 +1003,19 @@ values (1,2) union all values (1,2),(3,4); +--source include/analyze-format.inc analyze format=json values (1,2),(3,4) union all select 1,2; +--source include/analyze-format.inc analyze format=json select 1,2 union values (1,2),(3,4); +--source include/analyze-format.inc analyze format=json values (1,2) union all @@ -1020,6 +1028,7 @@ values (3,4) union all values (1,2); +--source include/analyze-format.inc analyze format=json select 1,2 union all diff --git a/mysql-test/main/user_limits.result b/mysql-test/main/user_limits.result index acb34754caaf0..1cb4f9c03e86c 100644 --- a/mysql-test/main/user_limits.result +++ b/mysql-test/main/user_limits.result @@ -7,7 +7,7 @@ delete from mysql.tables_priv where user like 'mysqltest\_%'; delete from mysql.columns_priv where user like 'mysqltest\_%'; flush privileges; create user mysqltest_1@localhost; -grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2; +grant all on test.* to mysqltest_1@localhost with max_queries_per_hour 2; flush user_resources; connect mqph, localhost, mysqltest_1,,; connection mqph; @@ -26,7 +26,7 @@ drop user mysqltest_1@localhost; disconnect mqph; disconnect mqph2; create user mysqltest_1@localhost; -grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2; +grant all on test.* to mysqltest_1@localhost with max_updates_per_hour 2; flush user_resources; connect muph, localhost, mysqltest_1,,; connection muph; @@ -53,7 +53,7 @@ drop user mysqltest_1@localhost; disconnect muph; disconnect muph2; create user mysqltest_1@localhost; -grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2; +grant all on test.* to mysqltest_1@localhost with max_connections_per_hour 2; flush user_resources; connect mcph1, localhost, mysqltest_1,,; connection mcph1; @@ -77,7 +77,7 @@ connection default; drop user mysqltest_1@localhost; flush privileges; create user mysqltest_1@localhost; -grant usage on *.* to mysqltest_1@localhost with max_user_connections 2; +grant all on test.* to mysqltest_1@localhost with max_user_connections 2; flush user_resources; connect muc1, localhost, mysqltest_1,,; connection muc1; @@ -109,10 +109,12 @@ grant usage on *.* to mysqltest_1@localhost with max_user_connections -1; show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` WITH MAX_USER_CONNECTIONS -1 +GRANT ALL PRIVILEGES ON `test`.* TO `mysqltest_1`@`localhost` flush user_resources; show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` WITH MAX_USER_CONNECTIONS -1 +GRANT ALL PRIVILEGES ON `test`.* TO `mysqltest_1`@`localhost` connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK); connect muc5, localhost, mysqltest_1,,; ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: -1) @@ -130,7 +132,7 @@ select @@session.max_user_connections, @@global.max_user_connections; @@session.max_user_connections @@global.max_user_connections 2 2 create user mysqltest_1@localhost; -grant usage on *.* to mysqltest_1@localhost; +grant all on test.* to mysqltest_1@localhost; flush user_resources; connect muca1, localhost, mysqltest_1,,; connection muca1; @@ -193,7 +195,7 @@ set global max_user_connections= @my_max_user_connections; # MDEV-17852 Altered connection limits for user have no effect # create user foo@'%' with max_user_connections 1; -connect con1,localhost,foo; +connect con1,localhost,foo,,"*NO-ONE*"; select current_user(); current_user() foo@% @@ -202,7 +204,7 @@ connect con2,localhost,foo; ERROR 42000: User 'foo' has exceeded the 'max_user_connections' resource (current value: 1) connection default; alter user foo with max_user_connections 2; -connect con3,localhost,foo; +connect con3,localhost,foo,,"*NO-ONE*"; select current_user(); current_user() foo@% diff --git a/mysql-test/main/user_limits.test b/mysql-test/main/user_limits.test index 36524febd8d3d..10e15ca3c9c19 100644 --- a/mysql-test/main/user_limits.test +++ b/mysql-test/main/user_limits.test @@ -27,7 +27,7 @@ flush privileges; # Test of MAX_QUERIES_PER_HOUR limit create user mysqltest_1@localhost; -grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2; +grant all on test.* to mysqltest_1@localhost with max_queries_per_hour 2; # This ensures that counters are reset and makes test scheduling independent flush user_resources; connect (mqph, localhost, mysqltest_1,,); @@ -48,7 +48,7 @@ disconnect mqph2; # Test of MAX_UPDATES_PER_HOUR limit create user mysqltest_1@localhost; -grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2; +grant all on test.* to mysqltest_1@localhost with max_updates_per_hour 2; flush user_resources; connect (muph, localhost, mysqltest_1,,); connection muph; @@ -73,7 +73,7 @@ disconnect muph2; # Test of MAX_CONNECTIONS_PER_HOUR limit create user mysqltest_1@localhost; -grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2; +grant all on test.* to mysqltest_1@localhost with max_connections_per_hour 2; flush user_resources; connect (mcph1, localhost, mysqltest_1,,); connection mcph1; @@ -101,7 +101,7 @@ drop user mysqltest_1@localhost; # We need this to reset internal mqh_used variable flush privileges; create user mysqltest_1@localhost; -grant usage on *.* to mysqltest_1@localhost with max_user_connections 2; +grant all on test.* to mysqltest_1@localhost with max_user_connections 2; flush user_resources; connect (muc1, localhost, mysqltest_1,,); connection muc1; @@ -155,7 +155,7 @@ set global max_user_connections= 2; select @@session.max_user_connections, @@global.max_user_connections; # Let us check that global limit works create user mysqltest_1@localhost; -grant usage on *.* to mysqltest_1@localhost; +grant all on test.* to mysqltest_1@localhost; flush user_resources; connect (muca1, localhost, mysqltest_1,,); connection muca1; @@ -225,14 +225,14 @@ set global max_user_connections= @my_max_user_connections; --echo # MDEV-17852 Altered connection limits for user have no effect --echo # create user foo@'%' with max_user_connections 1; ---connect con1,localhost,foo +--connect con1,localhost,foo,,"*NO-ONE*" select current_user(); --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --error ER_USER_LIMIT_REACHED --connect con2,localhost,foo --connection default alter user foo with max_user_connections 2; ---connect con3,localhost,foo +--connect con3,localhost,foo,,"*NO-ONE*" select current_user(); --disconnect con3 --disconnect con1 diff --git a/mysql-test/main/user_var-binlog.result b/mysql-test/main/user_var-binlog.result index 6743f340a1924..024f0482e6fd9 100644 --- a/mysql-test/main/user_var-binlog.result +++ b/mysql-test/main/user_var-binlog.result @@ -19,7 +19,7 @@ master-bin.000001 # Query # # use `test`; insert into t1 values (@var1),(@var2) master-bin.000001 # Query # # COMMIT flush logs; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -29,7 +29,7 @@ SET @`a b`:=_latin1 X'68656C6C6F' COLLATE `latin1_swedish_ci`/*!*/; use `test`/*!*/; SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/main/userstat-badlogin-4824.result b/mysql-test/main/userstat-badlogin-4824.result index 757b20e0ce0d8..2d34f78e006df 100644 --- a/mysql-test/main/userstat-badlogin-4824.result +++ b/mysql-test/main/userstat-badlogin-4824.result @@ -2,7 +2,7 @@ set @save_userstat=@@global.userstat; create user foo@localhost identified by 'foo'; flush user_statistics; set global userstat=1; -connect foo, localhost, foo, foo; +connect foo, localhost, foo, foo, "*NO-ONE*"; select 1; 1 1 @@ -12,7 +12,7 @@ select user, bytes_received from information_schema.user_statistics where user = user bytes_received foo 18 connect(localhost,foo,bar,test,MASTER_PORT,MASTER_SOCKET); -connect foo, localhost, foo, bar; +connect foo, localhost, foo, bar, test; ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES) connection default; select user, bytes_received from information_schema.user_statistics where user = 'foo'; diff --git a/mysql-test/main/userstat-badlogin-4824.test b/mysql-test/main/userstat-badlogin-4824.test index 12cca9f12b3d3..8ee5d189f779b 100644 --- a/mysql-test/main/userstat-badlogin-4824.test +++ b/mysql-test/main/userstat-badlogin-4824.test @@ -12,7 +12,7 @@ create user foo@localhost identified by 'foo'; flush user_statistics; set global userstat=1; -connect(foo, localhost, foo, foo); +connect(foo, localhost, foo, foo, "*NO-ONE*"); select 1; disconnect foo; connection default; @@ -27,7 +27,7 @@ select user, bytes_received from information_schema.user_statistics where user = --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR -connect(foo, localhost, foo, bar); +connect(foo, localhost, foo, bar, test); connection default; diff --git a/mysql-test/main/view_grant.result b/mysql-test/main/view_grant.result index 370035147a164..3754a55eea8a8 100644 --- a/mysql-test/main/view_grant.result +++ b/mysql-test/main/view_grant.result @@ -46,11 +46,12 @@ revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; revoke all privileges on test.* from mysqltest_1@localhost; drop database mysqltest; drop view test.v1; +disconnect user1; create database mysqltest; create table mysqltest.t1 (a int, b int); create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1; grant select (c) on mysqltest.v1 to mysqltest_1@localhost; -connection user1; +connect user1,localhost,mysqltest_1,,mysqltest; select c from mysqltest.v1; c select d from mysqltest.v1; @@ -70,6 +71,7 @@ c select d from mysqltest.v1; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1' connection root; +disconnect user1; revoke all privileges on mysqltest.v1 from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; @@ -88,7 +90,7 @@ grant select on mysqltest.v2 to mysqltest_1@localhost; grant select on mysqltest.v3 to mysqltest_1@localhost; grant select on mysqltest.v4 to mysqltest_1@localhost; grant show view on mysqltest.v5 to mysqltest_1@localhost; -connection user1; +connect user1,localhost,mysqltest_1,,mysqltest; select c from mysqltest.v1; c select c from mysqltest.v2; @@ -132,7 +134,7 @@ grant select on mysqltest.v5 to mysqltest_1@localhost; connection user1; show create view mysqltest.v5; View Create View character_set_client collation_connection -v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v5` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v5` AS select `t1`.`a` + 1 AS `c`,`t1`.`b` + 1 AS `d` from `t1` latin1 latin1_swedish_ci explain select c from mysqltest.v1; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v1; @@ -141,13 +143,14 @@ connection root; grant show view on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.t1 to mysqltest_1@localhost; revoke select on mysqltest.v5 from mysqltest_1@localhost; -connection user1; +disconnect user1; +connect user1,localhost,mysqltest_1,,mysqltest; explain select c from mysqltest.v1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found show create view mysqltest.v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` + 1 AS `c`,`t1`.`b` + 1 AS `d` from `t1` latin1 latin1_swedish_ci explain select c from mysqltest.v2; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v2; @@ -164,34 +167,36 @@ explain select c from mysqltest.v5; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v5` connection root; grant show view on mysqltest.* to mysqltest_1@localhost; -connection user1; +disconnect user1; +connect user1,localhost,mysqltest_1,,mysqltest; explain select c from mysqltest.v1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found show create view mysqltest.v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` + 1 AS `c`,`t1`.`b` + 1 AS `d` from `t1` latin1 latin1_swedish_ci explain select c from mysqltest.v2; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY system NULL NULL NULL NULL 0 Const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table show create view mysqltest.v2; View Create View character_set_client collation_connection -v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` + 1 AS `c`,`t1`.`b` + 1 AS `d` from `t1` latin1 latin1_swedish_ci explain select c from mysqltest.v3; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v3; View Create View character_set_client collation_connection -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select `mysqltest`.`t2`.`a` + 1 AS `c`,`mysqltest`.`t2`.`b` + 1 AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t2`.`a` + 1 AS `c`,`t2`.`b` + 1 AS `d` from `t2` latin1 latin1_swedish_ci explain select c from mysqltest.v4; ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v4; View Create View character_set_client collation_connection -v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select `mysqltest`.`t2`.`a` + 1 AS `c`,`mysqltest`.`t2`.`b` + 1 AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci +v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t2`.`a` + 1 AS `c`,`t2`.`b` + 1 AS `d` from `t2` latin1 latin1_swedish_ci connection root; revoke all privileges on mysqltest.* from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; connection root; create database mysqltest; create table mysqltest.t1 (a int, b int, primary key(a)); @@ -208,8 +213,7 @@ grant update (a) on mysqltest.v2 to mysqltest_1@localhost; grant update on mysqltest.v1 to mysqltest_1@localhost; grant update on mysqltest.t3 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; -connection user1; -use mysqltest; +connect user1,localhost,mysqltest_1,,mysqltest; update t2,v1 set v1.a=v1.a+v1.c where t2.x=v1.c; select * from t1; a b @@ -251,11 +255,11 @@ update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c; ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v3` update v3 set a=a+c; ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v3` -use test; connection root; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; connection root; create database mysqltest; create table mysqltest.t1 (a int, b int, primary key(a)); @@ -267,7 +271,7 @@ create view mysqltest.v2 (a,c) as select a, b+1 from mysqltest.t1; create user mysqltest_1@localhost; grant delete on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; -connection user1; +connect user1,localhost,mysqltest_1,,mysqltest; use mysqltest; delete from v1 where c < 4; select * from t1; @@ -284,8 +288,8 @@ delete v2 from t2,v2 where t2.x=v2.c; ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` delete from v2 where c < 4; ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` -use test; connection root; +disconnect user1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; @@ -300,7 +304,7 @@ create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1; create user mysqltest_1@localhost; grant insert on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; -connection user1; +connect user1,localhost,mysqltest_1,,mysqltest; use mysqltest; insert into v1 values (5,6); select * from t1; @@ -319,11 +323,11 @@ insert into v2 values (5,6); ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` insert into v2 select x,y from t2; ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2` -use test; connection root; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; connection root; create database mysqltest; create table mysqltest.t1 (a int, b int); @@ -332,7 +336,7 @@ create user mysqltest_1@localhost; grant update on mysqltest.t1 to mysqltest_1@localhost; grant update(b) on mysqltest.t2 to mysqltest_1@localhost; grant create view,update on test.* to mysqltest_1@localhost; -connection user1; +connect user1,localhost,mysqltest_1,,test; create view v1 as select * from mysqltest.t1; create view v2 as select b from mysqltest.t2; create view mysqltest.v1 as select * from mysqltest.t1; @@ -366,26 +370,26 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; drop view v1,v2,v4; +disconnect user1; connection root; create database mysqltest; create table mysqltest.t1 (a int); create user mysqltest_1@localhost; grant all privileges on mysqltest.* to mysqltest_1@localhost; -connection user1; -use mysqltest; +connect user1,localhost,mysqltest_1,,mysqltest; create view v1 as select * from t1; -use test; connection root; revoke all privileges on mysqltest.* from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; connection root; create database mysqltest; create table mysqltest.t1 (a int, b int); create user mysqltest_1@localhost; grant select on mysqltest.t1 to mysqltest_1@localhost; grant create view,select on test.* to mysqltest_1@localhost; -connection user1; +connect user1,localhost,mysqltest_1,,test; create view v1 as select * from mysqltest.t1; connection root; show create view v1; @@ -401,6 +405,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop view v1; drop database mysqltest; +disconnect user1; connection root; create database mysqltest; use mysqltest; @@ -423,8 +428,7 @@ grant select on v2 to mysqltest_1@localhost; grant select on v3 to mysqltest_1@localhost; grant select on v4 to mysqltest_1@localhost; grant select on v5 to mysqltest_1@localhost; -connection user1; -use mysqltest; +connect user1,localhost,mysqltest_1,,mysqltest; select * from v1; f2() NULL @@ -437,7 +441,6 @@ select * from v4; ERROR HY000: View 'mysqltest.v4' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them select * from v5; ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them -use test; connection root; drop view v1, v2, v3, v4, v5; drop function f2; @@ -446,6 +449,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; connection root; create database mysqltest; use mysqltest; @@ -461,13 +465,11 @@ create user mysqltest_1@localhost; grant select on t1 to mysqltest_1@localhost; grant execute on function f2 to mysqltest_1@localhost; grant create view on mysqltest.* to mysqltest_1@localhost; -connection user1; -use mysqltest; +connect user1,localhost,mysqltest_1,,mysqltest; create algorithm=TEMPTABLE view v1 as select f2() from t1; create algorithm=MERGE view v2 as select f2() from t1; create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1; create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1; -use test; connection root; create view v5 as select * from v1; revoke execute on function f2 from mysqltest_1@localhost; @@ -490,6 +492,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; connection root; create database mysqltest; use mysqltest; @@ -501,14 +504,12 @@ grant select on t1 to mysqltest_1@localhost; grant select on v1 to mysqltest_1@localhost; grant create view on mysqltest.* to mysqltest_1@localhost; drop table v1; -connection user1; -use mysqltest; +connect user1,localhost,mysqltest_1,,mysqltest; create algorithm=TEMPTABLE view v1 as select *, a as b from t1; create algorithm=MERGE view v2 as select *, a as b from t1; create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1; create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1; create view v5 as select * from v1; -use test; connection root; revoke select on t1 from mysqltest_1@localhost; select * from v1; @@ -528,6 +529,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; connection root; create database mysqltest; use mysqltest; @@ -544,8 +546,7 @@ grant select on v2 to mysqltest_1@localhost; grant select on v3 to mysqltest_1@localhost; grant select on v4 to mysqltest_1@localhost; grant select on v5 to mysqltest_1@localhost; -connection user1; -use mysqltest; +connect user1,localhost,mysqltest_1,,mysqltest; select * from v1; a b 1 1 @@ -558,7 +559,6 @@ select * from v4; ERROR HY000: View 'mysqltest.v4' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them select * from v5; ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them -use test; connection root; drop view v1, v2, v3, v4, v5; drop table t1; @@ -566,6 +566,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; create user 'test14256'@'%'; grant all on test.* to 'test14256'@'%'; connect test14256,localhost,test14256,,test; @@ -601,13 +602,11 @@ View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci create user mysqltest_1@localhost; GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost; -connection user1; -use mysqltest; +connect user1,localhost,mysqltest_1,,mysqltest; LOCK TABLES v1 READ; SHOW CREATE TABLE v1; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v1` UNLOCK TABLES; -use test; connection root; use test; drop user mysqltest_1@localhost; @@ -647,7 +646,7 @@ GRANT UPDATE ON mysqltest1.v_tu TO readonly@localhost; GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost; GRANT DELETE ON mysqltest1.v_td TO readonly@localhost; GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost; -connect n1,localhost,readonly,,; +connect n1,localhost,readonly,,mysqltest1; connection n1; SELECT * FROM mysqltest1.v_t1; ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them @@ -720,7 +719,7 @@ DROP TABLE t1; USE test; CREATE USER mysqltest_db1@localhost identified by 'PWD'; GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION; -connect session1,localhost,mysqltest_db1,PWD,test; +connect session1,localhost,mysqltest_db1,PWD,"*NO-ONE*"; CREATE SCHEMA mysqltest_db1 ; USE mysqltest_db1 ; CREATE TABLE t1 (f1 INTEGER); @@ -1085,9 +1084,7 @@ CREATE VIEW v1 AS SELECT f1, f2 FROM t1; CREATE USER foo; GRANT SELECT (f1) ON t1 TO foo; GRANT SELECT (f1) ON v1 TO foo; -connect addconfoo, localhost, foo,,; -connection addconfoo; -USE db1; +connect addconfoo, localhost, foo,,db1; SELECT f1 FROM t1; f1 SELECT f2 FROM t1; @@ -1431,11 +1428,11 @@ CREATE TABLE t2 ( a INT, b INT ); CREATE VIEW v1 AS SELECT a, b FROM t1; GRANT SELECT( a ) ON v1 TO mysqluser1@localhost; GRANT UPDATE( b ) ON t2 TO mysqluser1@localhost; -connect connection1, localhost, mysqluser1, , test; +connect connection1, localhost, mysqluser1, ,mysqltest1; SELECT * FROM mysqltest1.v1; ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`v1` CREATE VIEW v1 AS SELECT * FROM mysqltest1.t2; -ERROR 42000: ANY command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`t2` +ERROR 42000: CREATE VIEW command denied to user 'mysqluser1'@'localhost' for table `mysqltest1`.`v1` disconnect connection1; connection default; DROP TABLE t1, t2; @@ -1858,7 +1855,7 @@ where t2.id = v1.id; create sql security invoker view v42 as select v2.id as id, v2.val as val from mysqltest2.t2 as t2, mysqltest2.v2_merge as v2 where t2.id = v2.id; -connect conn_11766767, localhost, user_11766767,,; +connect conn_11766767, localhost, user_11766767,,mysqltest2; # # A) Check how we handle privilege checking in multi-update for # directly used views. @@ -1959,6 +1956,7 @@ drop database mysqltest2; CREATE SCHEMA foo; CREATE VIEW foo.v AS SELECT * FROM JSON_TABLE('[1,2,3]', '$[*]' COLUMNS (num INT PATH '$[0]')) AS jt; CREATE USER foo@localhost; +GRANT SELECT on test.* to foo@localhost; connect con1,localhost,foo,,; SELECT * FROM foo.v; ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `foo`.`v` diff --git a/mysql-test/main/view_grant.test b/mysql-test/main/view_grant.test index 83bbeb3be7775..9094c616a1f17 100644 --- a/mysql-test/main/view_grant.test +++ b/mysql-test/main/view_grant.test @@ -71,6 +71,7 @@ revoke all privileges on test.* from mysqltest_1@localhost; drop database mysqltest; drop view test.v1; +disconnect user1; # # grants per columns @@ -84,7 +85,7 @@ create table mysqltest.t1 (a int, b int); create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1; grant select (c) on mysqltest.v1 to mysqltest_1@localhost; -connection user1; +connect (user1,localhost,mysqltest_1,,mysqltest); select c from mysqltest.v1; # there are no privileges on column 'd' --error ER_COLUMNACCESS_DENIED_ERROR @@ -112,6 +113,7 @@ select c from mysqltest.v1; select d from mysqltest.v1; connection root; +disconnect user1; revoke all privileges on mysqltest.v1 from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; @@ -139,7 +141,7 @@ grant select on mysqltest.v3 to mysqltest_1@localhost; grant select on mysqltest.v4 to mysqltest_1@localhost; grant show view on mysqltest.v5 to mysqltest_1@localhost; -connection user1; +connect (user1,localhost,mysqltest_1,,mysqltest); # all SELECTs works, except v5 which lacks SELECT privs select c from mysqltest.v1; select c from mysqltest.v2; @@ -188,7 +190,8 @@ connection root; grant show view on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.t1 to mysqltest_1@localhost; revoke select on mysqltest.v5 from mysqltest_1@localhost; -connection user1; +disconnect user1; +connect (user1,localhost,mysqltest_1,,mysqltest); # EXPLAIN works explain select c from mysqltest.v1; show create view mysqltest.v1; @@ -213,7 +216,8 @@ explain select c from mysqltest.v5; # allow to see any view in mysqltest database connection root; grant show view on mysqltest.* to mysqltest_1@localhost; -connection user1; +disconnect user1; +connect (user1,localhost,mysqltest_1,,mysqltest); explain select c from mysqltest.v1; show create view mysqltest.v1; explain select c from mysqltest.v2; @@ -231,6 +235,7 @@ connection root; revoke all privileges on mysqltest.* from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; # # UPDATE privileges on VIEW columns and whole VIEW @@ -256,8 +261,7 @@ grant update on mysqltest.v1 to mysqltest_1@localhost; grant update on mysqltest.t3 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; -connection user1; -use mysqltest; +connect (user1,localhost,mysqltest_1,,mysqltest); # update with rights on VIEW column update t2,v1 set v1.a=v1.a+v1.c where t2.x=v1.c; select * from t1; @@ -281,11 +285,11 @@ update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c; --error ER_TABLEACCESS_DENIED_ERROR update v3 set a=a+c; -use test; connection root; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; # # DELETE privileges on VIEW @@ -306,7 +310,7 @@ create user mysqltest_1@localhost; grant delete on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; -connection user1; +connect (user1,localhost,mysqltest_1,,mysqltest); use mysqltest; # update with rights on VIEW column delete from v1 where c < 4; @@ -319,8 +323,8 @@ delete v2 from t2,v2 where t2.x=v2.c; --error ER_TABLEACCESS_DENIED_ERROR delete from v2 where c < 4; -use test; connection root; +disconnect user1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; @@ -344,7 +348,7 @@ create user mysqltest_1@localhost; grant insert on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; -connection user1; +connect (user1,localhost,mysqltest_1,,mysqltest); use mysqltest; # update with rights on VIEW column insert into v1 values (5,6); @@ -357,11 +361,11 @@ insert into v2 values (5,6); --error ER_TABLEACCESS_DENIED_ERROR insert into v2 select x,y from t2; -use test; connection root; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; # # test of CREATE VIEW privileges if we have limited privileges @@ -379,7 +383,7 @@ grant update on mysqltest.t1 to mysqltest_1@localhost; grant update(b) on mysqltest.t2 to mysqltest_1@localhost; grant create view,update on test.* to mysqltest_1@localhost; -connection user1; +connect (user1,localhost,mysqltest_1,,test); create view v1 as select * from mysqltest.t1; create view v2 as select b from mysqltest.t2; @@ -426,6 +430,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; drop view v1,v2,v4; +disconnect user1; # # user with global DB privileges @@ -438,15 +443,14 @@ create table mysqltest.t1 (a int); create user mysqltest_1@localhost; grant all privileges on mysqltest.* to mysqltest_1@localhost; -connection user1; -use mysqltest; +connect (user1,localhost,mysqltest_1,,mysqltest); create view v1 as select * from t1; -use test; connection root; revoke all privileges on mysqltest.* from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; # # view definer grants revoking @@ -462,7 +466,7 @@ create user mysqltest_1@localhost; grant select on mysqltest.t1 to mysqltest_1@localhost; grant create view,select on test.* to mysqltest_1@localhost; -connection user1; +connect (user1,localhost,mysqltest_1,,test); create view v1 as select * from mysqltest.t1; @@ -478,6 +482,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop view v1; drop database mysqltest; +disconnect user1; # # rights on execution of view underlying functiond (Bug#9505) @@ -512,8 +517,7 @@ grant select on v3 to mysqltest_1@localhost; grant select on v4 to mysqltest_1@localhost; grant select on v5 to mysqltest_1@localhost; -connection user1; -use mysqltest; +connect (user1,localhost,mysqltest_1,,mysqltest); select * from v1; select * from v2; --error ER_VIEW_INVALID @@ -522,7 +526,6 @@ select * from v3; select * from v4; --error ER_VIEW_INVALID select * from v5; -use test; connection root; drop view v1, v2, v3, v4, v5; @@ -532,6 +535,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; # # revertion of previous test, definer of view lost his/her rights to execute @@ -561,13 +565,11 @@ grant select on t1 to mysqltest_1@localhost; grant execute on function f2 to mysqltest_1@localhost; grant create view on mysqltest.* to mysqltest_1@localhost; -connection user1; -use mysqltest; +connect (user1,localhost,mysqltest_1,,mysqltest); create algorithm=TEMPTABLE view v1 as select f2() from t1; create algorithm=MERGE view v2 as select f2() from t1; create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1; create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1; -use test; connection root; create view v5 as select * from v1; @@ -588,6 +590,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; # # definer/invoker rights for columns @@ -607,14 +610,12 @@ grant select on v1 to mysqltest_1@localhost; grant create view on mysqltest.* to mysqltest_1@localhost; drop table v1; -connection user1; -use mysqltest; +connect (user1,localhost,mysqltest_1,,mysqltest); create algorithm=TEMPTABLE view v1 as select *, a as b from t1; create algorithm=MERGE view v2 as select *, a as b from t1; create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1; create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1; create view v5 as select * from v1; -use test; connection root; revoke select on t1 from mysqltest_1@localhost; @@ -633,6 +634,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; connection root; @@ -655,8 +657,7 @@ grant select on v3 to mysqltest_1@localhost; grant select on v4 to mysqltest_1@localhost; grant select on v5 to mysqltest_1@localhost; -connection user1; -use mysqltest; +connect (user1,localhost,mysqltest_1,,mysqltest); select * from v1; select * from v2; --error ER_VIEW_INVALID @@ -665,7 +666,6 @@ select * from v3; select * from v4; --error ER_VIEW_INVALID select * from v5; -use test; connection root; drop view v1, v2, v3, v4, v5; @@ -674,6 +674,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; +disconnect user1; # # Bug#14256 definer in view definition is not fully qualified @@ -723,14 +724,12 @@ SHOW CREATE VIEW v1; create user mysqltest_1@localhost; GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost; -connection user1; +connect (user1,localhost,mysqltest_1,,mysqltest); -use mysqltest; LOCK TABLES v1 READ; --error ER_TABLEACCESS_DENIED_ERROR SHOW CREATE TABLE v1; UNLOCK TABLES; -use test; connection root; use test; @@ -776,7 +775,7 @@ GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost; GRANT DELETE ON mysqltest1.v_td TO readonly@localhost; GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost; -connect (n1,localhost,readonly,,); +connect (n1,localhost,readonly,,mysqltest1); connection n1; --error ER_VIEW_INVALID @@ -858,7 +857,7 @@ eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION; # The session with the non root user is needed. --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (session1,localhost,mysqltest_db1,PWD,test); +connect (session1,localhost,mysqltest_db1,PWD,"*NO-ONE*"); CREATE SCHEMA mysqltest_db1 ; USE mysqltest_db1 ; @@ -1270,9 +1269,7 @@ CREATE USER foo; GRANT SELECT (f1) ON t1 TO foo; GRANT SELECT (f1) ON v1 TO foo; -connect (addconfoo, localhost, foo,,); -connection addconfoo; -USE db1; +connect (addconfoo, localhost, foo,,db1); SELECT f1 FROM t1; --error ER_COLUMNACCESS_DENIED_ERROR @@ -1714,7 +1711,7 @@ CREATE VIEW v1 AS SELECT a, b FROM t1; GRANT SELECT( a ) ON v1 TO mysqluser1@localhost; GRANT UPDATE( b ) ON t2 TO mysqluser1@localhost; ---connect (connection1, localhost, mysqluser1, , test) +--connect (connection1, localhost, mysqluser1, ,mysqltest1) --error ER_TABLEACCESS_DENIED_ERROR SELECT * FROM mysqltest1.v1; @@ -2106,7 +2103,7 @@ create sql security invoker view v42 as where t2.id = v2.id; -connect (conn_11766767, localhost, user_11766767,,); +connect (conn_11766767, localhost, user_11766767,,mysqltest2); --echo # --echo # A) Check how we handle privilege checking in multi-update for @@ -2215,6 +2212,7 @@ CREATE SCHEMA foo; CREATE VIEW foo.v AS SELECT * FROM JSON_TABLE('[1,2,3]', '$[*]' COLUMNS (num INT PATH '$[0]')) AS jt; CREATE USER foo@localhost; +GRANT SELECT on test.* to foo@localhost; connect (con1,localhost,foo,,); --error ER_TABLEACCESS_DENIED_ERROR SELECT * FROM foo.v; diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 54170e7cb1892..9eb7c0d6029a4 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -3822,6 +3822,9 @@ INSERT INTO t1 VALUES (1,1),(2,2),(3,3); ANALYZE FORMAT=JSON SELECT row_number() OVER() FROM t1; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/winservice.inc b/mysql-test/main/winservice.inc index 2d8f6ccae1e33..d77856f6b5b9b 100644 --- a/mysql-test/main/winservice.inc +++ b/mysql-test/main/winservice.inc @@ -9,7 +9,7 @@ let $sc_exe= C:\Windows\System32\sc.exe; let $ddir= $MYSQLTEST_VARDIR/tmp/$datadir_name; let $service_name=$service_name_prefix$MASTER_MYPORT; - +use mysql; error 0,1; rmdir $ddir; @@ -72,4 +72,3 @@ rmdir $ddir; #restart original server connection default; source include/start_mysqld.inc; - diff --git a/mysql-test/main/winservice_basic.result b/mysql-test/main/winservice_basic.result index 0a5e8693b6bc1..da03a15d8b705 100644 --- a/mysql-test/main/winservice_basic.result +++ b/mysql-test/main/winservice_basic.result @@ -1,3 +1,4 @@ +use mysql; # run mysql_install_db with --service parameter # Start service # Connect with root user password=password diff --git a/mysql-test/main/winservice_i18n.result b/mysql-test/main/winservice_i18n.result index 8d5eba3df38ec..a3ee1137e9805 100644 --- a/mysql-test/main/winservice_i18n.result +++ b/mysql-test/main/winservice_i18n.result @@ -1,3 +1,4 @@ +use mysql; # run mysql_install_db with --service parameter # Start service # Connect with root user password=パスワード diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl index 46a51d2fa58b1..b7e832612982e 100755 --- a/mysql-test/mariadb-test-run.pl +++ b/mysql-test/mariadb-test-run.pl @@ -1769,7 +1769,8 @@ sub collect_mysqld_features { and $1 ne "innodb-buffer-page" and $1 ne "innodb-lock-waits" and $1 ne "innodb-locks" - and $1 ne "innodb-trx"; + and $1 ne "innodb-trx" + and $1 ne "gssapi"; next; } @@ -3132,9 +3133,8 @@ sub mysql_install_db { # Append sys schema mtr_appendfile_to_file("$gis_sp_path/mysql_sys_schema.sql", $bootstrap_sql_file); - # Create test database - mtr_appendfile_to_file("$sql_dir/mysql_test_db.sql", - $bootstrap_sql_file); + + mtr_tofile($bootstrap_sql_file, "CREATE DATABASE IF NOT EXISTS test CHARACTER SET latin1 COLLATE latin1_swedish_ci;\n"); # mysql.gtid_slave_pos was created in InnoDB, but many tests # run without InnoDB. Alter it to Aria now diff --git a/mysql-test/suite/binlog/include/ctype_ucs_binlog.result b/mysql-test/suite/binlog/include/ctype_ucs_binlog.result deleted file mode 100644 index c358cfcd4f28f..0000000000000 --- a/mysql-test/suite/binlog/include/ctype_ucs_binlog.result +++ /dev/null @@ -1,212 +0,0 @@ -SET TIMESTAMP=10000; -create table t2 (c char(30)) charset=ucs2; -set @v=convert('abc' using ucs2); -reset master; -insert into t2 values (@v); -include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Gtid # # BEGIN GTID #-#-# -master-bin.000001 # User var # # @`v`=_ucs2 X'006100620063' COLLATE ucs2_general_ci -master-bin.000001 # Query # # use `test`; insert into t2 values (@v) -master-bin.000001 # Query # # COMMIT -flush logs; -/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; -/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -DELIMITER /*!*/; -ROLLBACK/*!*/; -BEGIN -/*!*/; -SET @`v`:=_ucs2 X'006100620063' COLLATE `ucs2_general_ci`/*!*/; -use `test`/*!*/; -SET TIMESTAMP=10000/*!*/; -SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; -SET @@session.sql_mode=1342177280/*!*/; -SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; -/*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; -SET @@session.lc_time_names=0/*!*/; -SET @@session.collation_database=DEFAULT/*!*/; -insert into t2 values (@v) -/*!*/; -SET TIMESTAMP=10000/*!*/; -COMMIT -/*!*/; -DELIMITER ; -# End of log file -ROLLBACK /* added by mysqlbinlog */; -/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; -/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; -drop table t2; -# -# Start of 10.2 tests -# -# -# MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions -# -FLUSH LOGS; -SET NAMES utf8; -CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); -EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (''ä(i1)'')'; -EXECUTE IMMEDIATE CONVERT('INSERT INTO t1 VALUES (''ä(i2)'')' USING ucs2); -SET @stmt=CONVERT('INSERT INTO t1 VALUES (''ä(i3)'')' USING ucs2); -EXECUTE IMMEDIATE @stmt; -PREPARE stmt FROM 'INSERT INTO t1 VALUES (''ä(p1)'')'; -EXECUTE stmt; -PREPARE stmt FROM CONVERT('INSERT INTO t1 VALUES (''ä(p2)'')' USING ucs2); -EXECUTE stmt; -SET @stmt=CONVERT('INSERT INTO t1 VALUES (''ä(p3)'')' USING ucs2); -PREPARE stmt FROM @stmt; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; -SELECT * FROM t1; -a -ä(i1) -ä(i2) -ä(i3) -ä(p1) -ä(p2) -ä(p3) -DROP TABLE t1; -FLUSH LOGS; -/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; -/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; -DELIMITER /*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 700101 6:46:40 -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Gtid list [#-#-#] -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000002 -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000003 -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl -/*!100101 SET @@session.skip_parallel_replication=0*//*!*/; -/*!100001 SET @@session.gtid_domain_id=#*//*!*/; -/*!100001 SET @@session.server_id=#*//*!*/; -/*!100001 SET @@session.gtid_seq_no=#*//*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -use `test`/*!*/; -SET TIMESTAMP=10000/*!*/; -SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; -SET @@session.sql_mode=1342177280/*!*/; -SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; -/*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/; -SET @@session.lc_time_names=0/*!*/; -SET @@session.collation_database=DEFAULT/*!*/; -CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8) -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# -/*!100001 SET @@session.gtid_seq_no=#*//*!*/; -BEGIN -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -INSERT INTO t1 VALUES ('ä(i1)') -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -COMMIT -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# -/*!100001 SET @@session.gtid_seq_no=#*//*!*/; -BEGIN -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -INSERT INTO t1 VALUES ('ä(i2)') -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -COMMIT -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# -/*!100001 SET @@session.gtid_seq_no=#*//*!*/; -BEGIN -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -INSERT INTO t1 VALUES ('ä(i3)') -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -COMMIT -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# -/*!100001 SET @@session.gtid_seq_no=#*//*!*/; -BEGIN -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -INSERT INTO t1 VALUES ('ä(p1)') -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -COMMIT -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# -/*!100001 SET @@session.gtid_seq_no=#*//*!*/; -BEGIN -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -INSERT INTO t1 VALUES ('ä(p2)') -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -COMMIT -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# -/*!100001 SET @@session.gtid_seq_no=#*//*!*/; -BEGIN -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -INSERT INTO t1 VALUES ('ä(p3)') -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -COMMIT -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl -/*!100001 SET @@session.gtid_seq_no=#*//*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 -SET TIMESTAMP=10000/*!*/; -DROP TABLE `t1` /* generated by server */ -/*!*/; -# at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Rotate to master-bin.000004 pos: 4 -DELIMITER ; -# End of log file -ROLLBACK /* added by mysqlbinlog */; -/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; -/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; -# -# End of 10.2 tests -# diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index a79ae45981e61..e325feb508bf7 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -51,7 +51,7 @@ SELECT @binlog_fragment_0, @binlog_fragment_1 as 'NULL','NULL'; NULL NULL NULL ==== Test --base64-output=never on a binlog with row events ==== /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; <#> @@ -59,7 +59,7 @@ ROLLBACK/*!*/; <#> use `test`/*!*/; SET TIMESTAMP=1196959712/*!*/; -<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_dmls_on_tmp_tables_readonly.result b/mysql-test/suite/binlog/r/binlog_dmls_on_tmp_tables_readonly.result index b366bde4dafd2..1b60e50c09d54 100644 --- a/mysql-test/suite/binlog/r/binlog_dmls_on_tmp_tables_readonly.result +++ b/mysql-test/suite/binlog/r/binlog_dmls_on_tmp_tables_readonly.result @@ -2,7 +2,7 @@ DROP TABLE IF EXISTS t1 ; # READ_ONLY does nothing to SUPER users # so we use a non-SUPER one: CREATE USER test@localhost; -GRANT CREATE, SELECT, DROP ON *.* TO test@localhost; +GRANT CREATE TEMPORARY TABLES, SELECT, DROP ON *.* TO test@localhost; connect con1,localhost,test,,test; connection default; SET GLOBAL READ_ONLY=1; diff --git a/mysql-test/suite/binlog/r/binlog_grant.result b/mysql-test/suite/binlog/r/binlog_grant.result index af4c02411d547..edf705614eb57 100644 --- a/mysql-test/suite/binlog/r/binlog_grant.result +++ b/mysql-test/suite/binlog/r/binlog_grant.result @@ -2,9 +2,11 @@ connection default; reset master; set @saved_binlog_format = @@global.binlog_format; create user mysqltest_1@localhost; +GRANT SELECT on test.* to mysqltest_1@localhost; show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO `mysqltest_1`@`localhost` +GRANT SELECT ON `test`.* TO `mysqltest_1`@`localhost` connect plain,localhost,mysqltest_1,,test; connect root,localhost,root,,test; **** Variable SQL_LOG_BIN **** @@ -34,7 +36,7 @@ set global binlog_format = @saved_binlog_format; drop user mysqltest_1@localhost; CREATE USER 'mysqltest_1'@'localhost'; GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost'; -connect rpl,localhost,mysqltest_1,,; +connect rpl,localhost,mysqltest_1,,"*NO-ONE*"; connection rpl; SHOW MASTER LOGS; SHOW BINARY LOGS; @@ -88,7 +90,7 @@ DROP USER user1@localhost; # Test if PURGE BINLOG is allowed with BINLOG ADMIN CREATE USER user1@localhost; GRANT BINLOG ADMIN ON *.* TO user1@localhost; -connect user1,localhost,user1,,; +connect user1,localhost,user1,,"*NO-ONE*"; connection user1; PURGE BINARY LOGS BEFORE '2001-01-01 00:00:00'; disconnect user1; @@ -97,7 +99,7 @@ DROP USER user1@localhost; # Test if PURGE BINLOG is allowed with SUPER CREATE USER user1@localhost; GRANT SUPER ON *.* TO user1@localhost; -connect user1,localhost,user1,,; +connect user1,localhost,user1,,"*NO-ONE*"; connection user1; PURGE BINARY LOGS BEFORE '2001-01-01 00:00:00'; disconnect user1; @@ -117,7 +119,7 @@ DROP USER user1@localhost; # Test if SHOW BINLOG EVENTS is allowed with BINLOG MONITOR CREATE USER user1@localhost; GRANT BINLOG MONITOR ON *.* TO user1@localhost; -connect user1,localhost,user1,,; +connect user1,localhost,user1,,"*NO-ONE*"; connection user1; SHOW BINLOG EVENTS; disconnect user1; @@ -132,6 +134,7 @@ DROP USER user1@localhost; # CREATE USER user1@localhost; GRANT BINLOG REPLAY ON *.* TO user1@localhost; +GRANT ALL ON test.* TO user1@localhost; RESET MASTER; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3); diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result index 11abd6e897321..96b3ca97da561 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result @@ -18,14 +18,14 @@ insert into t1 values(null, "f"); --- Local -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -87,7 +87,7 @@ ROLLBACK /* added by mysqlbinlog */; --- offset -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -97,7 +97,7 @@ SET INSERT_ID=1/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -153,7 +153,7 @@ ROLLBACK /* added by mysqlbinlog */; --- start-position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -163,7 +163,7 @@ SET INSERT_ID=3/*!*/; use `test`/*!*/; SET TIMESTAMP=1773144/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -201,14 +201,14 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -243,7 +243,7 @@ ROLLBACK /* added by mysqlbinlog */; --- start and stop positions --- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -253,7 +253,7 @@ SET INSERT_ID=3/*!*/; use `test`/*!*/; SET TIMESTAMP=1773144/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -270,7 +270,7 @@ ROLLBACK /* added by mysqlbinlog */; --- start-datetime -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -280,7 +280,7 @@ SET INSERT_ID=3/*!*/; use `test`/*!*/; SET TIMESTAMP=1773144/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -318,14 +318,14 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-datetime -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -361,14 +361,14 @@ ROLLBACK /* added by mysqlbinlog */; --- Local with 2 binlogs on command line -- flush logs; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -430,7 +430,7 @@ SET INSERT_ID=6/*!*/; use `test`/*!*/; SET TIMESTAMP=1773143/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -450,7 +450,7 @@ ROLLBACK /* added by mysqlbinlog */; --- offset -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -460,7 +460,7 @@ SET INSERT_ID=1/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -516,7 +516,7 @@ SET INSERT_ID=6/*!*/; use `test`/*!*/; SET TIMESTAMP=1773143/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -536,7 +536,7 @@ ROLLBACK /* added by mysqlbinlog */; --- start-position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -546,7 +546,7 @@ SET INSERT_ID=3/*!*/; use `test`/*!*/; SET TIMESTAMP=1773144/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -584,7 +584,7 @@ SET INSERT_ID=6/*!*/; use `test`/*!*/; SET TIMESTAMP=1773143/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -604,14 +604,14 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -677,7 +677,7 @@ ROLLBACK /* added by mysqlbinlog */; --- start-datetime -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -687,7 +687,7 @@ SET INSERT_ID=3/*!*/; use `test`/*!*/; SET TIMESTAMP=1773144/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -725,7 +725,7 @@ SET INSERT_ID=6/*!*/; use `test`/*!*/; SET TIMESTAMP=1773143/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -745,14 +745,14 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-datetime -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -787,14 +787,14 @@ ROLLBACK /* added by mysqlbinlog */; --- Remote -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -856,7 +856,7 @@ ROLLBACK /* added by mysqlbinlog */; --- offset -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -866,7 +866,7 @@ SET INSERT_ID=1/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -922,7 +922,7 @@ ROLLBACK /* added by mysqlbinlog */; --- start-position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; START TRANSACTION @@ -931,7 +931,7 @@ SET INSERT_ID=3/*!*/; use `test`/*!*/; SET TIMESTAMP=1773144/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -969,14 +969,14 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1011,7 +1011,7 @@ ROLLBACK /* added by mysqlbinlog */; --- start and stop positions --- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; START TRANSACTION @@ -1020,7 +1020,7 @@ SET INSERT_ID=3/*!*/; use `test`/*!*/; SET TIMESTAMP=1773144/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1037,7 +1037,7 @@ ROLLBACK /* added by mysqlbinlog */; --- start-datetime -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -1047,7 +1047,7 @@ SET INSERT_ID=3/*!*/; use `test`/*!*/; SET TIMESTAMP=1773144/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1085,14 +1085,14 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-datetime -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1127,14 +1127,14 @@ ROLLBACK /* added by mysqlbinlog */; --- Remote with 2 binlogs on command line -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1196,7 +1196,7 @@ SET INSERT_ID=6/*!*/; use `test`/*!*/; SET TIMESTAMP=1773143/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1216,7 +1216,7 @@ ROLLBACK /* added by mysqlbinlog */; --- offset -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -1226,7 +1226,7 @@ SET INSERT_ID=1/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1282,7 +1282,7 @@ SET INSERT_ID=6/*!*/; use `test`/*!*/; SET TIMESTAMP=1773143/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1302,7 +1302,7 @@ ROLLBACK /* added by mysqlbinlog */; --- start-position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; START TRANSACTION @@ -1311,7 +1311,7 @@ SET INSERT_ID=3/*!*/; use `test`/*!*/; SET TIMESTAMP=1773144/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1349,7 +1349,7 @@ SET INSERT_ID=6/*!*/; use `test`/*!*/; SET TIMESTAMP=1773143/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1369,14 +1369,14 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1440,7 +1440,7 @@ ROLLBACK /* added by mysqlbinlog */; --- start-datetime -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -1450,7 +1450,7 @@ SET INSERT_ID=3/*!*/; use `test`/*!*/; SET TIMESTAMP=1773144/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1488,7 +1488,7 @@ SET INSERT_ID=6/*!*/; use `test`/*!*/; SET TIMESTAMP=1773143/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1508,14 +1508,14 @@ ROLLBACK /* added by mysqlbinlog */; --- stop-datetime -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1550,14 +1550,14 @@ ROLLBACK /* added by mysqlbinlog */; --- to-last-log -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1773142/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result index 816084d7464d0..b793887af0a70 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result @@ -355,7 +355,7 @@ INSERT INTO t1 VALUES (POINT(10,10)); DROP TABLE t1; FLUSH LOGS; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -376,7 +376,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -5335,7 +5335,7 @@ ROLLBACK /* added by mysqlbinlog */; /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -5364,7 +5364,7 @@ START TRANSACTION Error: Found Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -5386,7 +5386,7 @@ DELIMITER /*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result index 65e2f824e39b8..1340337c0bdae 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result @@ -2249,7 +2249,7 @@ FLUSH LOGS; # Call mysqlbinlog to display the log file contents. # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -2270,7 +2270,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; @@ -5258,7 +5258,7 @@ FLUSH LOGS; # Call mysqlbinlog to display the log file contents. # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -5279,7 +5279,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; @@ -5658,7 +5658,7 @@ FLUSH LOGS; # Call mysqlbinlog to display the log file contents. # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -5679,7 +5679,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; @@ -6296,7 +6296,7 @@ FLUSH LOGS; # Call mysqlbinlog to display the log file contents. # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -6317,7 +6317,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result index 3f838c8c3694c..ec145fa4059e1 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result @@ -2247,7 +2247,7 @@ FLUSH LOGS; # Call mysqlbinlog to display the log file contents. # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -2268,7 +2268,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; @@ -5279,7 +5279,7 @@ FLUSH LOGS; # Call mysqlbinlog to display the log file contents. # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -5300,7 +5300,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; @@ -5685,7 +5685,7 @@ FLUSH LOGS; # Call mysqlbinlog to display the log file contents. # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -5706,7 +5706,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; @@ -6333,7 +6333,7 @@ FLUSH LOGS; # Call mysqlbinlog to display the log file contents. # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -6354,7 +6354,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result index 5a27afaae711f..5735b9b804d1d 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result @@ -125,7 +125,7 @@ FLUSH LOGS; # Call mysqlbinlog to display the log file contents. # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -146,7 +146,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_row_annotate.result b/mysql-test/suite/binlog/r/binlog_row_annotate.result index bf114d8cfa97f..bb4d318bdd4c2 100644 --- a/mysql-test/suite/binlog/r/binlog_row_annotate.result +++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result @@ -96,7 +96,7 @@ master-bin.000001 # Rotate # # master-bin.000002;pos=POS # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) ##################################################################################### /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -116,7 +116,7 @@ ROLLBACK/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -334,7 +334,7 @@ ROLLBACK /* added by mysqlbinlog */; # - DELETE test1.t1, test2.t2 FROM <...> ##################################################################################### /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -354,7 +354,7 @@ ROLLBACK/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -493,7 +493,7 @@ ROLLBACK /* added by mysqlbinlog */; # No Annotates should appear in this output ##################################################################################### /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -513,7 +513,7 @@ ROLLBACK/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -719,7 +719,7 @@ ROLLBACK /* added by mysqlbinlog */; # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) ##################################################################################### /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -739,7 +739,7 @@ ROLLBACK/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -957,7 +957,7 @@ ROLLBACK /* added by mysqlbinlog */; # - DELETE test1.t1, test2.t2 FROM <...> ##################################################################################### /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -977,7 +977,7 @@ ROLLBACK/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -1116,7 +1116,7 @@ ROLLBACK /* added by mysqlbinlog */; # No Annotates should appear in this output ##################################################################################### /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -1136,7 +1136,7 @@ ROLLBACK/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result index 6d10d5420e457..c02912b85d97c 100644 --- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result @@ -12,7 +12,7 @@ master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT flush logs; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -22,7 +22,7 @@ START TRANSACTION #Q> insert into t2 values (@v) SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -70,7 +70,7 @@ a DROP TABLE t1; FLUSH LOGS; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -92,7 +92,7 @@ DELIMITER /*!*/; use `test`/*!*/; SET TIMESTAMP=XXX/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result index fe08f6e9fe91e..a0cf5b2dcdb59 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result +++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result @@ -29,7 +29,7 @@ flush logs; # --rewrite-db = test3->new_test3 # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -50,7 +50,7 @@ use `new_test1`/*!*/; #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -270,7 +270,7 @@ ROLLBACK /* added by mysqlbinlog */; # --read-from-remote-server # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -291,7 +291,7 @@ use `new_test1`/*!*/; #010909 4:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result index c78365a847ef5..f9dc5d647535f 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result @@ -11,7 +11,7 @@ master-bin.000001 # Query # # use `test`; insert into t2 values (@v) master-bin.000001 # Query # # COMMIT flush logs; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -21,7 +21,7 @@ SET @`v`:=_ucs2 X'006100620063' COLLATE `ucs2_general_ci`/*!*/; use `test`/*!*/; SET TIMESTAMP=10000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -72,7 +72,7 @@ a DROP TABLE t1; FLUSH LOGS; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -94,7 +94,7 @@ DELIMITER /*!*/; use `test`/*!*/; SET TIMESTAMP=XXX/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; diff --git a/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result b/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result index 8425e0ad17a0d..7fcde14d3ee60 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result @@ -63,7 +63,7 @@ disconnect con1; # Proof of the truncated binlog file is readable (two transactions must be seen): /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; START TRANSACTION diff --git a/mysql-test/suite/binlog/r/flashback.result b/mysql-test/suite/binlog/r/flashback.result index da08f81478312..2eac49397a92c 100644 --- a/mysql-test/suite/binlog/r/flashback.result +++ b/mysql-test/suite/binlog/r/flashback.result @@ -39,7 +39,7 @@ FLUSH LOGS; # Show mysqlbinlog result without -B # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -60,7 +60,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -267,7 +267,7 @@ ROLLBACK /* added by mysqlbinlog */; # Show mysqlbinlog result with -B # /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; #010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 010909 9:46:40 at startup @@ -422,7 +422,7 @@ COMMIT use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog/r/read_only.result b/mysql-test/suite/binlog/r/read_only.result index 9a173d9a96e5d..1084970d11ac8 100644 --- a/mysql-test/suite/binlog/r/read_only.result +++ b/mysql-test/suite/binlog/r/read_only.result @@ -5,7 +5,7 @@ # gtid_strict_mode enabled # create user test@localhost; -grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost; +grant CREATE TEMPORARY TABLES, DROP, INSERT, SELECT on *.* to test@localhost; create table t1 (a int) engine=myisam; insert into t1 values (1),(2); reset master; diff --git a/mysql-test/suite/binlog/r/read_only_statement.result b/mysql-test/suite/binlog/r/read_only_statement.result index 9a173d9a96e5d..1084970d11ac8 100644 --- a/mysql-test/suite/binlog/r/read_only_statement.result +++ b/mysql-test/suite/binlog/r/read_only_statement.result @@ -5,7 +5,7 @@ # gtid_strict_mode enabled # create user test@localhost; -grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost; +grant CREATE TEMPORARY TABLES, DROP, INSERT, SELECT on *.* to test@localhost; create table t1 (a int) engine=myisam; insert into t1 values (1),(2); reset master; diff --git a/mysql-test/suite/binlog/t/binlog_dmls_on_tmp_tables_readonly.test b/mysql-test/suite/binlog/t/binlog_dmls_on_tmp_tables_readonly.test index 0fa35d57745d3..dd0cdd0f82e83 100644 --- a/mysql-test/suite/binlog/t/binlog_dmls_on_tmp_tables_readonly.test +++ b/mysql-test/suite/binlog/t/binlog_dmls_on_tmp_tables_readonly.test @@ -26,7 +26,7 @@ DROP TABLE IF EXISTS t1 ; --echo # READ_ONLY does nothing to SUPER users --echo # so we use a non-SUPER one: CREATE USER test@localhost; -GRANT CREATE, SELECT, DROP ON *.* TO test@localhost; +GRANT CREATE TEMPORARY TABLES, SELECT, DROP ON *.* TO test@localhost; connect (con1,localhost,test,,test); diff --git a/mysql-test/suite/binlog/t/binlog_grant.test b/mysql-test/suite/binlog/t/binlog_grant.test index ec8d2aeccd254..d573281f691ab 100644 --- a/mysql-test/suite/binlog/t/binlog_grant.test +++ b/mysql-test/suite/binlog/t/binlog_grant.test @@ -10,6 +10,7 @@ reset master; set @saved_binlog_format = @@global.binlog_format; create user mysqltest_1@localhost; +GRANT SELECT on test.* to mysqltest_1@localhost; show grants for mysqltest_1@localhost; connect (plain,localhost,mysqltest_1,,test); @@ -60,7 +61,7 @@ drop user mysqltest_1@localhost; # SHOW MASTER LOGS and SHOW BINARY. CREATE USER 'mysqltest_1'@'localhost'; GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost'; ---connect(rpl,localhost,mysqltest_1,,) +--connect(rpl,localhost,mysqltest_1,,"*NO-ONE*") --connection rpl # We are only interested if the following commands succeed and not on @@ -128,7 +129,7 @@ DROP USER user1@localhost; --echo # Test if PURGE BINLOG is allowed with BINLOG ADMIN CREATE USER user1@localhost; GRANT BINLOG ADMIN ON *.* TO user1@localhost; ---connect(user1,localhost,user1,,) +--connect(user1,localhost,user1,,"*NO-ONE*") --connection user1 PURGE BINARY LOGS BEFORE '2001-01-01 00:00:00'; --disconnect user1 @@ -139,7 +140,7 @@ DROP USER user1@localhost; --echo # Test if PURGE BINLOG is allowed with SUPER CREATE USER user1@localhost; GRANT SUPER ON *.* TO user1@localhost; ---connect(user1,localhost,user1,,) +--connect(user1,localhost,user1,,"*NO-ONE*") --connection user1 PURGE BINARY LOGS BEFORE '2001-01-01 00:00:00'; --disconnect user1 @@ -163,7 +164,7 @@ DROP USER user1@localhost; --echo # Test if SHOW BINLOG EVENTS is allowed with BINLOG MONITOR CREATE USER user1@localhost; GRANT BINLOG MONITOR ON *.* TO user1@localhost; ---connect(user1,localhost,user1,,) +--connect(user1,localhost,user1,,"*NO-ONE*") --connection user1 --disable_result_log SHOW BINLOG EVENTS; @@ -182,6 +183,7 @@ DROP USER user1@localhost; CREATE USER user1@localhost; GRANT BINLOG REPLAY ON *.* TO user1@localhost; +GRANT ALL ON test.* TO user1@localhost; RESET MASTER; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3); diff --git a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test index 25889bb59ad7b..6aab8f0eb8fa7 100644 --- a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test +++ b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test @@ -25,7 +25,7 @@ SET timestamp=1000000000; # Delete all existing binary logs. RESET MASTER; -# Whe'll call mysqlbinlog with two rewrite rules: +# We'll call mysqlbinlog with two rewrite rules: # --rewrite-db="test1->new_test1" # --rewrite-db="test3->new_test3" diff --git a/mysql-test/suite/binlog/t/read_only.inc b/mysql-test/suite/binlog/t/read_only.inc index 37f1cb3b2b8af..78136b90d0e7b 100644 --- a/mysql-test/suite/binlog/t/read_only.inc +++ b/mysql-test/suite/binlog/t/read_only.inc @@ -6,7 +6,7 @@ --echo # create user test@localhost; -grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost; +grant CREATE TEMPORARY TABLES, DROP, INSERT, SELECT on *.* to test@localhost; create table t1 (a int) engine=myisam; insert into t1 values (1),(2); reset master; diff --git a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result index 2614020b7a98b..583d9a30a5aa8 100644 --- a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result +++ b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result @@ -97,7 +97,7 @@ master-bin.000001 # Rotate # # master-bin.000002;pos=POS # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) ##################################################################################### /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -120,7 +120,7 @@ ROLLBACK/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -338,7 +338,7 @@ ROLLBACK /* added by mysqlbinlog */; # - DELETE test1.t1, test2.t2 FROM <...> ##################################################################################### /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -361,7 +361,7 @@ ROLLBACK/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -500,7 +500,7 @@ ROLLBACK /* added by mysqlbinlog */; # No Annotates should appear in this output ##################################################################################### /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -523,7 +523,7 @@ ROLLBACK/*!*/; #010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0 xid= SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/binlog_encryption/rpl_sync-master.opt b/mysql-test/suite/binlog_encryption/rpl_sync-master.opt index 04b06bfa0f225..96f0ce3f36c0b 100644 --- a/mysql-test/suite/binlog_encryption/rpl_sync-master.opt +++ b/mysql-test/suite/binlog_encryption/rpl_sync-master.opt @@ -1,2 +1 @@ --default-storage-engine=MyISAM ---loose-innodb-file-per-table=0 diff --git a/mysql-test/suite/binlog_encryption/rpl_sync-slave.opt b/mysql-test/suite/binlog_encryption/rpl_sync-slave.opt index 795330535c1ab..d1a481cd37dd0 100644 --- a/mysql-test/suite/binlog_encryption/rpl_sync-slave.opt +++ b/mysql-test/suite/binlog_encryption/rpl_sync-slave.opt @@ -1,2 +1,2 @@ ---sync-relay-log-info=1 --relay-log-recovery=1 --default-storage-engine=MyISAM --loose-innodb-file-per-table=0 +--sync-relay-log-info=1 --relay-log-recovery=1 --default-storage-engine=MyISAM --skip-core-file --skip-slave-start diff --git a/mysql-test/suite/compat/oracle/r/table_value_constr.result b/mysql-test/suite/compat/oracle/r/table_value_constr.result index 365edaa7757d8..af071433d0f03 100644 --- a/mysql-test/suite/compat/oracle/r/table_value_constr.result +++ b/mysql-test/suite/compat/oracle/r/table_value_constr.result @@ -1665,6 +1665,9 @@ analyze format=json values (1,2); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "query_specifications": [ @@ -1711,6 +1714,9 @@ union values (1,2),(3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -1745,6 +1751,9 @@ union select 1,2; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -1779,6 +1788,9 @@ union values (1,2),(3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -1826,6 +1838,9 @@ union values (1,2); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -1892,6 +1907,9 @@ union all select 1,2; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "query_specifications": [ @@ -1922,6 +1940,9 @@ union values (1,2),(3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "", @@ -1956,6 +1977,9 @@ union all values (1,2),(3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "query_specifications": [ @@ -1998,6 +2022,9 @@ union all values (1,2); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "query_specifications": [ diff --git a/mysql-test/suite/compat/oracle/t/table_value_constr.test b/mysql-test/suite/compat/oracle/t/table_value_constr.test index 4e0dcc0551491..ca3c40bb7f933 100644 --- a/mysql-test/suite/compat/oracle/t/table_value_constr.test +++ b/mysql-test/suite/compat/oracle/t/table_value_constr.test @@ -934,6 +934,7 @@ values (1,2); analyze values (1,2); +--source include/analyze-format.inc analyze format=json values (1,2); @@ -954,16 +955,19 @@ values (5,6) union values (1,2),(3,4); +--source include/analyze-format.inc analyze format=json select 1,2 union values (1,2),(3,4); +--source include/analyze-format.inc analyze format=json values (1,2),(3,4) union select 1,2; +--source include/analyze-format.inc analyze format=json values (5,6) union @@ -976,6 +980,7 @@ values (3,4) union values (1,2); +--source include/analyze-format.inc analyze format=json select 1,2 union @@ -1000,16 +1005,19 @@ values (1,2) union all values (1,2),(3,4); +--source include/analyze-format.inc analyze format=json values (1,2),(3,4) union all select 1,2; +--source include/analyze-format.inc analyze format=json select 1,2 union values (1,2),(3,4); +--source include/analyze-format.inc analyze format=json values (1,2) union all @@ -1022,6 +1030,7 @@ values (3,4) union all values (1,2); +--source include/analyze-format.inc analyze format=json select 1,2 union all diff --git a/mysql-test/suite/encryption/r/encrypt_and_grep.result b/mysql-test/suite/encryption/r/encrypt_and_grep.result index 72d612eeac897..e52ec0e453f00 100644 --- a/mysql-test/suite/encryption/r/encrypt_and_grep.result +++ b/mysql-test/suite/encryption/r/encrypt_and_grep.result @@ -1,4 +1,3 @@ -SET GLOBAL innodb_file_per_table = ON; create table t1 (a varchar(255)) engine=innodb encrypted=yes; create table t2 (a varchar(255)) engine=innodb; show warnings; diff --git a/mysql-test/suite/encryption/r/innochecksum.result b/mysql-test/suite/encryption/r/innochecksum.result index 7c68164e52a43..dc0bf63a71eae 100644 --- a/mysql-test/suite/encryption/r/innochecksum.result +++ b/mysql-test/suite/encryption/r/innochecksum.result @@ -1,4 +1,3 @@ -SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; # Create and populate a tables CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4; diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result index e2034f14e31fd..eb114fcf6fc4f 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result @@ -9,7 +9,6 @@ call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found" call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="); # Start server with keys2.txt # restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt -SET GLOBAL innodb_file_per_table = ON; CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2; INSERT INTO t1 VALUES ('foobar'); ALTER TABLE t1 ADD COLUMN c2 INT; diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result index 3cda2bd537b09..ab67b6fedadb3 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result @@ -8,7 +8,6 @@ call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not call mtr.add_suppression("InnoDB: ALTER TABLE `test`\\.`t1` DISCARD TABLESPACE failed to find tablespace"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="); # restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt -SET GLOBAL innodb_file_per_table = ON; CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4; INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result index e808d50b54426..9983c26c9d7b8 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result @@ -5,7 +5,6 @@ call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); call mtr.add_suppression("Table .*t1.* is corrupted"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="); # restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt -SET GLOBAL innodb_file_per_table = ON; CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4; INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); diff --git a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result index 7b97eb6b5bdc6..f88f18d092822 100644 --- a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result +++ b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result @@ -1,8 +1,6 @@ -SET @saved_file_per_table = @@global.innodb_file_per_table; SET @saved_encrypt_tables = @@global.innodb_encrypt_tables; SET @saved_encryption_threads = @@global.innodb_encryption_threads; SET @saved_encryption_key_id = @@global.innodb_default_encryption_key_id; -SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_encrypt_tables = ON; SET GLOBAL innodb_encryption_threads = 4; SET GLOBAL innodb_default_encryption_key_id=4; @@ -92,7 +90,6 @@ test.t check status OK test.tpe check status OK test.tp check status OK DROP TABLE tce, tc, te, t, tpe, tp; -SET GLOBAL innodb_file_per_table = @saved_file_per_table; SET GLOBAL innodb_encrypt_tables = @saved_encrypt_tables; SET GLOBAL innodb_encryption_threads = @saved_encryption_threads; SET GLOBAL innodb_default_encryption_key_id = @saved_encryption_key_id; diff --git a/mysql-test/suite/encryption/r/innodb-compressed-blob.result b/mysql-test/suite/encryption/r/innodb-compressed-blob.result index 0dc873b99ab42..bb87d1716010b 100644 --- a/mysql-test/suite/encryption/r/innodb-compressed-blob.result +++ b/mysql-test/suite/encryption/r/innodb-compressed-blob.result @@ -4,7 +4,6 @@ call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[1-3]\\.ibd\\[pag call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted"); # Restart mysqld --file-key-management-filename=keys2.txt # restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt -SET GLOBAL innodb_file_per_table = ON; set GLOBAL innodb_default_encryption_key_id=4; create table t1(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed; create table t2(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes; diff --git a/mysql-test/suite/encryption/r/innodb-force-corrupt.result b/mysql-test/suite/encryption/r/innodb-force-corrupt.result index ad75df952b339..219dbd7cfc33c 100644 --- a/mysql-test/suite/encryption/r/innodb-force-corrupt.result +++ b/mysql-test/suite/encryption/r/innodb-force-corrupt.result @@ -2,7 +2,6 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t[13]` (has an unreadable root call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=\\d+, page number=[36]\\] in file .*test.t[123]\\.ibd looks corrupted; key_version="); call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption in an InnoDB type table"); call mtr.add_suppression("\\[ERROR\\] (mysqld|mariadbd).*: Index for table 't2' is corrupt; try to repair it"); -SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; # Create and populate tables to be corrupted CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT,c char(200)) ENGINE=InnoDB encrypted=yes; diff --git a/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result b/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result index 4e816bea43b23..4eb203d278709 100644 --- a/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result +++ b/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result @@ -1,4 +1,3 @@ -SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; create database enctests; use enctests; diff --git a/mysql-test/suite/encryption/r/innodb-redo-badkey.result b/mysql-test/suite/encryption/r/innodb-redo-badkey.result index 34fd043a7bd32..6b8f6aa11daa5 100644 --- a/mysql-test/suite/encryption/r/innodb-redo-badkey.result +++ b/mysql-test/suite/encryption/r/innodb-redo-badkey.result @@ -14,7 +14,6 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="); # restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt # Wait max 10 min for key encryption threads to encrypt all spaces -SET GLOBAL innodb_file_per_table = ON; create table t1(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=4; create table t2(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb row_format=compressed; create table t3(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb encrypted=yes encryption_key_id=4; diff --git a/mysql-test/suite/encryption/r/innodb-redo-nokeys.result b/mysql-test/suite/encryption/r/innodb-redo-nokeys.result index 9f9cc85289893..fd6ce1d979a5b 100644 --- a/mysql-test/suite/encryption/r/innodb-redo-nokeys.result +++ b/mysql-test/suite/encryption/r/innodb-redo-nokeys.result @@ -11,7 +11,6 @@ call mtr.add_suppression("InnoDB: Missing FILE_CHECKPOINT"); call mtr.add_suppression("InnoDB: Log scan aborted at LSN"); call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore corruption"); # restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt -SET GLOBAL innodb_file_per_table = ON; create table t1(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=20; create table t2(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes; create table t3(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb encrypted=yes encryption_key_id=20; diff --git a/mysql-test/suite/encryption/r/innodb-remove-encryption.result b/mysql-test/suite/encryption/r/innodb-remove-encryption.result index e241d213c8ec6..22207f8184abd 100644 --- a/mysql-test/suite/encryption/r/innodb-remove-encryption.result +++ b/mysql-test/suite/encryption/r/innodb-remove-encryption.result @@ -1,4 +1,6 @@ set global innodb_file_per_table=OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release call mtr.add_suppression("(mysqld|mariadbd).*: file-key-management-filename is not set"); call mtr.add_suppression("Plugin 'file_key_management' init function returned error."); call mtr.add_suppression("Plugin 'file_key_management' registration as a ENCRYPTION failed."); diff --git a/mysql-test/suite/encryption/r/innodb-spatial-index.result b/mysql-test/suite/encryption/r/innodb-spatial-index.result index 66c3edcd109be..6bd22d6c25f0a 100644 --- a/mysql-test/suite/encryption/r/innodb-spatial-index.result +++ b/mysql-test/suite/encryption/r/innodb-spatial-index.result @@ -38,6 +38,9 @@ INSERT INTO t2 values(1, 'secret', ST_GeomFromText('POINT(903994614 180726515)') SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION > 0; NAME innodb_system +innodb_undo001 +innodb_undo002 +innodb_undo003 mysql/innodb_index_stats mysql/innodb_table_stats mysql/transaction_registry diff --git a/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result b/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result index d6e32989c0999..3a28082751b79 100644 --- a/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result +++ b/mysql-test/suite/encryption/r/innodb_onlinealter_encryption.result @@ -41,7 +41,6 @@ NOT FOUND /mangled/ in t6.ibd # t7 ... on expecting NOT FOUND NOT FOUND /mysql/ in t7.ibd # restart -SET GLOBAL innodb_file_per_table = ON; ALTER TABLE t1 ADD COLUMN b int default 2; ALTER TABLE t2 ADD COLUMN b int default 2; ALTER TABLE t7 ADD COLUMN b int default 2; diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result index 866465c26f2c6..6fde6d2a41f35 100644 --- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result +++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result @@ -3828,6 +3828,9 @@ INSERT INTO t1 VALUES (1,1),(2,2),(3,3); ANALYZE FORMAT=JSON SELECT row_number() OVER() FROM t1; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/suite/encryption/t/encrypt_and_grep.test b/mysql-test/suite/encryption/t/encrypt_and_grep.test index 687f14e8a55ae..485a3eb2ec8dd 100644 --- a/mysql-test/suite/encryption/t/encrypt_and_grep.test +++ b/mysql-test/suite/encryption/t/encrypt_and_grep.test @@ -12,8 +12,6 @@ --let t3_IBD = $MYSQLD_DATADIR/test/t3.ibd --let SEARCH_RANGE = 10000000 -SET GLOBAL innodb_file_per_table = ON; - create table t1 (a varchar(255)) engine=innodb encrypted=yes; create table t2 (a varchar(255)) engine=innodb; show warnings; diff --git a/mysql-test/suite/encryption/t/innochecksum.test b/mysql-test/suite/encryption/t/innochecksum.test index 516bc0733d986..358a6a0fccaf1 100644 --- a/mysql-test/suite/encryption/t/innochecksum.test +++ b/mysql-test/suite/encryption/t/innochecksum.test @@ -26,7 +26,6 @@ call mtr.add_suppression("InnoDB: Crash recovery is broken due to insufficient i --enable_query_log let $checksum_algorithm = `SELECT @@innodb_checksum_algorithm`; -SET GLOBAL innodb_file_per_table = ON; # zlib set global innodb_compression_algorithm = 1; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test index 05a3b5f4d06b4..5eefded9ae1bf 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test @@ -23,8 +23,6 @@ call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=" -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt -- source include/restart_mysqld.inc -SET GLOBAL innodb_file_per_table = ON; - CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2; INSERT INTO t1 VALUES ('foobar'); ALTER TABLE t1 ADD COLUMN c2 INT; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test index 21a9ddb217d01..a6cc581e448e3 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test @@ -23,8 +23,6 @@ call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=" --let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt --source include/restart_mysqld.inc -SET GLOBAL innodb_file_per_table = ON; - CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4; INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test index c37eb365e7c18..b041c9888516a 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test @@ -19,8 +19,6 @@ call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=" --let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt --source include/restart_mysqld.inc -SET GLOBAL innodb_file_per_table = ON; - CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4; INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); diff --git a/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test b/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test index 157fb25b1858f..2de7c171981d0 100644 --- a/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test +++ b/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test @@ -2,12 +2,10 @@ -- source include/innodb_page_size.inc -- source include/have_file_key_management_plugin.inc -SET @saved_file_per_table = @@global.innodb_file_per_table; SET @saved_encrypt_tables = @@global.innodb_encrypt_tables; SET @saved_encryption_threads = @@global.innodb_encryption_threads; SET @saved_encryption_key_id = @@global.innodb_default_encryption_key_id; -SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_encrypt_tables = ON; SET GLOBAL innodb_encryption_threads = 4; @@ -77,7 +75,6 @@ update tp set b=substr(b,1); CHECK TABLE tce, tc, te, t, tpe, tp; DROP TABLE tce, tc, te, t, tpe, tp; -SET GLOBAL innodb_file_per_table = @saved_file_per_table; SET GLOBAL innodb_encrypt_tables = @saved_encrypt_tables; SET GLOBAL innodb_encryption_threads = @saved_encryption_threads; SET GLOBAL innodb_default_encryption_key_id = @saved_encryption_key_id; diff --git a/mysql-test/suite/encryption/t/innodb-compressed-blob.test b/mysql-test/suite/encryption/t/innodb-compressed-blob.test index 12d061a852f3d..d3d53e2c41ae1 100644 --- a/mysql-test/suite/encryption/t/innodb-compressed-blob.test +++ b/mysql-test/suite/encryption/t/innodb-compressed-blob.test @@ -13,8 +13,6 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted"); -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt -- source include/restart_mysqld.inc -SET GLOBAL innodb_file_per_table = ON; - set GLOBAL innodb_default_encryption_key_id=4; create table t1(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed; create table t2(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes; diff --git a/mysql-test/suite/encryption/t/innodb-force-corrupt.test b/mysql-test/suite/encryption/t/innodb-force-corrupt.test index 51771f1e14b89..73fa0cde0cf6c 100644 --- a/mysql-test/suite/encryption/t/innodb-force-corrupt.test +++ b/mysql-test/suite/encryption/t/innodb-force-corrupt.test @@ -12,7 +12,6 @@ call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=\\d+, page nu call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption in an InnoDB type table"); call mtr.add_suppression("\\[ERROR\\] (mysqld|mariadbd).*: Index for table 't2' is corrupt; try to repair it"); -SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; --echo # Create and populate tables to be corrupted diff --git a/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test b/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test index 96b62f7c05b71..0139b9fb8176d 100644 --- a/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test +++ b/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test @@ -4,7 +4,6 @@ -- source include/not_embedded.inc let $encryption = `SELECT @@innodb_encrypt_tables`; -SET GLOBAL innodb_file_per_table = ON; # zlib set global innodb_compression_algorithm = 1; diff --git a/mysql-test/suite/encryption/t/innodb-redo-badkey.opt b/mysql-test/suite/encryption/t/innodb-redo-badkey.opt index 2de0bdb32416d..60d43648e0087 100644 --- a/mysql-test/suite/encryption/t/innodb-redo-badkey.opt +++ b/mysql-test/suite/encryption/t/innodb-redo-badkey.opt @@ -1,4 +1,3 @@ ---innodb-change-buffering=all --innodb-encrypt-tables=on --innodb-tablespaces-encryption --innodb-encryption-threads=2 diff --git a/mysql-test/suite/encryption/t/innodb-redo-badkey.test b/mysql-test/suite/encryption/t/innodb-redo-badkey.test index 393ca4ad375eb..de6d7f2f2537b 100644 --- a/mysql-test/suite/encryption/t/innodb-redo-badkey.test +++ b/mysql-test/suite/encryption/t/innodb-redo-badkey.test @@ -31,8 +31,6 @@ call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=" --let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 --source include/wait_condition.inc -SET GLOBAL innodb_file_per_table = ON; - create table t1(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=4; create table t2(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb row_format=compressed; create table t3(a int not null primary key auto_increment, c char(250), b blob, index(b(10))) engine=innodb encrypted=yes encryption_key_id=4; diff --git a/mysql-test/suite/encryption/t/innodb-redo-nokeys.opt b/mysql-test/suite/encryption/t/innodb-redo-nokeys.opt index 6190ad24ed338..4e7b22902a443 100644 --- a/mysql-test/suite/encryption/t/innodb-redo-nokeys.opt +++ b/mysql-test/suite/encryption/t/innodb-redo-nokeys.opt @@ -1,2 +1 @@ ---innodb-change-buffering=none --innodb-default-encryption-key-id=20 diff --git a/mysql-test/suite/encryption/t/innodb-redo-nokeys.test b/mysql-test/suite/encryption/t/innodb-redo-nokeys.test index 0aaed201d43f2..2624bb6ff9c6a 100644 --- a/mysql-test/suite/encryption/t/innodb-redo-nokeys.test +++ b/mysql-test/suite/encryption/t/innodb-redo-nokeys.test @@ -19,8 +19,6 @@ call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore corrupti -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt -- source include/restart_mysqld.inc -SET GLOBAL innodb_file_per_table = ON; - create table t1(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=20; create table t2(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes; create table t3(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb encrypted=yes encryption_key_id=20; diff --git a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test index 9f61bf118aa56..dc6d1e6f93c86 100644 --- a/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test +++ b/mysql-test/suite/encryption/t/innodb_onlinealter_encryption.test @@ -75,8 +75,6 @@ set autocommit=1; -- source include/start_mysqld.inc -SET GLOBAL innodb_file_per_table = ON; - ALTER TABLE t1 ADD COLUMN b int default 2; ALTER TABLE t2 ADD COLUMN b int default 2; ALTER TABLE t7 ADD COLUMN b int default 2; diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp.result b/mysql-test/suite/engines/funcs/r/rpl_sp.result index 264a1505275fc..945db68d8dd31 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_sp.result +++ b/mysql-test/suite/engines/funcs/r/rpl_sp.result @@ -765,13 +765,13 @@ test mysqltestbug36570_f1 FUNCTION root@localhost t t DEFINER latin1 latin1_swe connection master; flush logs; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; SET TIMESTAMP=t/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/engines/funcs/r/rpl_temporary.result b/mysql-test/suite/engines/funcs/r/rpl_temporary.result index 650fe1db9e034..492e9ac3ac3d5 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_temporary.result +++ b/mysql-test/suite/engines/funcs/r/rpl_temporary.result @@ -34,6 +34,8 @@ connection master; DROP TABLE t1; connection slave; connection master; +create user zedjzlcsjhd@localhost; +GRANT ALL on test.* to zedjzlcsjhd@localhost; connect con1,localhost,root,,; connect con2,localhost,root,,; connect con3,localhost,zedjzlcsjhd,,; @@ -83,6 +85,7 @@ f 5 7 drop table t1, t2; +drop user zedjzlcsjhd@localhost; use test; SET TIMESTAMP=1040323920; create table t1(f int); @@ -174,7 +177,7 @@ FLUSH PRIVILEGES; GRANT USAGE ON *.* TO user43748@127.0.0.1 IDENTIFIED BY 'meow'; GRANT PROCESS ON *.* TO user43748@127.0.0.1; -- try to KILL system-thread as that non-privileged user (on slave). -connect cont43748,127.0.0.1,user43748,meow,test,$SLAVE_MYPORT,; +connect cont43748,127.0.0.1,user43748,meow,"*NO-ONE*",$SLAVE_MYPORT,; connection cont43748; SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1; KILL @id; diff --git a/mysql-test/suite/federated/federatedx_create_handlers.result b/mysql-test/suite/federated/federatedx_create_handlers.result index 55756329ff3ee..f2e2247bae13e 100644 --- a/mysql-test/suite/federated/federatedx_create_handlers.result +++ b/mysql-test/suite/federated/federatedx_create_handlers.result @@ -117,6 +117,9 @@ ANALYZE FORMAT=JSON SELECT id FROM federated.t1 WHERE id < 5; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "table": { @@ -223,6 +226,9 @@ FROM federated.t2 GROUP BY name)) t WHERE federated.t3.name=t.name; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/suite/funcs_1/datadict/is_routines.inc b/mysql-test/suite/funcs_1/datadict/is_routines.inc index 3bbd26a948d24..37e77e81a2847 100644 --- a/mysql-test/suite/funcs_1/datadict/is_routines.inc +++ b/mysql-test/suite/funcs_1/datadict/is_routines.inc @@ -193,7 +193,7 @@ connect (testuser2, localhost, testuser2, , db_datadict); SELECT * FROM information_schema.routines where routine_schema <> 'sys'; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (testuser3, localhost, testuser3, , test); +connect (testuser3, localhost, testuser3, , "*NO-ONE*"); --replace_column 24 "YYYY-MM-DD hh:mm:ss" 25 "YYYY-MM-DD hh:mm:ss" SELECT * FROM information_schema.routines where routine_schema <> 'sys'; diff --git a/mysql-test/suite/funcs_1/datadict/is_schemata.inc b/mysql-test/suite/funcs_1/datadict/is_schemata.inc index 267d3c272b973..6ddd966d7a908 100644 --- a/mysql-test/suite/funcs_1/datadict/is_schemata.inc +++ b/mysql-test/suite/funcs_1/datadict/is_schemata.inc @@ -120,7 +120,7 @@ eval $my_select; eval $my_show; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (testuser3, localhost, testuser3, , test); +connect (testuser3, localhost, testuser3, ,"*NO-ONE*"); # Shows neither db_datadict_1 nor db_datadict_2 eval $my_select; --sorted_result diff --git a/mysql-test/suite/funcs_1/datadict/is_views.inc b/mysql-test/suite/funcs_1/datadict/is_views.inc index 367b1b1ede4ca..acf12ce5d3980 100644 --- a/mysql-test/suite/funcs_1/datadict/is_views.inc +++ b/mysql-test/suite/funcs_1/datadict/is_views.inc @@ -109,15 +109,15 @@ WHERE table_schema = 'db_datadict' ORDER BY table_name; eval $select; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (testuser1, localhost, testuser1, , test); +connect (testuser1, localhost, testuser1, ,"*NO-ONE*"); eval $select; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (testuser2, localhost, testuser2, , test); +connect (testuser2, localhost, testuser2, ,"*NO-ONE*"); eval $select; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (test_no_views, localhost, test_no_views, , test); +connect (test_no_views, localhost, test_no_views, ,"*NO-ONE*"); eval $select; # Cleanup diff --git a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc index 99a4340c5713d..90bc19f2784ee 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc @@ -132,6 +132,8 @@ DROP USER ddicttestuser1@'localhost'; DROP USER ddicttestuser2@'localhost'; CREATE USER ddicttestuser1@'localhost'; CREATE USER ddicttestuser2@'localhost'; +GRANT SELECT,UPDATE,DELETE,INSERT,CREATE,CREATE TEMPORARY TABLES,CREATE VIEW,DROP on test.* to ddicttestuser1@'localhost'; +GRANT SELECT,UPDATE,DELETE,INSERT,CREATE,CREATE TEMPORARY TABLES,CREATE VIEW,DROP on test.* to ddicttestuser2@'localhost'; SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass'); SET PASSWORD FOR ddicttestuser2@'localhost' = PASSWORD('ddictpass'); diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03.result b/mysql-test/suite/funcs_1/r/innodb_trig_03.result index c2f0bb4a2f063..f0f1777bcbdbb 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_03.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_03.result @@ -241,7 +241,7 @@ show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT UPDATE ON `priv_db`.* TO `test_yesprivs`@`localhost` -connect no_privs_424b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect no_privs_424b,localhost,test_noprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; connect yes_privs_424b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection default; connection no_privs_424b; diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result index 457d98d572fde..51f4eca4f1a93 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result @@ -24,7 +24,8 @@ show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT USAGE ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT ON `priv_db`.* TO `test_noprivs`@`localhost` -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; no trigger privilege on db level for create: -------------------------------------------- @@ -32,8 +33,8 @@ use priv_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -use priv_db; +connect no_privs,localhost,test_noprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connection no_privs; insert into t1 (f1) values ('insert-yes'); select f1 from t1 order by f1; f1 @@ -271,8 +272,10 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; create User test_noprivs@localhost; set password for test_noprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; +connect no_privs,localhost,test_noprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection no_privs; no trigger privilege on table level for create: ----------------------------------------------- @@ -824,10 +827,8 @@ Grants for test_noprivs@localhost GRANT USAGE ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT, UPDATE ON `priv1_db`.* TO `test_noprivs`@`localhost` GRANT SELECT, INSERT ON `priv2_db`.* TO `test_noprivs`@`localhost` -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -use priv1_db; -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -use priv1_db; +connect yes_privs,localhost,test_yesprivs,PWD,priv1_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connect no_privs,localhost,test_noprivs,PWD,priv1_db,$MASTER_MYPORT,$MASTER_MYSOCK; trigger privilege on one db1 db level, not on db2 ------------------------------------------------- @@ -1055,7 +1056,8 @@ create User test_useprivs@localhost; set password for test_useprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost; -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; connection default; select current_user; current_user @@ -1085,11 +1087,11 @@ select f1 from t1 order by f1; f1 trig 1_1-yes prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')'; -connect use_privs,localhost,test_useprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect use_privs,localhost,test_useprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connection use_privs; select current_user; current_user test_useprivs@localhost -use priv_db; prepare ins1 from 'insert into t1 (f1) values (''insert3-no'')'; execute ins1; select f1 from t1 order by f1; @@ -1301,7 +1303,8 @@ create table t1 (f1 char(20)) engine= innodb; create User test_yesprivs@localhost; set password for test_yesprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; connection default; select current_user; current_user @@ -1407,7 +1410,6 @@ create table t1 (f1 char(20)) engine= innodb; create User test_yesprivs@localhost; set password for test_yesprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection default; select current_user; current_user @@ -1418,11 +1420,11 @@ show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT USAGE ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO `test_yesprivs`@`localhost` +connect yes_privs,localhost,test_yesprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; connection yes_privs; select current_user; current_user test_yesprivs@localhost -use priv_db; set autocommit=0; create definer=current_user trigger trg1_1 before INSERT on t1 for each row @@ -1484,8 +1486,10 @@ show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT USAGE ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, UPDATE ON `priv_db`.* TO `test_noprivs`@`localhost` -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; +connect no_privs,localhost,test_noprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection no_privs; update only on column: ---------------------- diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result index d551575960e1b..281e4e8d0f6c3 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result @@ -69,8 +69,10 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost; create User test_super@localhost; set password for test_super@localhost = password('PWD'); grant ALL on *.* to test_super@localhost with grant OPTION; -connect con1_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -connect con1_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect con1_general,localhost,test_general,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection con1_general; +connect con1_super,localhost,test_super,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection con1_super; connection default; Testcase 3.5.4: diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_08.result b/mysql-test/suite/funcs_1/r/innodb_trig_08.result index 2a57496800ed1..52820d6b0cd58 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_08.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_08.result @@ -66,6 +66,7 @@ Testcase: 3.5: create User test_general@localhost; set password for test_general@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost; +grant SELECT,UPDATE,DELETE,INSERT on test.* to test_general@localhost; create User test_super@localhost; set password for test_super@localhost = password('PWD'); grant ALL on *.* to test_super@localhost with grant OPTION; diff --git a/mysql-test/suite/funcs_1/r/is_basics_mixed.result b/mysql-test/suite/funcs_1/r/is_basics_mixed.result index 95fc5ae59c382..267bb56331c60 100644 --- a/mysql-test/suite/funcs_1/r/is_basics_mixed.result +++ b/mysql-test/suite/funcs_1/r/is_basics_mixed.result @@ -15,6 +15,7 @@ DATABASE() information_schema DROP USER 'testuser1'@'localhost'; CREATE USER 'testuser1'@'localhost'; +GRANT SELECT ON test.* TO 'testuser1'@'localhost'; connect testuser1, localhost, testuser1, , test; SELECT DATABASE(); DATABASE() diff --git a/mysql-test/suite/funcs_1/r/is_check_constraints.result b/mysql-test/suite/funcs_1/r/is_check_constraints.result index 3a8fbac917044..f2e3d7aef5314 100644 --- a/mysql-test/suite/funcs_1/r/is_check_constraints.result +++ b/mysql-test/suite/funcs_1/r/is_check_constraints.result @@ -108,7 +108,7 @@ def foo t3 b Column `b` > 0 def foo t3 b Table `b` > 10 def foo t3 b1 Table `b` < 123456789012345678901234567890123456789012345678901234567890123456789 disconnect con1; -CONNECT con2, localhost, boo2,, test; +CONNECT con2, localhost, boo2,,"*NO-ONE*"; SELECT * from information_schema.check_constraints; CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME LEVEL CHECK_CLAUSE disconnect con2; diff --git a/mysql-test/suite/funcs_1/r/is_column_privileges_is_mysql_test.result b/mysql-test/suite/funcs_1/r/is_column_privileges_is_mysql_test.result index 1492bd26b5dd1..e30bd86833fed 100644 --- a/mysql-test/suite/funcs_1/r/is_column_privileges_is_mysql_test.result +++ b/mysql-test/suite/funcs_1/r/is_column_privileges_is_mysql_test.result @@ -31,7 +31,6 @@ SHOW DATABASES LIKE 'mysql'; Database (mysql) SHOW DATABASES LIKE 'test'; Database (test) -test connection default; DROP USER 'testuser1'@'localhost'; DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_routines.result b/mysql-test/suite/funcs_1/r/is_routines.result index 1b293444b27fe..51477e441ad07 100644 --- a/mysql-test/suite/funcs_1/r/is_routines.result +++ b/mysql-test/suite/funcs_1/r/is_routines.result @@ -196,7 +196,7 @@ connect testuser2, localhost, testuser2, , db_datadict; SELECT * FROM information_schema.routines where routine_schema <> 'sys'; SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL NULL NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci -connect testuser3, localhost, testuser3, , test; +connect testuser3, localhost, testuser3, , "*NO-ONE*"; SELECT * FROM information_schema.routines where routine_schema <> 'sys'; SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION connection default; diff --git a/mysql-test/suite/funcs_1/r/is_routines_embedded.result b/mysql-test/suite/funcs_1/r/is_routines_embedded.result index dfd663a6a96ee..be2a3d4543294 100644 --- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result @@ -219,7 +219,7 @@ AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NUL set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss mariadb.sys@localhost latin1 latin1_swedish_ci latin1_swedish_ci DropGeometryColumn def mysql DropGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss mariadb.sys@localhost latin1 latin1_swedish_ci latin1_swedish_ci -connect testuser3, localhost, testuser3, , test; +connect testuser3, localhost, testuser3, , "*NO-ONE*"; SELECT * FROM information_schema.routines where routine_schema <> 'sys'; SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION sp_6_408002_1 def db_datadict sp_6_408002_1 PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN diff --git a/mysql-test/suite/funcs_1/r/is_schema_privileges.result b/mysql-test/suite/funcs_1/r/is_schema_privileges.result index 1c8f50df7ceb8..69f78a98711b1 100644 --- a/mysql-test/suite/funcs_1/r/is_schema_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_schema_privileges.result @@ -52,40 +52,6 @@ IS_GRANTABLE varchar(3) NO NULL SELECT GRANTEE, TABLE_CATALOG, TABLE_SCHEMA, PRIVILEGE_TYPE FROM information_schema.schema_privileges WHERE table_catalog IS NOT NULL; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE -''@'%' def test SELECT -''@'%' def test INSERT -''@'%' def test UPDATE -''@'%' def test DELETE -''@'%' def test CREATE -''@'%' def test DROP -''@'%' def test REFERENCES -''@'%' def test INDEX -''@'%' def test ALTER -''@'%' def test CREATE TEMPORARY TABLES -''@'%' def test LOCK TABLES -''@'%' def test CREATE VIEW -''@'%' def test SHOW VIEW -''@'%' def test CREATE ROUTINE -''@'%' def test EVENT -''@'%' def test TRIGGER -''@'%' def test DELETE HISTORY -''@'%' def test\_% SELECT -''@'%' def test\_% INSERT -''@'%' def test\_% UPDATE -''@'%' def test\_% DELETE -''@'%' def test\_% CREATE -''@'%' def test\_% DROP -''@'%' def test\_% REFERENCES -''@'%' def test\_% INDEX -''@'%' def test\_% ALTER -''@'%' def test\_% CREATE TEMPORARY TABLES -''@'%' def test\_% LOCK TABLES -''@'%' def test\_% CREATE VIEW -''@'%' def test\_% SHOW VIEW -''@'%' def test\_% CREATE ROUTINE -''@'%' def test\_% EVENT -''@'%' def test\_% TRIGGER -''@'%' def test\_% DELETE HISTORY ############################################################################### # Testcase 3.2.15.2-3.2.15.4 INFORMATION_SCHEMA.SCHEMA_PRIVILEGES accessibility ############################################################################### @@ -106,7 +72,7 @@ GRANT INSERT ON db_datadict_2.t1 TO 'testuser1'@'localhost'; GRANT SELECT ON db_datadict_4.* TO 'testuser1'@'localhost' WITH GRANT OPTION; GRANT SELECT ON db_datadict_3.* TO 'testuser2'@'localhost'; GRANT SELECT ON db_datadict_1.* TO 'testuser2'@'localhost'; -connect testuser1, localhost, testuser1, , test; +connect testuser1, localhost, testuser1, ,"*NO-ONE*"; GRANT SELECT ON db_datadict_4.* TO 'testuser2'@'localhost'; # Root granted INSERT db_datadict_1 to me -> visible # Root granted SELECT db_datadict_1 to testuser2 -> invisible @@ -130,7 +96,7 @@ GRANT SELECT ON `db_datadict_4`.* TO `testuser1`@`localhost` WITH GRANT OPTION GRANT INSERT ON `db_datadict_2`.`t1` TO `testuser1`@`localhost` SHOW GRANTS FOR 'testuser2'@'localhost'; ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql' -connect testuser2, localhost, testuser2, , test; +connect testuser2, localhost, testuser2, ,"*NO-ONE*"; # Root granted SELECT db_datadict_1 to me -> visible # Root granted INSERT db_datadict_1 to testuser1 -> invisible # Root granted INSERT db_datadict_2.t1 but not db_datadict_1 to testuser1 -> invisible diff --git a/mysql-test/suite/funcs_1/r/is_schema_privileges_is_mysql_test.result b/mysql-test/suite/funcs_1/r/is_schema_privileges_is_mysql_test.result index 2b285395cffd2..774b65b03bc4c 100644 --- a/mysql-test/suite/funcs_1/r/is_schema_privileges_is_mysql_test.result +++ b/mysql-test/suite/funcs_1/r/is_schema_privileges_is_mysql_test.result @@ -10,23 +10,6 @@ SELECT * FROM information_schema.schema_privileges WHERE table_schema IN ('information_schema','mysql','test') ORDER BY grantee, table_schema, privilege_type; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE -''@'%' def test ALTER NO -''@'%' def test CREATE NO -''@'%' def test CREATE ROUTINE NO -''@'%' def test CREATE TEMPORARY TABLES NO -''@'%' def test CREATE VIEW NO -''@'%' def test DELETE NO -''@'%' def test DELETE HISTORY NO -''@'%' def test DROP NO -''@'%' def test EVENT NO -''@'%' def test INDEX NO -''@'%' def test INSERT NO -''@'%' def test LOCK TABLES NO -''@'%' def test REFERENCES NO -''@'%' def test SELECT NO -''@'%' def test SHOW VIEW NO -''@'%' def test TRIGGER NO -''@'%' def test UPDATE NO SHOW DATABASES LIKE 'information_schema'; Database (information_schema) information_schema @@ -48,7 +31,6 @@ SHOW DATABASES LIKE 'mysql'; Database (mysql) SHOW DATABASES LIKE 'test'; Database (test) -test connection default; DROP USER 'testuser1'@'localhost'; DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_schemata.result b/mysql-test/suite/funcs_1/r/is_schemata.result index ff33306b8f90d..1851c089b04c1 100644 --- a/mysql-test/suite/funcs_1/r/is_schemata.result +++ b/mysql-test/suite/funcs_1/r/is_schemata.result @@ -106,7 +106,7 @@ SHOW DATABASES LIKE 'db_datadict_%'; Database (db_datadict_%) db_datadict_1 db_datadict_2 -connect testuser3, localhost, testuser3, , test; +connect testuser3, localhost, testuser3, ,"*NO-ONE*"; SELECT * FROM information_schema.schemata WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name; CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT diff --git a/mysql-test/suite/funcs_1/r/is_schemata_embedded.result b/mysql-test/suite/funcs_1/r/is_schemata_embedded.result index 9f129caa5bf28..fd7a86d4a42ba 100644 --- a/mysql-test/suite/funcs_1/r/is_schemata_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_schemata_embedded.result @@ -108,7 +108,7 @@ SHOW DATABASES LIKE 'db_datadict_%'; Database (db_datadict_%) db_datadict_1 db_datadict_2 -connect testuser3, localhost, testuser3, , test; +connect testuser3, localhost, testuser3, ,"*NO-ONE*"; SELECT * FROM information_schema.schemata WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name; CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT diff --git a/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result b/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result index 516d1cc04dd32..4a18f7a0abab8 100644 --- a/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result +++ b/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result @@ -28,7 +28,6 @@ WHERE schema_name IN ('information_schema','mysql','test') ORDER BY schema_name; CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT def information_schema utf8mb3 utf8mb3_general_ci NULL -def test latin1 latin1_swedish_ci NULL SHOW DATABASES LIKE 'information_schema'; Database (information_schema) information_schema @@ -36,7 +35,6 @@ SHOW DATABASES LIKE 'mysql'; Database (mysql) SHOW DATABASES LIKE 'test'; Database (test) -test connection default; DROP USER 'testuser1'@'localhost'; DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result index 4729ddf0d3a0a..b08f7202a3b56 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics.result +++ b/mysql-test/suite/funcs_1/r/is_statistics.result @@ -170,6 +170,8 @@ DROP USER 'testuser1'@'localhost'; CREATE USER 'testuser1'@'localhost'; DROP USER 'testuser2'@'localhost'; CREATE USER 'testuser2'@'localhost'; +GRANT ALL ON test.* TO 'testuser1'@'localhost'; +GRANT ALL ON test.* TO 'testuser2'@'localhost'; CREATE TABLE db_datadict.t1 (f1 INT NOT NULL, PRIMARY KEY(f1), f2 INT, INDEX f2_ind(f2)) ENGINE = ; @@ -200,9 +202,11 @@ def db_datadict_2 t4 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH NO SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` SHOW GRANTS FOR 'testuser2'@'localhost'; Grants for testuser2@localhost GRANT USAGE ON *.* TO `testuser2`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `testuser2`@`localhost` connect testuser1, localhost, testuser1, , test; SELECT * FROM information_schema.statistics WHERE table_schema LIKE 'db_datadict%' @@ -211,6 +215,7 @@ TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_ SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` SHOW GRANTS FOR 'testuser2'@'localhost'; ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql' connect testuser2, localhost, testuser2, , test; @@ -223,6 +228,7 @@ ERROR 42000: Access denied for user 'testuser2'@'localhost' to database 'mysql' SHOW GRANTS FOR 'testuser2'@'localhost'; Grants for testuser2@localhost GRANT USAGE ON *.* TO `testuser2`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `testuser2`@`localhost` connection default; GRANT SELECT ON db_datadict.t1 TO 'testuser1'@'localhost' WITH GRANT OPTION; GRANT SELECT(f1,f5) ON db_datadict_2.t3 TO 'testuser1'@'localhost'; @@ -243,11 +249,13 @@ def db_datadict_2 t4 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH NO SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` GRANT SELECT (`f5`, `f1`) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` GRANT SELECT ON `db_datadict`.`t1` TO `testuser1`@`localhost` WITH GRANT OPTION SHOW GRANTS FOR 'testuser2'@'localhost'; Grants for testuser2@localhost GRANT USAGE ON *.* TO `testuser2`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `testuser2`@`localhost` connection testuser1; SELECT * FROM information_schema.statistics WHERE table_schema LIKE 'db_datadict%' @@ -262,6 +270,7 @@ def db_datadict_2 t3 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH NO SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` GRANT SELECT (`f5`, `f1`) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` GRANT SELECT ON `db_datadict`.`t1` TO `testuser1`@`localhost` WITH GRANT OPTION SHOW GRANTS FOR 'testuser2'@'localhost'; @@ -276,11 +285,13 @@ ERROR 42000: Access denied for user 'testuser2'@'localhost' to database 'mysql' SHOW GRANTS FOR 'testuser2'@'localhost'; Grants for testuser2@localhost GRANT USAGE ON *.* TO `testuser2`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `testuser2`@`localhost` connection default; REVOKE SELECT,GRANT OPTION ON db_datadict.t1 FROM 'testuser1'@'localhost'; SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` GRANT SELECT (`f5`, `f1`) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` connection testuser1; SELECT * FROM information_schema.statistics @@ -294,6 +305,7 @@ def db_datadict_2 t3 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH NO SHOW GRANTS FOR 'testuser1'@'localhost'; Grants for testuser1@localhost GRANT USAGE ON *.* TO `testuser1`@`localhost` +GRANT ALL PRIVILEGES ON `test`.* TO `testuser1`@`localhost` GRANT SELECT (`f5`, `f1`) ON `db_datadict_2`.`t3` TO `testuser1`@`localhost` connection default; disconnect testuser1; diff --git a/mysql-test/suite/funcs_1/r/is_user_privileges.result b/mysql-test/suite/funcs_1/r/is_user_privileges.result index 4228c744e46d0..a2a6838358aca 100644 --- a/mysql-test/suite/funcs_1/r/is_user_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_user_privileges.result @@ -371,7 +371,7 @@ ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table `my SHOW GRANTS; Grants for testuser2@localhost GRANT INSERT, UPDATE ON *.* TO `testuser2`@`localhost` -connect testuser3, localhost, testuser3, , test; +connect testuser3, localhost, testuser3, ,"*NO-ONE*"; SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' ORDER BY grantee, table_catalog, privilege_type; diff --git a/mysql-test/suite/funcs_1/r/is_views.result b/mysql-test/suite/funcs_1/r/is_views.result index 97ce2d915d8f1..6a86e7464a0fb 100644 --- a/mysql-test/suite/funcs_1/r/is_views.result +++ b/mysql-test/suite/funcs_1/r/is_views.result @@ -93,18 +93,18 @@ WHERE table_schema = 'db_datadict' ORDER BY table_name; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM def db_datadict v_granted_glob select `db_datadict`.`t1`.`f2` AS `f2`,`db_datadict`.`t1`.`f3` AS `f3` from `db_datadict`.`t1` NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def db_datadict v_granted_to_1 select `db_datadict`.`t1`.`f1` AS `f1`,`db_datadict`.`t1`.`f2` AS `f2`,`db_datadict`.`t1`.`f3` AS `f3` from `db_datadict`.`t1` NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED -connect testuser1, localhost, testuser1, , test; +connect testuser1, localhost, testuser1, ,"*NO-ONE*"; SELECT * FROM information_schema.views WHERE table_schema = 'db_datadict' ORDER BY table_name; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM def db_datadict v_granted_to_1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED -connect testuser2, localhost, testuser2, , test; +connect testuser2, localhost, testuser2, ,"*NO-ONE*"; SELECT * FROM information_schema.views WHERE table_schema = 'db_datadict' ORDER BY table_name; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM def db_datadict v_granted_glob NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def db_datadict v_granted_to_1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED -connect test_no_views, localhost, test_no_views, , test; +connect test_no_views, localhost, test_no_views, ,"*NO-ONE*"; SELECT * FROM information_schema.views WHERE table_schema = 'db_datadict' ORDER BY table_name; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM diff --git a/mysql-test/suite/funcs_1/r/is_views_embedded.result b/mysql-test/suite/funcs_1/r/is_views_embedded.result index 136126d8ab560..f64562aadd164 100644 --- a/mysql-test/suite/funcs_1/r/is_views_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_views_embedded.result @@ -93,19 +93,19 @@ WHERE table_schema = 'db_datadict' ORDER BY table_name; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM def db_datadict v_granted_glob select `db_datadict`.`t1`.`f2` AS `f2`,`db_datadict`.`t1`.`f3` AS `f3` from `db_datadict`.`t1` NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def db_datadict v_granted_to_1 select `db_datadict`.`t1`.`f1` AS `f1`,`db_datadict`.`t1`.`f2` AS `f2`,`db_datadict`.`t1`.`f3` AS `f3` from `db_datadict`.`t1` NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED -connect testuser1, localhost, testuser1, , test; +connect testuser1, localhost, testuser1, ,"*NO-ONE*"; SELECT * FROM information_schema.views WHERE table_schema = 'db_datadict' ORDER BY table_name; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM def db_datadict v_granted_glob NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def db_datadict v_granted_to_1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED -connect testuser2, localhost, testuser2, , test; +connect testuser2, localhost, testuser2, ,"*NO-ONE*"; SELECT * FROM information_schema.views WHERE table_schema = 'db_datadict' ORDER BY table_name; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM def db_datadict v_granted_glob NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def db_datadict v_granted_to_1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED -connect test_no_views, localhost, test_no_views, , test; +connect test_no_views, localhost, test_no_views, ,"*NO-ONE*"; SELECT * FROM information_schema.views WHERE table_schema = 'db_datadict' ORDER BY table_name; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03.result b/mysql-test/suite/funcs_1/r/memory_trig_03.result index 18d55140d67c4..c1c1c6f8f406c 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_03.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_03.result @@ -241,7 +241,7 @@ show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT UPDATE ON `priv_db`.* TO `test_yesprivs`@`localhost` -connect no_privs_424b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect no_privs_424b,localhost,test_noprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; connect yes_privs_424b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection default; connection no_privs_424b; diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03e.result b/mysql-test/suite/funcs_1/r/memory_trig_03e.result index 684685480c2c9..9397e0766ef95 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result @@ -25,7 +25,8 @@ show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT USAGE ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT ON `priv_db`.* TO `test_noprivs`@`localhost` -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; no trigger privilege on db level for create: -------------------------------------------- @@ -33,8 +34,8 @@ use priv_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -use priv_db; +connect no_privs,localhost,test_noprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connection no_privs; insert into t1 (f1) values ('insert-yes'); select f1 from t1 order by f1; f1 @@ -272,8 +273,10 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; create User test_noprivs@localhost; set password for test_noprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; +connect no_privs,localhost,test_noprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection no_privs; no trigger privilege on table level for create: ----------------------------------------------- @@ -825,10 +828,8 @@ Grants for test_noprivs@localhost GRANT USAGE ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT, UPDATE ON `priv1_db`.* TO `test_noprivs`@`localhost` GRANT SELECT, INSERT ON `priv2_db`.* TO `test_noprivs`@`localhost` -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -use priv1_db; -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -use priv1_db; +connect yes_privs,localhost,test_yesprivs,PWD,priv1_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connect no_privs,localhost,test_noprivs,PWD,priv1_db,$MASTER_MYPORT,$MASTER_MYSOCK; trigger privilege on one db1 db level, not on db2 ------------------------------------------------- @@ -1056,7 +1057,8 @@ create User test_useprivs@localhost; set password for test_useprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost; -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; connection default; select current_user; current_user @@ -1086,11 +1088,11 @@ select f1 from t1 order by f1; f1 trig 1_1-yes prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')'; -connect use_privs,localhost,test_useprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect use_privs,localhost,test_useprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connection use_privs; select current_user; current_user test_useprivs@localhost -use priv_db; prepare ins1 from 'insert into t1 (f1) values (''insert3-no'')'; execute ins1; select f1 from t1 order by f1; @@ -1302,7 +1304,8 @@ create table t1 (f1 char(20)) engine= memory; create User test_yesprivs@localhost; set password for test_yesprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; connection default; select current_user; current_user @@ -1423,8 +1426,10 @@ show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT USAGE ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, UPDATE ON `priv_db`.* TO `test_noprivs`@`localhost` -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; +connect no_privs,localhost,test_noprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection no_privs; update only on column: ---------------------- diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0407.result b/mysql-test/suite/funcs_1/r/memory_trig_0407.result index ceae360946c0e..c9a15b46aba07 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_0407.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_0407.result @@ -69,8 +69,10 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost; create User test_super@localhost; set password for test_super@localhost = password('PWD'); grant ALL on *.* to test_super@localhost with grant OPTION; -connect con1_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -connect con1_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect con1_general,localhost,test_general,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection con1_general; +connect con1_super,localhost,test_super,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection con1_super; connection default; Testcase 3.5.4: diff --git a/mysql-test/suite/funcs_1/r/memory_trig_08.result b/mysql-test/suite/funcs_1/r/memory_trig_08.result index c9d6454dc5b2c..c37266bb40c91 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_08.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_08.result @@ -66,6 +66,7 @@ Testcase: 3.5: create User test_general@localhost; set password for test_general@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost; +grant SELECT,UPDATE,DELETE,INSERT on test.* to test_general@localhost; create User test_super@localhost; set password for test_super@localhost = password('PWD'); grant ALL on *.* to test_super@localhost with grant OPTION; diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03.result b/mysql-test/suite/funcs_1/r/myisam_trig_03.result index 18d55140d67c4..c1c1c6f8f406c 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_03.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_03.result @@ -241,7 +241,7 @@ show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost GRANT TRIGGER ON *.* TO `test_yesprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT UPDATE ON `priv_db`.* TO `test_yesprivs`@`localhost` -connect no_privs_424b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect no_privs_424b,localhost,test_noprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; connect yes_privs_424b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection default; connection no_privs_424b; diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result index b44cdb7a0070d..b16beda57525b 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result @@ -25,7 +25,8 @@ show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT USAGE ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT ON `priv_db`.* TO `test_noprivs`@`localhost` -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; no trigger privilege on db level for create: -------------------------------------------- @@ -33,8 +34,8 @@ use priv_db; create trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-no'; ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table `priv_db`.`t1` -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -use priv_db; +connect no_privs,localhost,test_noprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connection no_privs; insert into t1 (f1) values ('insert-yes'); select f1 from t1 order by f1; f1 @@ -272,8 +273,10 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; create User test_noprivs@localhost; set password for test_noprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; +connect no_privs,localhost,test_noprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection no_privs; no trigger privilege on table level for create: ----------------------------------------------- @@ -825,10 +828,8 @@ Grants for test_noprivs@localhost GRANT USAGE ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, INSERT, UPDATE ON `priv1_db`.* TO `test_noprivs`@`localhost` GRANT SELECT, INSERT ON `priv2_db`.* TO `test_noprivs`@`localhost` -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -use priv1_db; -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -use priv1_db; +connect yes_privs,localhost,test_yesprivs,PWD,priv1_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connect no_privs,localhost,test_noprivs,PWD,priv1_db,$MASTER_MYPORT,$MASTER_MYSOCK; trigger privilege on one db1 db level, not on db2 ------------------------------------------------- @@ -1056,7 +1057,8 @@ create User test_useprivs@localhost; set password for test_useprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost; -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; connection default; select current_user; current_user @@ -1086,11 +1088,11 @@ select f1 from t1 order by f1; f1 trig 1_1-yes prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')'; -connect use_privs,localhost,test_useprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect use_privs,localhost,test_useprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connection use_privs; select current_user; current_user test_useprivs@localhost -use priv_db; prepare ins1 from 'insert into t1 (f1) values (''insert3-no'')'; execute ins1; select f1 from t1 order by f1; @@ -1302,7 +1304,8 @@ create table t1 (f1 char(20)) engine= myisam; create User test_yesprivs@localhost; set password for test_yesprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; connection default; select current_user; current_user @@ -1423,8 +1426,10 @@ show grants for test_noprivs@localhost; Grants for test_noprivs@localhost GRANT USAGE ON *.* TO `test_noprivs`@`localhost` IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT SELECT, UPDATE ON `priv_db`.* TO `test_noprivs`@`localhost` -connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection yes_privs; +connect no_privs,localhost,test_noprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection no_privs; update only on column: ---------------------- diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result index ceae360946c0e..c9a15b46aba07 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result @@ -69,8 +69,10 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost; create User test_super@localhost; set password for test_super@localhost = password('PWD'); grant ALL on *.* to test_super@localhost with grant OPTION; -connect con1_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; -connect con1_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect con1_general,localhost,test_general,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection con1_general; +connect con1_super,localhost,test_super,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK; +connection con1_super; connection default; Testcase 3.5.4: diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_08.result b/mysql-test/suite/funcs_1/r/myisam_trig_08.result index c9d6454dc5b2c..c37266bb40c91 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_08.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_08.result @@ -66,6 +66,7 @@ Testcase: 3.5: create User test_general@localhost; set password for test_general@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost; +grant SELECT,UPDATE,DELETE,INSERT on test.* to test_general@localhost; create User test_super@localhost; set password for test_super@localhost = password('PWD'); grant ALL on *.* to test_super@localhost with grant OPTION; diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result index 126bf44f7ebb0..2bba1c0616276 100644 --- a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result +++ b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result @@ -10,6 +10,8 @@ DROP USER ddicttestuser1@'localhost'; DROP USER ddicttestuser2@'localhost'; CREATE USER ddicttestuser1@'localhost'; CREATE USER ddicttestuser2@'localhost'; +GRANT SELECT,UPDATE,DELETE,INSERT,CREATE,CREATE TEMPORARY TABLES,CREATE VIEW,DROP on test.* to ddicttestuser1@'localhost'; +GRANT SELECT,UPDATE,DELETE,INSERT,CREATE,CREATE TEMPORARY TABLES,CREATE VIEW,DROP on test.* to ddicttestuser2@'localhost'; SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass'); SET PASSWORD FOR ddicttestuser2@'localhost' = PASSWORD('ddictpass'); #################################################################################### @@ -152,6 +154,7 @@ ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'in SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` CREATE INDEX i_processlist ON processlist (user); ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' DROP TABLE processlist; @@ -188,6 +191,7 @@ connection con100; SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT PROCESS ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Query TIME starting SHOW processlist TIME_MS @@ -202,6 +206,7 @@ connect con101,localhost,ddicttestuser1,ddictpass,information_schema; SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT PROCESS ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -255,6 +260,7 @@ ddicttestuser1 are visible. SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -298,6 +304,7 @@ Only the processes of ddicttestuser1 user are visible. SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT SUPER ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -325,6 +332,7 @@ Only the processes of ddicttestuser1 are visible. SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -353,6 +361,7 @@ Try to grant PROCESS privilege to user ddicttestuser2 without having it. SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT SUPER ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost'; ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES) #################################################################################### @@ -369,6 +378,7 @@ Grant PROCESS privilege to user ddicttestuser2 SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT PROCESS, SUPER ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost'; #################################################################################### 10.4 New connection con200 (ddicttestuser2 with PROCESS privilege) @@ -378,6 +388,7 @@ ddicttestuser2 has now the PROCESS privilege and sees all connections SHOW GRANTS FOR 'ddicttestuser2'@'localhost'; Grants for ddicttestuser2@localhost GRANT PROCESS ON *.* TO `ddicttestuser2`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser2`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -418,6 +429,7 @@ ddicttestuser2 has no more the PROCESS privilege and can only see own connects SHOW GRANTS; Grants for ddicttestuser2@localhost GRANT USAGE ON *.* TO `ddicttestuser2`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser2`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -441,6 +453,7 @@ He is also unable to GRANT the PROCESS privilege to ddicttestuser2 SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost'; ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES) SHOW processlist; @@ -480,6 +493,7 @@ Therefore the missing SELECT privilege does not affect SELECTs on PROCESSLIST. SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result index 95c706b3f2552..94bc1544c071b 100644 --- a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result +++ b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result @@ -10,6 +10,8 @@ DROP USER ddicttestuser1@'localhost'; DROP USER ddicttestuser2@'localhost'; CREATE USER ddicttestuser1@'localhost'; CREATE USER ddicttestuser2@'localhost'; +GRANT SELECT,UPDATE,DELETE,INSERT,CREATE,CREATE TEMPORARY TABLES,CREATE VIEW,DROP on test.* to ddicttestuser1@'localhost'; +GRANT SELECT,UPDATE,DELETE,INSERT,CREATE,CREATE TEMPORARY TABLES,CREATE VIEW,DROP on test.* to ddicttestuser2@'localhost'; SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass'); SET PASSWORD FOR ddicttestuser2@'localhost' = PASSWORD('ddictpass'); #################################################################################### @@ -152,6 +154,7 @@ ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'in SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` CREATE INDEX i_processlist ON processlist (user); ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' DROP TABLE processlist; @@ -188,6 +191,7 @@ connection con100; SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT PROCESS ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Query TIME starting SHOW processlist TIME_MS @@ -202,6 +206,7 @@ connect con101,localhost,ddicttestuser1,ddictpass,information_schema; SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT PROCESS ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -255,6 +260,7 @@ ddicttestuser1 are visible. SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -298,6 +304,7 @@ Only the processes of ddicttestuser1 user are visible. SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT SUPER ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -325,6 +332,7 @@ Only the processes of ddicttestuser1 are visible. SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -353,6 +361,7 @@ Try to grant PROCESS privilege to user ddicttestuser2 without having it. SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT SUPER ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost'; ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES) #################################################################################### @@ -369,6 +378,7 @@ Grant PROCESS privilege to user ddicttestuser2 SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT PROCESS, SUPER ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost'; #################################################################################### 10.4 New connection con200 (ddicttestuser2 with PROCESS privilege) @@ -378,6 +388,7 @@ ddicttestuser2 has now the PROCESS privilege and sees all connections SHOW GRANTS FOR 'ddicttestuser2'@'localhost'; Grants for ddicttestuser2@localhost GRANT PROCESS ON *.* TO `ddicttestuser2`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser2`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -418,6 +429,7 @@ ddicttestuser2 has no more the PROCESS privilege and can only see own connects SHOW GRANTS; Grants for ddicttestuser2@localhost GRANT USAGE ON *.* TO `ddicttestuser2`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser2`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL TIME_MS @@ -441,6 +453,7 @@ He is also unable to GRANT the PROCESS privilege to ddicttestuser2 SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost'; ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES) SHOW processlist; @@ -480,6 +493,7 @@ Therefore the missing SELECT privilege does not affect SELECTs on PROCESSLIST. SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, CREATE VIEW ON `test`.* TO `ddicttestuser1`@`localhost` SHOW processlist; Id User Host db Command Time State Info Progress ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS diff --git a/mysql-test/suite/funcs_1/t/is_basics_mixed.test b/mysql-test/suite/funcs_1/t/is_basics_mixed.test index bed3f63321249..0fea9dd351cbc 100644 --- a/mysql-test/suite/funcs_1/t/is_basics_mixed.test +++ b/mysql-test/suite/funcs_1/t/is_basics_mixed.test @@ -52,6 +52,7 @@ SELECT DATABASE(); --error 0,ER_CANNOT_USER DROP USER 'testuser1'@'localhost'; CREATE USER 'testuser1'@'localhost'; +GRANT SELECT ON test.* TO 'testuser1'@'localhost'; # Low privileged user --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (testuser1, localhost, testuser1, , test); diff --git a/mysql-test/suite/funcs_1/t/is_check_constraints.test b/mysql-test/suite/funcs_1/t/is_check_constraints.test index 0881b4bdf7724..3ae45e23cb87e 100644 --- a/mysql-test/suite/funcs_1/t/is_check_constraints.test +++ b/mysql-test/suite/funcs_1/t/is_check_constraints.test @@ -77,7 +77,7 @@ CONSTRAINT b1 check (b<123456789012345678901234567890123456789012345678901234567 SELECT * from information_schema.check_constraints; DISCONNECT con1; -CONNECT(con2, localhost, boo2,, test); +CONNECT(con2, localhost, boo2,,"*NO-ONE*"); --sorted_result SELECT * from information_schema.check_constraints; diff --git a/mysql-test/suite/funcs_1/t/is_schema_privileges.test b/mysql-test/suite/funcs_1/t/is_schema_privileges.test index fdf09a6f94bcf..8d0ec916f6f19 100644 --- a/mysql-test/suite/funcs_1/t/is_schema_privileges.test +++ b/mysql-test/suite/funcs_1/t/is_schema_privileges.test @@ -116,7 +116,7 @@ let $show_testuser1 = SHOW GRANTS FOR 'testuser1'@'localhost'; let $show_testuser2 = SHOW GRANTS FOR 'testuser2'@'localhost'; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (testuser1, localhost, testuser1, , test); +connect (testuser1, localhost, testuser1, ,"*NO-ONE*"); GRANT SELECT ON db_datadict_4.* TO 'testuser2'@'localhost'; --echo # Root granted INSERT db_datadict_1 to me -> visible --echo # Root granted SELECT db_datadict_1 to testuser2 -> invisible @@ -132,7 +132,7 @@ eval $show_testuser1; eval $show_testuser2; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (testuser2, localhost, testuser2, , test); +connect (testuser2, localhost, testuser2, ,"*NO-ONE*"); --echo # Root granted SELECT db_datadict_1 to me -> visible --echo # Root granted INSERT db_datadict_1 to testuser1 -> invisible --echo # Root granted INSERT db_datadict_2.t1 but not db_datadict_1 to testuser1 -> invisible diff --git a/mysql-test/suite/funcs_1/t/is_statistics.test b/mysql-test/suite/funcs_1/t/is_statistics.test index 3d7f23a7b2c7a..9f317eee55c4b 100644 --- a/mysql-test/suite/funcs_1/t/is_statistics.test +++ b/mysql-test/suite/funcs_1/t/is_statistics.test @@ -109,6 +109,8 @@ CREATE USER 'testuser1'@'localhost'; --error 0,ER_CANNOT_USER DROP USER 'testuser2'@'localhost'; CREATE USER 'testuser2'@'localhost'; +GRANT ALL ON test.* TO 'testuser1'@'localhost'; +GRANT ALL ON test.* TO 'testuser2'@'localhost'; --replace_result $engine_type eval diff --git a/mysql-test/suite/funcs_1/t/is_user_privileges.test b/mysql-test/suite/funcs_1/t/is_user_privileges.test index 3af56ad2533a6..814e4db97fb10 100644 --- a/mysql-test/suite/funcs_1/t/is_user_privileges.test +++ b/mysql-test/suite/funcs_1/t/is_user_privileges.test @@ -170,7 +170,7 @@ eval $my_select2; eval $my_show; --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (testuser3, localhost, testuser3, , test); +connect (testuser3, localhost, testuser3, ,"*NO-ONE*"); --vertical_results eval $my_select1; --error ER_TABLEACCESS_DENIED_ERROR diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03.inc b/mysql-test/suite/funcs_1/triggers/triggers_03.inc index f48d1979f77f5..c16737afab3c4 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_03.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_03.inc @@ -205,7 +205,7 @@ let $message= Testcase 3.5.3.7b:; grant UPDATE on priv_db.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; - connect (no_privs_424b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (no_privs_424b,localhost,test_noprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK); connect (yes_privs_424b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection default; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_columns.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_columns.inc index 2f0ad2c1cccb5..3b2ffc57aa3ec 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_03e_columns.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_columns.inc @@ -36,9 +36,13 @@ let $message= ####### Testcase for column privileges of triggers: #######; grant SELECT,UPDATE on priv_db.* to test_noprivs@localhost; show grants for test_noprivs@localhost; - connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection yes_privs; - connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (no_privs,localhost,test_noprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection no_privs; # grant TRIGGER and UPDATE on column -> succeed diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc index 9e6d8598e6fd2..1170bb7811df9 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_db_level.inc @@ -37,7 +37,9 @@ let $message= Testcase for db level:; show grants for test_noprivs@localhost; # no trigger privilege->create trigger must fail: - connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (yes_privs,localhost,test_yesprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection yes_privs; let $message= no trigger privilege on db level for create:; --source include/show_msg.inc use priv_db; @@ -46,8 +48,9 @@ let $message= no trigger privilege on db level for create:; set new.f1 = 'trig 1_1-no'; # user with minimum privs on t1->no trigger executed; - connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - use priv_db; + connect (no_privs,localhost,test_noprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection no_privs; insert into t1 (f1) values ('insert-yes'); select f1 from t1 order by f1; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_db_table_mix.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_db_table_mix.inc index e56a5972ce611..6566cd6fd4e6a 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_03e_db_table_mix.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_db_table_mix.inc @@ -41,10 +41,8 @@ let $message= ####### Testcase for mix of db and table level: #######; grant SELECT,INSERT on priv2_db.* to test_noprivs@localhost; show grants for test_noprivs@localhost; - connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - use priv1_db; - connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - use priv1_db; + connect (yes_privs,localhost,test_yesprivs,PWD,priv1_db,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (no_privs,localhost,test_noprivs,PWD,priv1_db,$MASTER_MYPORT,$MASTER_MYSOCK); # trigger priv on db level->create trigger for all tables successful diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_definer.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_definer.inc index 9988e1cafc2e3..8e3dff9b01893 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_03e_definer.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_definer.inc @@ -27,7 +27,9 @@ let $message= ######### Testcase for definer: ########; revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection yes_privs; # create trigger with not existing definer shall deliver a warning: connection default; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_prepare.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_prepare.inc index e2efa5774fa7a..6479439467a58 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_03e_prepare.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_prepare.inc @@ -32,7 +32,9 @@ let $message= #### Testcase for trigger privilege on execution time ########; revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost; - connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection yes_privs; connection default; select current_user; @@ -56,9 +58,10 @@ let $message= #### Testcase for trigger privilege on execution time ########; select f1 from t1 order by f1; prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')'; - connect (use_privs,localhost,test_useprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (use_privs,localhost,test_useprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection use_privs; select current_user; - use priv_db; prepare ins1 from 'insert into t1 (f1) values (''insert3-no'')'; execute ins1; select f1 from t1 order by f1; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_table_level.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_table_level.inc index bd6bee9bcf200..bc73511a2ea4d 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_03e_table_level.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_table_level.inc @@ -30,9 +30,13 @@ let $message= ######### Testcase for table level: ########; set password for test_noprivs@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost; - connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (yes_privs,localhost,test_yesprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection yes_privs; - connect (no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (no_privs,localhost,test_noprivs,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection no_privs; ################ Section 3.5.3 ############ # Check for the table level of Triggers # diff --git a/mysql-test/suite/funcs_1/triggers/triggers_03e_transaction.inc b/mysql-test/suite/funcs_1/triggers/triggers_03e_transaction.inc index 2f72ba64bfd1c..35c0ec76eba9e 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_03e_transaction.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_03e_transaction.inc @@ -27,7 +27,6 @@ let $message= ######### Testcase for transactions: ########; revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; - connect (yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); connection default; select current_user; @@ -35,9 +34,9 @@ let $message= ######### Testcase for transactions: ########; on priv_db.t1 to test_yesprivs@localhost; show grants for test_yesprivs@localhost; + connect (yes_privs,localhost,test_yesprivs,PWD,priv_db,$MASTER_MYPORT,$MASTER_MYSOCK); connection yes_privs; select current_user; - use priv_db; set autocommit=0; create definer=current_user trigger trg1_1 before INSERT on t1 for each row diff --git a/mysql-test/suite/funcs_1/triggers/triggers_0407.inc b/mysql-test/suite/funcs_1/triggers/triggers_0407.inc index 71471696761aa..812811561504d 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_0407.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_0407.inc @@ -23,8 +23,12 @@ let $message= Testcase: 3.5:; create User test_super@localhost; set password for test_super@localhost = password('PWD'); grant ALL on *.* to test_super@localhost with grant OPTION; - connect (con1_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); - connect (con1_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK); + connect (con1_general,localhost,test_general,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection con1_general; + connect (con1_super,localhost,test_super,PWD,"*NO-ONE*",$MASTER_MYPORT,$MASTER_MYSOCK); +# next is to check that we connected above + connection con1_super; connection default; #################################### diff --git a/mysql-test/suite/funcs_1/triggers/triggers_08.inc b/mysql-test/suite/funcs_1/triggers/triggers_08.inc index 0aeb46896a64d..7169f160fb855 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_08.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_08.inc @@ -20,6 +20,7 @@ let $message= Testcase: 3.5:; create User test_general@localhost; set password for test_general@localhost = password('PWD'); revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost; + grant SELECT,UPDATE,DELETE,INSERT on test.* to test_general@localhost; create User test_super@localhost; set password for test_super@localhost = password('PWD'); diff --git a/mysql-test/suite/galera/r/galera_create_procedure.result b/mysql-test/suite/galera/r/galera_create_procedure.result index 24a0bd66b3971..27bdf19f25643 100644 --- a/mysql-test/suite/galera/r/galera_create_procedure.result +++ b/mysql-test/suite/galera/r/galera_create_procedure.result @@ -2,6 +2,7 @@ connection node_2; connection node_1; connection node_1; CREATE USER 'user1'; +GRANT ALL ON test.* to 'user1'; CREATE TABLE t1 (f1 INTEGER); CREATE DEFINER = 'user1' diff --git a/mysql-test/suite/galera/r/galera_create_trigger.result b/mysql-test/suite/galera/r/galera_create_trigger.result index 56b35150d877f..4244e4c85adff 100644 --- a/mysql-test/suite/galera/r/galera_create_trigger.result +++ b/mysql-test/suite/galera/r/galera_create_trigger.result @@ -5,6 +5,7 @@ CREATE TABLE definer_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; CREATE TABLE definer_current_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; CREATE TABLE definer_default (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; CREATE USER 'user1'; +GRANT ALL ON test.* to 'user1'; CREATE DEFINER=root@localhost TRIGGER definer_root BEFORE INSERT ON definer_root FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); CREATE DEFINER=user1 TRIGGER definer_user BEFORE INSERT ON definer_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); CREATE DEFINER=current_user TRIGGER definer_current_user BEFORE INSERT ON definer_current_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); diff --git a/mysql-test/suite/galera/r/galera_gra_log.result b/mysql-test/suite/galera/r/galera_gra_log.result index 4146192bb551a..8f85a838c5d6e 100644 --- a/mysql-test/suite/galera/r/galera_gra_log.result +++ b/mysql-test/suite/galera/r/galera_gra_log.result @@ -10,7 +10,7 @@ connection node_1; CREATE TABLE t1 (f1 INTEGER); connection node_2; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -18,7 +18,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=/*!*/; SET @@session.pseudo_thread_id=/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/galera/r/galera_read_only.result b/mysql-test/suite/galera/r/galera_read_only.result index e7e18ca814594..0928c62f23b39 100644 --- a/mysql-test/suite/galera/r/galera_read_only.result +++ b/mysql-test/suite/galera/r/galera_read_only.result @@ -10,6 +10,7 @@ SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 CREATE USER foo@localhost; +GRANT ALL ON test.* to foo@localhost; # Open connection to node 2 using 'foo' user. connect foo_node_2,127.0.0.1,foo,,test,$port_2,; diff --git a/mysql-test/suite/galera/r/galera_roles.result b/mysql-test/suite/galera/r/galera_roles.result index 19bc9be62b068..fccef1637f657 100644 --- a/mysql-test/suite/galera/r/galera_roles.result +++ b/mysql-test/suite/galera/r/galera_roles.result @@ -21,8 +21,8 @@ GRANT EXECUTE ON PROCEDURE test1.pr1 TO role1; GRANT SELECT ON test1.t1 TO role1; GRANT SELECT (a) ON test1.t2 TO role1; # Open connections to the 2 nodes using 'foo' user. -connect foo_node_1,127.0.0.1,foo,,test,$port_1,; -connect foo_node_2,127.0.0.1,foo,,test,$port_2,; +connect foo_node_1,127.0.0.1,foo,,"*NO-ONE*",$port_1,; +connect foo_node_2,127.0.0.1,foo,,"*NO-ONE*",$port_2,; # Connect with foo_node_1 connection foo_node_1; diff --git a/mysql-test/suite/galera/t/galera_create_procedure.test b/mysql-test/suite/galera/t/galera_create_procedure.test index 30bc85fcea0bd..4947a446e9eb9 100644 --- a/mysql-test/suite/galera/t/galera_create_procedure.test +++ b/mysql-test/suite/galera/t/galera_create_procedure.test @@ -7,6 +7,7 @@ --connection node_1 CREATE USER 'user1'; +GRANT ALL ON test.* to 'user1'; CREATE TABLE t1 (f1 INTEGER); CREATE diff --git a/mysql-test/suite/galera/t/galera_create_trigger.test b/mysql-test/suite/galera/t/galera_create_trigger.test index 6708e30bf0f3d..c76981aae2937 100644 --- a/mysql-test/suite/galera/t/galera_create_trigger.test +++ b/mysql-test/suite/galera/t/galera_create_trigger.test @@ -11,6 +11,7 @@ CREATE TABLE definer_current_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE CREATE TABLE definer_default (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB; CREATE USER 'user1'; +GRANT ALL ON test.* to 'user1'; CREATE DEFINER=root@localhost TRIGGER definer_root BEFORE INSERT ON definer_root FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); CREATE DEFINER=user1 TRIGGER definer_user BEFORE INSERT ON definer_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); CREATE DEFINER=current_user TRIGGER definer_current_user BEFORE INSERT ON definer_current_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER(); diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf index 691e52208b1da..3d43138f3c771 100644 --- a/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf @@ -3,7 +3,6 @@ [mysqld.1] # server-id=101 #wsrep-debug=1 -innodb_file_per_table innodb_autoinc_lock_mode=2 #wsrep_sst_method=rsync wsrep_sst_method=mariabackup @@ -20,7 +19,6 @@ log_bin=binlog [mysqld.2] # server-id=102 #wsrep-debug=1 -innodb_file_per_table innodb_autoinc_lock_mode=2 #wsrep_sst_method=rsync wsrep_sst_method=mariabackup diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf index 3835cd02a414b..6fc6e3421cbf0 100644 --- a/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf @@ -3,7 +3,6 @@ [mysqld.1] # server-id=101 #wsrep-debug=1 -innodb_file_per_table innodb_autoinc_lock_mode=2 wsrep_sst_method=rsync #wsrep_sst_method=mariabackup @@ -20,7 +19,6 @@ log_bin=binlog [mysqld.2] # server-id=102 #wsrep-debug=1 -innodb_file_per_table innodb_autoinc_lock_mode=2 wsrep_sst_method=rsync #wsrep_sst_method=mariabackup diff --git a/mysql-test/suite/galera/t/galera_load_data.cnf b/mysql-test/suite/galera/t/galera_load_data.cnf index 43cc352c020a9..3385fbac1f61d 100644 --- a/mysql-test/suite/galera/t/galera_load_data.cnf +++ b/mysql-test/suite/galera/t/galera_load_data.cnf @@ -2,7 +2,6 @@ [mysqld.1] secure-file-priv = "" -innodb_file_per_table = ON innodb_stats_persistent=ON innodb_stats_auto_recalc=ON innodb_stats_persistent_sample_pages=20 @@ -11,7 +10,6 @@ skip-innodb-read-only-compressed [mysqld.2] secure-file-priv = "" -innodb_file_per_table = ON innodb_stats_persistent=ON innodb_stats_auto_recalc=ON innodb_stats_persistent_sample_pages=20 diff --git a/mysql-test/suite/galera/t/galera_read_only.test b/mysql-test/suite/galera/t/galera_read_only.test index 56fe2fdd91001..8d8a8cf88aa03 100644 --- a/mysql-test/suite/galera/t/galera_read_only.test +++ b/mysql-test/suite/galera/t/galera_read_only.test @@ -18,6 +18,7 @@ INSERT INTO t1 VALUES (1); SELECT COUNT(*) = 1 FROM t1; CREATE USER foo@localhost; +GRANT ALL ON test.* to foo@localhost; --echo # Open connection to node 2 using 'foo' user. --let $port_2= \$NODE_MYPORT_2 diff --git a/mysql-test/suite/galera/t/galera_roles.test b/mysql-test/suite/galera/t/galera_roles.test index 3005562db9c7e..e71ca42f2d8ba 100644 --- a/mysql-test/suite/galera/t/galera_roles.test +++ b/mysql-test/suite/galera/t/galera_roles.test @@ -33,11 +33,11 @@ GRANT SELECT (a) ON test1.t2 TO role1; --echo # Open connections to the 2 nodes using 'foo' user. --let $port_1= \$NODE_MYPORT_1 ---connect(foo_node_1,127.0.0.1,foo,,test,$port_1,) +--connect(foo_node_1,127.0.0.1,foo,,"*NO-ONE*",$port_1,) --let $port_2= \$NODE_MYPORT_2 --sleep 1 ---connect(foo_node_2,127.0.0.1,foo,,test,$port_2,) +--connect(foo_node_2,127.0.0.1,foo,,"*NO-ONE*",$port_2,) --echo --echo # Connect with foo_node_1 diff --git a/mysql-test/suite/galera/t/galera_sst_encrypted.cnf b/mysql-test/suite/galera/t/galera_sst_encrypted.cnf index e10c3e9f21529..596bb95ac6a82 100644 --- a/mysql-test/suite/galera/t/galera_sst_encrypted.cnf +++ b/mysql-test/suite/galera/t/galera_sst_encrypted.cnf @@ -7,7 +7,6 @@ loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt loose-file-key-management-encryption-algorithm=aes_cbc wsrep-debug=1 innodb_encryption_threads = 4 -innodb_file_per_table=1 wsrep_sst_method=rsync [mysqld.1] diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf index d3fff4fcb0b2c..857a410140655 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf @@ -4,7 +4,6 @@ wsrep_sst_method=mariabackup wsrep_sst_auth="root:" wsrep_debug=1 -innodb-file-per-table=ON [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' diff --git a/mysql-test/suite/innodb/include/have_undo_tablespaces.inc b/mysql-test/suite/innodb/include/have_undo_tablespaces.inc deleted file mode 100644 index 87830a4a5f0dd..0000000000000 --- a/mysql-test/suite/innodb/include/have_undo_tablespaces.inc +++ /dev/null @@ -1,4 +0,0 @@ -if (`select count(*) = 0 from information_schema.global_variables where variable_name like 'innodb_undo_tablespaces' and variable_value >= 2`) -{ - --skip Test requires InnoDB with at-least 2 undo tablespaces. -} diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc index 3c10517933f0e..438b7b17d51d0 100644 --- a/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc +++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc @@ -35,8 +35,6 @@ if ($row_format != 'COMPRESSED') if ($row_format == 'COMPRESSED') { - SET GLOBAL innodb_file_per_table=1; - eval CREATE TABLE t1( class INT, id INT, @@ -176,10 +174,4 @@ SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; DROP TABLE t1; -# Restore global variables -if ($row_format == 'COMPRESSED') -{ - SET GLOBAL innodb_file_per_table=default; -} - DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc index 85466e5e4ae3c..dbdadd0b7f9c8 100644 --- a/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc +++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc @@ -38,8 +38,6 @@ if ($row_format != 'COMPRESSED') if ($row_format == 'COMPRESSED') { - SET GLOBAL innodb_file_per_table=1; - eval CREATE TABLE t1( class INT, id INT, @@ -69,8 +67,6 @@ if ($row_format != 'COMPRESSED') { } if ($row_format == 'COMPRESSED') { - SET GLOBAL innodb_file_per_table=1; - eval CREATE TABLE t1( a INT PRIMARY KEY, b TEXT, @@ -124,8 +120,6 @@ if ($row_format != 'COMPRESSED') if ($row_format == 'COMPRESSED') { - SET GLOBAL innodb_file_per_table=1; - eval CREATE TABLE t1( class INT, id INT, @@ -174,8 +168,6 @@ if ($row_format != 'COMPRESSED') { } if ($row_format == 'COMPRESSED') { - SET GLOBAL innodb_file_per_table=1; - eval CREATE TABLE t1( a INT PRIMARY KEY, b TEXT, diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc index 8c60cd6e23024..68f34978f2346 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc @@ -1,6 +1,6 @@ # # Test to cause merge of the pages (by deleting) -# test/tab1 should be created already with innodb_file_per_table=ON +# test/tab1 should be created already # The definition is intended to be based on # "create table tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB;" # diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc index 8e821365e3f81..d49272c4087e0 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc @@ -1,6 +1,6 @@ # # Test to cause merge of the pages (at secondary index by deleting) -# test/tab1 should be created already with innodb_file_per_table=ON +# test/tab1 should be created already # The definition is intended to be based on # "create table tab1 (a bigint primary key, b blob) engine=InnoDB row_format=dynamic;" # "create index index1 on tab1(b(750));" diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc index 61e961ac6ae13..ae720e0488d05 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc @@ -1,6 +1,6 @@ # # Test to cause merge of the pages (by updating to smaller) -# test/tab1 should be created already with innodb_file_per_table=ON +# test/tab1 should be created already # The definition is intended to be based on # "create table tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB;" # diff --git a/mysql-test/suite/innodb/r/alter_kill.result b/mysql-test/suite/innodb/r/alter_kill.result index 0283d1079e188..037b06fffbcdb 100644 --- a/mysql-test/suite/innodb/r/alter_kill.result +++ b/mysql-test/suite/innodb/r/alter_kill.result @@ -1,7 +1,6 @@ # # Bug#16720368 INNODB CRASHES ON BROKEN #SQL*.IBD FILE AT STARTUP # -SET GLOBAL innodb_file_per_table=1; SET GLOBAL innodb_purge_rseg_truncate_frequency=1; CREATE TABLE bug16720368_1 (a INT PRIMARY KEY) ENGINE=InnoDB; connect con1,localhost,root; @@ -30,7 +29,6 @@ DROP TABLE bug16720368, bug16720368_1; # Bug#16735660 ASSERT TABLE2 == NULL, ROLLBACK OF RESURRECTED TXNS, # DICT_TABLE_ADD_TO_CACHE # -SET GLOBAL innodb_file_per_table=1; CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; BEGIN; INSERT INTO t1 VALUES(42); diff --git a/mysql-test/suite/innodb/r/alter_missing_tablespace.result b/mysql-test/suite/innodb/r/alter_missing_tablespace.result index 3d07158425600..65b01d89d91ce 100644 --- a/mysql-test/suite/innodb/r/alter_missing_tablespace.result +++ b/mysql-test/suite/innodb/r/alter_missing_tablespace.result @@ -2,7 +2,6 @@ # Bug#13955083 ALLOW IN-PLACE DDL OPERATIONS ON MISSING # OR DISCARDED TABLESPACES # -SET GLOBAL innodb_file_per_table=1; CREATE TABLE t(a SERIAL)ENGINE=InnoDB; CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; CREATE TABLE t1(a SERIAL)ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/r/alter_rename_existing.result b/mysql-test/suite/innodb/r/alter_rename_existing.result index 1fdc2011a24de..e4fee34196498 100644 --- a/mysql-test/suite/innodb/r/alter_rename_existing.result +++ b/mysql-test/suite/innodb/r/alter_rename_existing.result @@ -36,6 +36,8 @@ ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 " # Create another t1, but in the system tablespace. # SET GLOBAL innodb_file_per_table=OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t1 (a SERIAL, b CHAR(20)) ENGINE=InnoDB; INSERT INTO t1(b) VALUES('one'), ('two'), ('three'); SHOW CREATE TABLE t1; @@ -58,6 +60,8 @@ ALTER TABLE t1 ADD COLUMN d INT, ALGORITHM=COPY; # while a blocking t1.ibd file exists. # SET GLOBAL innodb_file_per_table=ON; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; ERROR HY000: Tablespace for table 'test/#sql-ib' exists. Please DISCARD the tablespace before IMPORT ALTER TABLE t1 FORCE, ALGORITHM=COPY; @@ -93,3 +97,5 @@ a b 2 two 3 three DROP TABLE t1; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release diff --git a/mysql-test/suite/innodb/r/dropdb_cs.result b/mysql-test/suite/innodb/r/dropdb_cs.result index 59f02c74a049d..3837bf9e3f51c 100644 --- a/mysql-test/suite/innodb/r/dropdb_cs.result +++ b/mysql-test/suite/innodb/r/dropdb_cs.result @@ -3,6 +3,8 @@ # SET @save_fpt=@@GLOBAL.innodb_file_per_table; SET GLOBAL innodb_file_per_table=0; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE DATABASE Db; CREATE TABLE Db.t1 (c1 INT KEY) ENGINE=InnoDB; CREATE DATABASE DB; @@ -14,3 +16,5 @@ DROP DATABASE Db; SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'D%'; TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE SET GLOBAL innodb_file_per_table=@save_fpt; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release diff --git a/mysql-test/suite/innodb/r/ibuf_delete.result b/mysql-test/suite/innodb/r/ibuf_delete.result deleted file mode 100644 index 7423d3cfa3e16..0000000000000 --- a/mysql-test/suite/innodb/r/ibuf_delete.result +++ /dev/null @@ -1,53 +0,0 @@ -SET @buffering= @@innodb_change_buffering; -SET GLOBAL innodb_change_buffering= deletes; -Warnings: -Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release -SET @flush= @@innodb_flush_log_at_trx_commit; -SET GLOBAL innodb_flush_log_at_trx_commit= 0; -CREATE TABLE t1 ( -a varchar(1024), -b varchar(1024), -c varchar(1024), -d varchar(1024), -e varchar(1024), -f varchar(1024), -g varchar(1024), -h varchar(1024), -key (a), -key (b), -key (c), -key (d) -) ENGINE=InnoDB; -INSERT INTO t1 -SELECT REPEAT('x',10), REPEAT('x',13), REPEAT('x',427), REPEAT('x',244), -REPEAT('x',9), REPEAT('x',112), REPEAT('x',814), REPEAT('x',633) -FROM seq_1_to_1024; -CREATE TEMPORARY TABLE t2 ( -a varchar(1024), -b varchar(1024), -c varchar(1024), -d varchar(1024), -e varchar(1024), -f varchar(1024), -g varchar(1024), -h varchar(1024), -i varchar(1024), -j varchar(1024), -k varchar(1024), -l varchar(1024), -m varchar(1024), -key (a), -key (b), -key (c), -key (d), -key (e), -key (f) -) ENGINE=InnoDB; -SET @x=REPEAT('x',512); -INSERT INTO t2 SELECT @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x -FROM seq_1_to_768; -DROP TABLE t1, t2; -SET GLOBAL innodb_change_buffering= @buffering; -Warnings: -Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release -SET GLOBAL innodb_flush_log_at_trx_commit= @flush; diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result deleted file mode 100644 index 1dc7f0324d316..0000000000000 --- a/mysql-test/suite/innodb/r/ibuf_not_empty.result +++ /dev/null @@ -1,20 +0,0 @@ -CREATE TABLE t1( -a INT AUTO_INCREMENT PRIMARY KEY, -b CHAR(1), -c INT, -INDEX(b)) -ENGINE=InnoDB STATS_PERSISTENT=0; -SET GLOBAL innodb_change_buffering_debug = 1; -SET GLOBAL innodb_change_buffering=all; -Warnings: -Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release -INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_1024; -# restart: --innodb-force-recovery=6 --innodb-change-buffer-dump -check table t1; -Table Op Msg_type Msg_text -test.t1 check Warning InnoDB: Index 'b' contains 990 entries, should be 1024. -test.t1 check error Corrupt -# restart: --innodb-force_recovery=0 -SET GLOBAL innodb_fast_shutdown=0; -# restart: --innodb-force_recovery=0 -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/index_tree_operation.result b/mysql-test/suite/innodb/r/index_tree_operation.result index 29660962e0c0b..92565333a9359 100644 --- a/mysql-test/suite/innodb/r/index_tree_operation.result +++ b/mysql-test/suite/innodb/r/index_tree_operation.result @@ -2,7 +2,6 @@ # Bug#15923864 (Bug#67718): # INNODB DRASTICALLY UNDER-FILLS PAGES IN CERTAIN CONDITIONS # -SET GLOBAL innodb_file_per_table=ON; CREATE TABLE t1 (a BIGINT PRIMARY KEY, b VARCHAR(4096)) ENGINE=InnoDB; INSERT INTO t1 VALUES (0, REPEAT('a', 4096)); INSERT INTO t1 VALUES (1000, REPEAT('a', 4096)); diff --git a/mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result b/mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result deleted file mode 100644 index 42fdf680f2e84..0000000000000 --- a/mysql-test/suite/innodb/r/innodb-change-buffer-recovery.result +++ /dev/null @@ -1,51 +0,0 @@ -# -# Bug#69122 - INNODB DOESN'T REDO-LOG INSERT BUFFER MERGE -# OPERATION IF IT IS DONE IN-PLACE -# -call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery"); -call mtr.add_suppression("Plugin initialization aborted at srv0start\\.cc"); -call mtr.add_suppression("Plugin 'InnoDB'"); -FLUSH TABLES; -CREATE TABLE t1( -a INT AUTO_INCREMENT PRIMARY KEY, -b CHAR(1), -c INT, -INDEX(b)) -ENGINE=InnoDB STATS_PERSISTENT=0; -SET GLOBAL innodb_change_buffering_debug = 1; -SET GLOBAL innodb_change_buffering = all; -Warnings: -Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release -INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_8192; -BEGIN; -SELECT b FROM t1 LIMIT 3; -b -x -x -x -connect con1,localhost,root,,; -BEGIN; -DELETE FROM t1 WHERE a=1; -INSERT INTO t1 VALUES(1,'X',1); -SET DEBUG_DBUG='+d,crash_after_log_ibuf_upd_inplace'; -SELECT b FROM t1 LIMIT 3; -ERROR HY000: Lost connection to server during query -disconnect con1; -connection default; -FOUND 1 /Wrote log record for ibuf update in place operation/ in mysqld.1.err -# restart: --innodb-read-only -CHECK TABLE t1; -Table Op Msg_type Msg_text -test.t1 check Error Unknown storage engine 'InnoDB' -test.t1 check error Corrupt -FOUND 1 /innodb_read_only prevents crash recovery/ in mysqld.1.err -# restart: --innodb-force-recovery=5 --debug-dbug=d,crash_after_log_ibuf_upd_inplace -SELECT * FROM t1 LIMIT 1; -a b c -1 X 1 -SET GLOBAL innodb_fast_shutdown=0; -# restart -CHECK TABLE t1; -Table Op Msg_type Msg_text -test.t1 check status OK -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-fkcheck.result b/mysql-test/suite/innodb/r/innodb-fkcheck.result index f86ba50597fac..357d8aa11c12d 100644 --- a/mysql-test/suite/innodb/r/innodb-fkcheck.result +++ b/mysql-test/suite/innodb/r/innodb-fkcheck.result @@ -1,6 +1,3 @@ -set global innodb_file_per_table = 1; -drop table if exists b; -drop database if exists bug_fk; create database bug_fk; use bug_fk; CREATE TABLE b ( @@ -93,5 +90,5 @@ show warnings; Level Code Message b.frm b.ibd -drop table if exists b; -drop database if exists bug_fk; +drop table b; +drop database bug_fk; diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result index 7138c5d7a1830..6404a3812b3c5 100644 --- a/mysql-test/suite/innodb/r/innodb-index-online.result +++ b/mysql-test/suite/innodb/r/innodb-index-online.result @@ -1,6 +1,4 @@ call mtr.add_suppression("InnoDB: Warning: Small buffer pool size"); -SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table; -SET GLOBAL innodb_file_per_table = on; CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, c3 TEXT) ENGINE=InnoDB STATS_PERSISTENT=0; INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,''); @@ -540,6 +538,5 @@ Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; SET DEBUG_SYNC = 'RESET'; -SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; SET GLOBAL innodb_monitor_enable = default; SET GLOBAL innodb_monitor_disable = default; diff --git a/mysql-test/suite/innodb/r/innodb-system-table-view.result b/mysql-test/suite/innodb/r/innodb-system-table-view.result index 580ed08e42460..5be25e62ae2e2 100644 --- a/mysql-test/suite/innodb/r/innodb-system-table-view.result +++ b/mysql-test/suite/innodb/r/innodb-system-table-view.result @@ -10,7 +10,7 @@ TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE 11 SYS_FOREIGN 0 7 0 Redundant 0 System 12 SYS_FOREIGN_COLS 0 7 0 Redundant 0 System 13 SYS_VIRTUAL 0 6 0 Redundant 0 System -16 mysql/transaction_registry 33 8 3 Dynamic 0 Single +16 mysql/transaction_registry 33 8 6 Dynamic 0 Single SELECT table_id,pos,mtype,prtype,len,name FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE table_id NOT IN (@table_stats_id, @index_stats_id) diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result index 5a8b3d24d757d..8ac0d4d41fab2 100644 --- a/mysql-test/suite/innodb/r/innodb-table-online.result +++ b/mysql-test/suite/innodb/r/innodb-table-online.result @@ -1,8 +1,6 @@ call mtr.add_suppression("InnoDB: Warning: Small buffer pool size"); call mtr.add_suppression("InnoDB: Error: table 'test/t1'"); call mtr.add_suppression("MariaDB is trying to open a table handle but the .ibd file for"); -SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table; -SET GLOBAL innodb_file_per_table = on; CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 CHAR(255) NOT NULL) ENGINE = InnoDB; INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,''); @@ -472,6 +470,5 @@ DROP TABLE t1; connection default; SET DEBUG_SYNC=RESET; disconnect con1; -SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; SET GLOBAL innodb_monitor_enable = default; SET GLOBAL innodb_monitor_disable = default; diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result index e7af2d9469ed6..1c3b10c05974e 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result @@ -12,21 +12,18 @@ call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*ibdata1' page"); call mtr.add_suppression("InnoDB: File '.*ibdata1' is corrupted"); FLUSH TABLES; -SET GLOBAL innodb_file_per_table = 1; CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; INSERT INTO t1 VALUES(1),(2),(3); SET SESSION debug_dbug="+d,ib_discard_before_commit_crash"; ALTER TABLE t1 DISCARD TABLESPACE; ERROR HY000: Lost connection to server during query DROP TABLE t1; -SET GLOBAL innodb_file_per_table = 1; CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; INSERT INTO t1 VALUES(1),(2),(3); SET SESSION debug_dbug="+d,ib_discard_after_commit_crash"; ALTER TABLE t1 DISCARD TABLESPACE; ERROR HY000: Lost connection to server during query DROP TABLE t1; -SET GLOBAL innodb_file_per_table = 1; CREATE TABLE t1 (c1 INT) ENGINE = Innodb; INSERT INTO t1 VALUES (1), (2), (3), (4); FLUSH TABLES t1 FOR EXPORT; @@ -52,8 +49,6 @@ ERROR HY000: Lost connection to server during query unlink: t1.ibd unlink: t1.cfg DROP TABLE t1; -SET @file_per_table= @@innodb_file_per_table; -SET GLOBAL innodb_file_per_table = 1; CREATE TABLE t1 (c1 INT) ENGINE = Innodb; ALTER TABLE t1 DISCARD TABLESPACE; restore: t1 .ibd and .cfg files @@ -459,11 +454,6 @@ ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Got error 42 '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_check_bitmap_failure"; -ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Index for table 't1' is corrupt; try to repair it -SET SESSION debug_dbug=@saved_debug_dbug; -restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it @@ -943,4 +933,3 @@ SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; unlink: t1.ibd unlink: t1.cfg -SET GLOBAL INNODB_FILE_PER_TABLE=@file_per_table; diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result index 7bcc57c5bd59d..819ca949c8832 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522.result @@ -120,7 +120,6 @@ ALTER TABLE t2 IMPORT TABLESPACE; Warnings: Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t2.cfg', will attempt to import without schema verification DROP TABLE t2; -SET GLOBAL innodb_file_per_table = 1; SELECT @@innodb_file_per_table; @@innodb_file_per_table 1 @@ -285,6 +284,8 @@ c1 c2 unlink: t1.cfg DROP TABLE t1; SET GLOBAL innodb_file_per_table = 0; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; @@ -302,6 +303,8 @@ Warning 1809 Table `test`.`t1` in system tablespace UNLOCK TABLES; DROP TABLE t1; SET GLOBAL innodb_file_per_table = 1; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/r/innodb-wl5980-alter.result b/mysql-test/suite/innodb/r/innodb-wl5980-alter.result index 4d6ac474da882..84f3d7811c21b 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5980-alter.result +++ b/mysql-test/suite/innodb/r/innodb-wl5980-alter.result @@ -2,9 +2,7 @@ # This is a copy of innodb-alter.test except using remote tablespaces # and showing those files. # -SET @innodb_file_per_table_orig=@@GLOBAL.innodb_file_per_table; SET default_storage_engine=InnoDB; -SET GLOBAL innodb_file_per_table=ON; SET NAMES utf8mb4; CREATE TABLE t1 ( c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, @@ -1589,4 +1587,3 @@ DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign; ### files in MYSQL_DATA_DIR/test db.opt ### files in MYSQL_TMP_DIR/alt_dir/test -SET GLOBAL innodb_file_per_table = @innodb_file_per_table_orig; diff --git a/mysql-test/suite/innodb/r/innodb_bug14147491.result b/mysql-test/suite/innodb/r/innodb_bug14147491.result index 533eaeafeb8aa..b33b7f0d587d3 100644 --- a/mysql-test/suite/innodb/r/innodb_bug14147491.result +++ b/mysql-test/suite/innodb/r/innodb_bug14147491.result @@ -2,7 +2,6 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; SET GLOBAL innodb_fast_shutdown=0; # Create and populate the table to be corrupted -set global innodb_file_per_table=ON; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB; INSERT INTO t1 (b) VALUES ('corrupt me'); INSERT INTO t1 (b) VALUES ('corrupt me'); diff --git a/mysql-test/suite/innodb/r/innodb_bug56947.result b/mysql-test/suite/innodb/r/innodb_bug56947.result index aa922776f7bd9..a4ed3bfcfaadb 100644 --- a/mysql-test/suite/innodb/r/innodb_bug56947.result +++ b/mysql-test/suite/innodb/r/innodb_bug56947.result @@ -1,4 +1,7 @@ -SET GLOBAL innodb_file_per_table=0; +SET @save_fpt=@@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release create table bug56947(a int not null) engine = innodb; SET @saved_dbug = @@SESSION.debug_dbug; SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename'; @@ -8,5 +11,7 @@ check table bug56947; Table Op Msg_type Msg_text test.bug56947 check status OK drop table bug56947; -SET @@global.innodb_file_per_table=DEFAULT; +SET GLOBAL innodb_file_per_table=@save_fpt; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/r/innodb_bug59733.result b/mysql-test/suite/innodb/r/innodb_bug59733.result deleted file mode 100644 index c962cdfd67779..0000000000000 --- a/mysql-test/suite/innodb/r/innodb_bug59733.result +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE bug59733(a INT AUTO_INCREMENT PRIMARY KEY,b CHAR(1))ENGINE=InnoDB; -INSERT INTO bug59733 VALUES(0,'x'); -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -CREATE INDEX b ON bug59733 (b); -DELETE FROM bug59733 WHERE (a%100)=0; -DROP INDEX b ON bug59733; -CREATE INDEX b ON bug59733 (b); -DROP TABLE bug59733; diff --git a/mysql-test/suite/innodb/r/innodb_bug68148.result b/mysql-test/suite/innodb/r/innodb_bug68148.result index 25bf7f58eb97a..1c79f881befc9 100644 --- a/mysql-test/suite/innodb/r/innodb_bug68148.result +++ b/mysql-test/suite/innodb/r/innodb_bug68148.result @@ -1,4 +1,3 @@ -set global innodb_file_per_table=1; CREATE TABLE ref_table1 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; CREATE TABLE ref_table2 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; CREATE TABLE `main` ( diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result index ec7ce044cb794..060e9008f3fdf 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result @@ -532,7 +532,6 @@ END| SELECT @@innodb_fill_factor; @@innodb_fill_factor 100 -SET GLOBAL innodb_file_per_table=1; CREATE TABLE t1( class INT, id INT, @@ -686,7 +685,6 @@ test.t1 check status OK SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; CHAR_LENGTH(b) DROP TABLE t1; -SET GLOBAL innodb_file_per_table=default; DROP PROCEDURE populate_t1; SET GLOBAL innodb_fill_factor=10; CREATE PROCEDURE populate_t1(load_even INT) diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result index 295a9f1bed8ce..debb5d0f14a03 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result @@ -407,7 +407,6 @@ SET i = i + 1; END WHILE; COMMIT; END| -SET GLOBAL innodb_file_per_table=1; CREATE TABLE t1( class INT, id INT, @@ -421,7 +420,6 @@ affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 RENAME TABLE t1 TO t0; # Test Blob -SET GLOBAL innodb_file_per_table=1; CREATE TABLE t1( a INT PRIMARY KEY, b TEXT, @@ -467,7 +465,6 @@ class id title SELECT * FROM t1 WHERE title = 'a10010'; class id title DROP TABLE t1; -SET GLOBAL innodb_file_per_table=1; CREATE TABLE t1( class INT, id INT, @@ -501,7 +498,6 @@ SELECT * FROM t1 WHERE title = 'a10010'; class id title DROP TABLE t1; # Test Blob -SET GLOBAL innodb_file_per_table=1; CREATE TABLE t1( a INT PRIMARY KEY, b TEXT, diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result index b48207d4497a1..bdc40d1a0709b 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result @@ -72,8 +72,6 @@ test.t1 check status OK SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; CHAR_LENGTH(b) DROP TABLE t1; -SET GLOBAL innodb_file_per_table=default; -SET GLOBAL innodb_file_per_table=1; CREATE TABLE t1( class INT, id INT, @@ -135,5 +133,4 @@ test.t1 check status OK SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; CHAR_LENGTH(b) DROP TABLE t1; -SET GLOBAL innodb_file_per_table=default; DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result index bc5051b1442d5..ede6241765254 100644 --- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result +++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result @@ -116,12 +116,8 @@ buffer_LRU_unzip_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL N buffer_LRU_unzip_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Page scanned per single LRU unzip search buffer_page_read_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Leaf Pages read buffer_page_read_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Non-leaf Pages read -buffer_page_read_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Leaf Pages read -buffer_page_read_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Non-Leaf Pages read buffer_page_read_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Undo Log Pages read buffer_page_read_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Inode Pages read -buffer_page_read_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Free List Pages read -buffer_page_read_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Bitmap Pages read buffer_page_read_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of System Pages read buffer_page_read_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Transaction System Pages read buffer_page_read_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of File Space Header Pages read @@ -132,12 +128,8 @@ buffer_page_read_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NU buffer_page_read_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of other/unknown (old version of InnoDB) Pages read buffer_page_written_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Leaf Pages written buffer_page_written_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Non-leaf Pages written -buffer_page_written_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Leaf Pages written -buffer_page_written_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Non-Leaf Pages written buffer_page_written_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Undo Log Pages written buffer_page_written_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Inode Pages written -buffer_page_written_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Free List Pages written -buffer_page_written_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Bitmap Pages written buffer_page_written_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of System Pages written buffer_page_written_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Transaction System Pages written buffer_page_written_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of File Space Header Pages written @@ -205,14 +197,6 @@ adaptive_hash_rows_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL adaptive_hash_rows_deleted_no_hash_entry adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of rows deleted that did not have corresponding Adaptive Hash Index entries adaptive_hash_rows_updated adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows updated file_num_open_files file_system 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of files currently open (innodb_num_open_files) -ibuf_merges_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of inserted records merged by change buffering -ibuf_merges_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of deleted records merged by change buffering -ibuf_merges_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of purge records merged by change buffering -ibuf_merges_discard_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of insert merged operations discarded -ibuf_merges_discard_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of deleted merged operations discarded -ibuf_merges_discard_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of purge merged operations discarded -ibuf_merges change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of change buffer merges -ibuf_size change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Change buffer size in pages innodb_master_thread_sleeps server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times (seconds) master thread sleeps innodb_activity_count server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Current server activity count innodb_master_active_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times master thread performs its tasks when server is active diff --git a/mysql-test/suite/innodb/r/innodb_status_variables.result b/mysql-test/suite/innodb/r/innodb_status_variables.result index 2271cf48b1460..2e8272f444bf8 100644 --- a/mysql-test/suite/innodb/r/innodb_status_variables.result +++ b/mysql-test/suite/innodb/r/innodb_status_variables.result @@ -44,16 +44,6 @@ INNODB_DBLWR_PAGES_WRITTEN INNODB_DBLWR_WRITES INNODB_DEADLOCKS INNODB_HISTORY_LIST_LENGTH -INNODB_IBUF_DISCARDED_DELETE_MARKS -INNODB_IBUF_DISCARDED_DELETES -INNODB_IBUF_DISCARDED_INSERTS -INNODB_IBUF_FREE_LIST -INNODB_IBUF_MERGED_DELETE_MARKS -INNODB_IBUF_MERGED_DELETES -INNODB_IBUF_MERGED_INSERTS -INNODB_IBUF_MERGES -INNODB_IBUF_SEGMENT_SIZE -INNODB_IBUF_SIZE INNODB_LOG_WAITS INNODB_LOG_WRITE_REQUESTS INNODB_LOG_WRITES diff --git a/mysql-test/suite/innodb/r/insert_debug.result b/mysql-test/suite/innodb/r/insert_debug.result index 3ac9df58c169d..cafab4aa978cb 100644 --- a/mysql-test/suite/innodb/r/insert_debug.result +++ b/mysql-test/suite/innodb/r/insert_debug.result @@ -2,12 +2,10 @@ # Bug#19904003 INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=1 # CAUSES INFINITE PAGE SPLIT # -SET GLOBAL innodb_change_buffering_debug=1; SET GLOBAL innodb_limit_optimistic_insert_debug=1; CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB PARTITION BY HASH (c1) PARTITIONS 15; DROP TABLE t1; -SET GLOBAL innodb_change_buffering_debug=0; SET GLOBAL innodb_limit_optimistic_insert_debug=0; # # Bug#25082593 FOREIGN KEY VALIDATION DOESN'T NEED diff --git a/mysql-test/suite/innodb/r/log_data_file_size.result b/mysql-test/suite/innodb/r/log_data_file_size.result index d33752b089cfd..ddb8e694e40ff 100644 --- a/mysql-test/suite/innodb/r/log_data_file_size.result +++ b/mysql-test/suite/innodb/r/log_data_file_size.result @@ -1,6 +1,10 @@ SET GLOBAL innodb_file_per_table=0; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t(a INT)ENGINE=InnoDB; SET GLOBAL innodb_file_per_table=1; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE ibd4(a INT UNIQUE)ENGINE=InnoDB; CREATE TABLE ibd4f(a INT UNIQUE)ENGINE=InnoDB; CREATE TABLE ibd5(a INT UNIQUE, b INT UNIQUE)ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/r/log_file.result b/mysql-test/suite/innodb/r/log_file.result index 734e9b0768717..f5e98d30b30ff 100644 --- a/mysql-test/suite/innodb/r/log_file.result +++ b/mysql-test/suite/innodb/r/log_file.result @@ -184,7 +184,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS -FOUND 1 /InnoDB: Expected to open innodb_undo_tablespaces=3 but was able to find only 1/ in mysqld.1.err +FOUND 1 /InnoDB: Failed to open the undo tablespace/ in mysqld.1.err bak_ib_logfile0 bak_ibdata1 bak_ibdata2 @@ -214,7 +214,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS -FOUND 1 /InnoDB: Expected to open innodb_undo_tablespaces=3 but was able to find only 0/ in mysqld.1.err +FOUND 2 /InnoDB: Failed to open the undo tablespace/ in mysqld.1.err bak_ib_logfile0 bak_ibdata1 bak_ibdata2 diff --git a/mysql-test/suite/innodb/r/log_file_name.result b/mysql-test/suite/innodb/r/log_file_name.result index 766122959ab78..7ac212916de00 100644 --- a/mysql-test/suite/innodb/r/log_file_name.result +++ b/mysql-test/suite/innodb/r/log_file_name.result @@ -1,4 +1,3 @@ -SET GLOBAL innodb_file_per_table=ON; FLUSH TABLES; CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; # restart diff --git a/mysql-test/suite/innodb/r/mdev-15707.result b/mysql-test/suite/innodb/r/mdev-15707.result deleted file mode 100644 index 3967ce48b625d..0000000000000 --- a/mysql-test/suite/innodb/r/mdev-15707.result +++ /dev/null @@ -1,24 +0,0 @@ -CREATE TABLE t1( -a INT AUTO_INCREMENT PRIMARY KEY, -b CHAR(255), -INDEX(b)) -ENGINE=InnoDB; -INSERT INTO t1(b) SELECT UUID(); -BEGIN; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -INSERT INTO t1(b) SELECT UUID() FROM t1; -COMMIT; -UPDATE t1 SET b=UUID(); -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result index 63f78752276a5..57f10731ed6ad 100644 --- a/mysql-test/suite/innodb/r/monitor.result +++ b/mysql-test/suite/innodb/r/monitor.result @@ -82,12 +82,8 @@ buffer_LRU_unzip_search_num_scan disabled buffer_LRU_unzip_search_scanned_per_call disabled buffer_page_read_index_leaf disabled buffer_page_read_index_non_leaf disabled -buffer_page_read_index_ibuf_leaf disabled -buffer_page_read_index_ibuf_non_leaf disabled buffer_page_read_undo_log disabled buffer_page_read_index_inode disabled -buffer_page_read_ibuf_free_list disabled -buffer_page_read_ibuf_bitmap disabled buffer_page_read_system_page disabled buffer_page_read_trx_system disabled buffer_page_read_fsp_hdr disabled @@ -98,12 +94,8 @@ buffer_page_read_zblob2 disabled buffer_page_read_other disabled buffer_page_written_index_leaf disabled buffer_page_written_index_non_leaf disabled -buffer_page_written_index_ibuf_leaf disabled -buffer_page_written_index_ibuf_non_leaf disabled buffer_page_written_undo_log disabled buffer_page_written_index_inode disabled -buffer_page_written_ibuf_free_list disabled -buffer_page_written_ibuf_bitmap disabled buffer_page_written_system_page disabled buffer_page_written_trx_system disabled buffer_page_written_fsp_hdr disabled @@ -171,14 +163,6 @@ adaptive_hash_rows_removed disabled adaptive_hash_rows_deleted_no_hash_entry disabled adaptive_hash_rows_updated disabled file_num_open_files disabled -ibuf_merges_insert disabled -ibuf_merges_delete_mark disabled -ibuf_merges_delete disabled -ibuf_merges_discard_insert disabled -ibuf_merges_discard_delete_mark disabled -ibuf_merges_discard_delete disabled -ibuf_merges disabled -ibuf_size disabled innodb_master_thread_sleeps disabled innodb_activity_count disabled innodb_master_active_loops disabled diff --git a/mysql-test/suite/innodb/r/mvcc.result b/mysql-test/suite/innodb/r/mvcc.result index 215b2165b8cf9..3e6b0ad35dbf2 100644 --- a/mysql-test/suite/innodb/r/mvcc.result +++ b/mysql-test/suite/innodb/r/mvcc.result @@ -1,5 +1,3 @@ -SET @save_per_table= @@GLOBAL.innodb_file_per_table; -SET GLOBAL innodb_file_per_table= 1; # # MDEV-15249 Crash in MVCC read after IMPORT TABLESPACE # @@ -43,4 +41,3 @@ $$ INSERT INTO t1 SET id=1,c294=1; REPLACE t1 SET id=1,c294=1; DROP TABLE t1; -SET GLOBAL innodb_file_per_table= @save_per_table; diff --git a/mysql-test/suite/innodb/r/partition_locking.result b/mysql-test/suite/innodb/r/partition_locking.result index 56bfe3885171f..f25b8a15a2484 100644 --- a/mysql-test/suite/innodb/r/partition_locking.result +++ b/mysql-test/suite/innodb/r/partition_locking.result @@ -3,7 +3,7 @@ set @start_autocommit= @@global.autocommit; set default_storage_engine= innodb; set @@global.autocommit= 0; CREATE USER test@localhost; -grant CREATE, SELECT, UPDATE on *.* to test@localhost; +grant CREATE, SELECT, UPDATE, INSERT on *.* to test@localhost; CREATE USER test2@localhost; grant CREATE, SELECT, UPDATE on *.* to test2@localhost; CREATE TABLE t1 ( diff --git a/mysql-test/suite/innodb/r/row_format_redundant.result b/mysql-test/suite/innodb/r/row_format_redundant.result index b798832e96f0d..f028638180955 100644 --- a/mysql-test/suite/innodb/r/row_format_redundant.result +++ b/mysql-test/suite/innodb/r/row_format_redundant.result @@ -1,11 +1,9 @@ SET GLOBAL innodb_fast_shutdown=0; # restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 -SET GLOBAL innodb_file_per_table=1; # # Bug#21644827 - FTS, ASSERT !SRV_READ_ONLY_MODE || M_IMPL.M_LOG_MODE == # MTR_LOG_NO_REDO # -SET GLOBAL innodb_file_per_table=ON; create table t1 (a int not null, d varchar(15) not null, b varchar(198) not null, c char(156)) engine=InnoDB row_format=redundant; @@ -16,6 +14,8 @@ insert into t values(789, 'abcdef', 'jghikl', 'mnop'); insert into t values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf'); insert into t1 select a,d,b,c from t, seq_1_to_1024; SET GLOBAL innodb_file_per_table=OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release create table t2 (a int not null, d varchar(15) not null, b varchar(198) not null, c char(156), fulltext ftsic(c)) engine=InnoDB row_format=redundant; @@ -25,7 +25,6 @@ c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB row_format=redundant; insert into t3 values(444, 'dddd', 'bbbbb', 'aaaaa'); insert into t3 values(555, 'eeee', 'ccccc', 'aaaaa'); -SET GLOBAL innodb_fast_shutdown=0; # restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --innodb-read-only SELECT COUNT(*) FROM t1; COUNT(*) @@ -68,7 +67,7 @@ DROP TABLE t1; Warnings: Warning 1932 Table 'test.t1' doesn't exist in engine DROP TABLE t2,t3; -FOUND 6 /\[ERROR\] InnoDB: Table test/t1 in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=511\b/ in mysqld.1.err +FOUND 1 /\[ERROR\] InnoDB: Table test/t1 in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=511\b.*/ in mysqld.1.err # restart ib_buffer_pool ib_logfile0 diff --git a/mysql-test/suite/innodb/r/table_flags.result b/mysql-test/suite/innodb/r/table_flags.result index 779990351c6e7..e421126d2eb18 100644 --- a/mysql-test/suite/innodb/r/table_flags.result +++ b/mysql-test/suite/innodb/r/table_flags.result @@ -1,5 +1,4 @@ # restart: with restart_parameters -SET GLOBAL innodb_file_per_table=1; CREATE TABLE tr(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; CREATE TABLE tc(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPACT; CREATE TABLE td(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC; diff --git a/mysql-test/suite/innodb/r/undo_truncate.result b/mysql-test/suite/innodb/r/undo_truncate.result index 5be1e5c342661..b7729020acac6 100644 --- a/mysql-test/suite/innodb/r/undo_truncate.result +++ b/mysql-test/suite/innodb/r/undo_truncate.result @@ -1,3 +1,5 @@ +SET GLOBAL innodb_fast_shutdown=0; +# restart: --innodb_undo_tablespaces=2 SET GLOBAL innodb_undo_log_truncate = 0; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; create table t1(keyc int primary key, c char(100)) engine = innodb; diff --git a/mysql-test/suite/innodb/r/undo_truncate_recover.result b/mysql-test/suite/innodb/r/undo_truncate_recover.result index 909771e6a17cc..4d75712060a59 100644 --- a/mysql-test/suite/innodb/r/undo_truncate_recover.result +++ b/mysql-test/suite/innodb/r/undo_truncate_recover.result @@ -1,3 +1,5 @@ +SET GLOBAL innodb_fast_shutdown=0; +# restart: --innodb_undo_tablespaces=2 SET GLOBAL innodb_undo_log_truncate = 1; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; create table t1(keyc int primary key, c char(100)) engine = innodb; diff --git a/mysql-test/suite/innodb/r/undo_upgrade.result b/mysql-test/suite/innodb/r/undo_upgrade.result new file mode 100644 index 0000000000000..12d6f30e1d80f --- /dev/null +++ b/mysql-test/suite/innodb/r/undo_upgrade.result @@ -0,0 +1,80 @@ +# +# MDEV-19229 Allow innodb_undo_tablespaces to be changed +# after database creation +# +call mtr.add_suppression("Found .* prepared XA transactions"); +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"); +call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=\\d+ because previous shutdown was not with innodb_fast_shutdown=0"); +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +connect con_purge,localhost,root,,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +INSERT INTO t1 VALUES(1); +UPDATE t1 SET f1=100; +# case 1: Undo log left to purge +# restart: --innodb_undo_tablespaces=2 +# Display 4 undo tablespaces +select @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +4 +# Should list 4 undo log tablespaces +undo001 +undo002 +undo003 +undo004 +# case 2: XA transaction alone left +InnoDB 0 transactions not purged +XA START 'zombie'; +INSERT INTO t1 VALUES(2); +XA END 'zombie'; +XA PREPARE 'zombie'; +# restart: --innodb_undo_tablespaces=2 +# Display 4 undo tablespaces +select @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +4 +# Should list 4 undo log tablespaces +undo001 +undo002 +undo003 +undo004 +XA COMMIT 'zombie'; +# case 3: Successful innodb_undo_tablespace upgrade +SET GLOBAL innodb_fast_shutdown=0; +# restart: --innodb_undo_tablespaces=2 +# Display 2 undo tablespaces +SELECT @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +2 +# Should list 2 undo log tablespaces +undo001 +undo002 +DROP TABLE t1; +InnoDB 0 transactions not purged +# case 4: Reduce the innodb_undo_tablespace to 0 +# restart: --innodb_undo_tablespaces=0 +# Display 0 undo tablespace +SELECT @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +0 +# Shouldn't list any undo log tablespaces +# case 5: Change undo tablespace when force_recovery < 5 +# restart: --innodb_undo_tablespaces=2 --innodb_force_recovery=4 +# Display 2 undo tablespace +SELECT @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +2 +# Should list 2 undo log tablespaces +undo001 +undo002 +# case 6: Fail to change undo tablespace when force_recovery > 4 +# restart: --innodb_undo_tablespaces=4 --innodb_force_recovery=5 +# Display 2 undo tablespace +SELECT @@global.innodb_undo_tablespaces; +@@global.innodb_undo_tablespaces +2 +# Should list 2 undo log tablespaces, not 4 +undo001 +undo002 diff --git a/mysql-test/suite/innodb/r/undo_upgrade_debug.result b/mysql-test/suite/innodb/r/undo_upgrade_debug.result new file mode 100644 index 0000000000000..9c464459b98b7 --- /dev/null +++ b/mysql-test/suite/innodb/r/undo_upgrade_debug.result @@ -0,0 +1,43 @@ +# +# MDEV-19229 Allow innodb_undo_tablespaces to be changed +# after database creation +# +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"); +set global innodb_fast_shutdown=0; +# case 1: Abort after resetting TRX_SYS page rollback segments +# restart: --innodb_undo_tablespaces=4 --debug_dbug=+d,after_rseg_reset_abort +# restart: --innodb_undo_tablespaces=4 +# Should list 4 undo log tablespaces +undo001 +undo002 +undo003 +undo004 +# case 2: Abort after deleting the old undo tablespaces +# restart: --innodb_undo_tablespaces=2 --debug_dbug=+d,after_deleting_old_undo_abort +# restart: --innodb_undo_tablespaces=2 +# Should list 2 undo log tablespaces +undo001 +undo002 +# case 3: Abort after successfully deleting the old undo tablespace +# restart: --innodb_undo_tablespaces=3 --debug_dbug=+d,after_deleting_old_undo_success +# restart: --innodb_undo_tablespaces=3 +# Should list 3 undo log tablespaces +undo001 +undo002 +undo003 +# case 4: Abort after re-creating new undo tablespaces +# restart: --innodb_undo_tablespaces=4 --debug_dbug=+d,after_reinit_undo_abort +# restart: --innodb_undo_tablespaces=4 +# Should list 4 undo log tablespaces +undo001 +undo002 +undo003 +undo004 +# case 5: Abort after re-creating new undo tablespaces successfully +# restart: --innodb_undo_tablespaces=2 --debug_dbug=+d,after_reinit_undo_success +# restart: --innodb_undo_tablespaces=2 +# Should list 2 undo log tablespaces +undo001 +undo002 diff --git a/mysql-test/suite/innodb/t/alter_kill.test b/mysql-test/suite/innodb/t/alter_kill.test index 277d9b4e71b1c..fdff21e1ec061 100644 --- a/mysql-test/suite/innodb/t/alter_kill.test +++ b/mysql-test/suite/innodb/t/alter_kill.test @@ -25,7 +25,6 @@ call mtr.add_suppression("Table .*bug16720368.* is corrupted"); -- echo # Bug#16720368 INNODB CRASHES ON BROKEN #SQL*.IBD FILE AT STARTUP -- echo # -SET GLOBAL innodb_file_per_table=1; SET GLOBAL innodb_purge_rseg_truncate_frequency=1; CREATE TABLE bug16720368_1 (a INT PRIMARY KEY) ENGINE=InnoDB; @@ -129,8 +128,6 @@ DROP TABLE bug16720368, bug16720368_1; -- echo # DICT_TABLE_ADD_TO_CACHE -- echo # -SET GLOBAL innodb_file_per_table=1; - CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; BEGIN; INSERT INTO t1 VALUES(42); diff --git a/mysql-test/suite/innodb/t/alter_missing_tablespace.test b/mysql-test/suite/innodb/t/alter_missing_tablespace.test index 9742adc30a613..ff93ec5f9c67c 100644 --- a/mysql-test/suite/innodb/t/alter_missing_tablespace.test +++ b/mysql-test/suite/innodb/t/alter_missing_tablespace.test @@ -21,7 +21,6 @@ call mtr.add_suppression("InnoDB: ALTER TABLE `test`.`t` DISCARD TABLESPACE fail --enable_query_log let $MYSQLD_DATADIR=`select @@datadir`; -SET GLOBAL innodb_file_per_table=1; CREATE TABLE t(a SERIAL)ENGINE=InnoDB; CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; CREATE TABLE t1(a SERIAL)ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/t/encryption_threads_shutdown.test b/mysql-test/suite/innodb/t/encryption_threads_shutdown.test index 5a63df5db8696..d6e58a19ad9c5 100644 --- a/mysql-test/suite/innodb/t/encryption_threads_shutdown.test +++ b/mysql-test/suite/innodb/t/encryption_threads_shutdown.test @@ -10,10 +10,20 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile --let $MYSQLD_DATADIR=`SELECT @@datadir` --let $DATA= $MYSQLD_DATADIR/ibdata1 --let $DATACOPY=$MYSQLTEST_VARDIR/tmp/ibdata1 +--let $UNDO_1= $MYSQLD_DATADIR/undo001 +--let $UNDO_2= $MYSQLD_DATADIR/undo002 +--let $UNDO_3= $MYSQLD_DATADIR/undo003 +--let $UNDO_1_COPY=$MYSQLTEST_VARDIR/tmp/undo001 +--let $UNDO_2_COPY=$MYSQLTEST_VARDIR/tmp/undo002 +--let $UNDO_3_COPY=$MYSQLTEST_VARDIR/tmp/undo003 + CREATE TABLE t(a INT) ENGINE=InnoDB; --source include/kill_mysqld.inc # Move the file to cause srv_init_abort_low() call from srv_start() --move_file $DATA $DATACOPY +--move_file $UNDO_1 $UNDO_1_COPY +--move_file $UNDO_2 $UNDO_2_COPY +--move_file $UNDO_3 $UNDO_3_COPY # If the bug is not fixed, the server will hang here. Note that the test is # unstable because the condition @@ -28,5 +38,8 @@ CREATE TABLE t(a INT) ENGINE=InnoDB; SELECT * FROM t; --source include/kill_mysqld.inc --move_file $DATACOPY $DATA +--move_file $UNDO_1_COPY $UNDO_1 +--move_file $UNDO_2_COPY $UNDO_2 +--move_file $UNDO_3_COPY $UNDO_3 --source include/start_mysqld.inc DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/ibuf_delete.test b/mysql-test/suite/innodb/t/ibuf_delete.test deleted file mode 100644 index 82b740b6aa1cf..0000000000000 --- a/mysql-test/suite/innodb/t/ibuf_delete.test +++ /dev/null @@ -1,67 +0,0 @@ ---source include/have_innodb.inc ---source include/have_sequence.inc - -SET @buffering= @@innodb_change_buffering; -SET GLOBAL innodb_change_buffering= deletes; -SET @flush= @@innodb_flush_log_at_trx_commit; -SET GLOBAL innodb_flush_log_at_trx_commit= 0; - -CREATE TABLE t1 ( - a varchar(1024), - b varchar(1024), - c varchar(1024), - d varchar(1024), - e varchar(1024), - f varchar(1024), - g varchar(1024), - h varchar(1024), - key (a), - key (b), - key (c), - key (d) -) ENGINE=InnoDB; - -INSERT INTO t1 -SELECT REPEAT('x',10), REPEAT('x',13), REPEAT('x',427), REPEAT('x',244), -REPEAT('x',9), REPEAT('x',112), REPEAT('x',814), REPEAT('x',633) -FROM seq_1_to_1024; - -CREATE TEMPORARY TABLE t2 ( - a varchar(1024), - b varchar(1024), - c varchar(1024), - d varchar(1024), - e varchar(1024), - f varchar(1024), - g varchar(1024), - h varchar(1024), - i varchar(1024), - j varchar(1024), - k varchar(1024), - l varchar(1024), - m varchar(1024), - key (a), - key (b), - key (c), - key (d), - key (e), - key (f) -) ENGINE=InnoDB; - -SET @x=REPEAT('x',512); -INSERT INTO t2 SELECT @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x -FROM seq_1_to_768; - ---disable_query_log ---let $run=1024 -while ($run) -{ - eval DELETE FROM t1 LIMIT 1 /* $run */; - --dec $run -} ---enable_query_log - -# Cleanup -DROP TABLE t1, t2; -SET GLOBAL innodb_change_buffering= @buffering; -SET GLOBAL innodb_flush_log_at_trx_commit= @flush; diff --git a/mysql-test/suite/innodb/t/ibuf_not_empty.combinations b/mysql-test/suite/innodb/t/ibuf_not_empty.combinations deleted file mode 100644 index c4b45dcca32c8..0000000000000 --- a/mysql-test/suite/innodb/t/ibuf_not_empty.combinations +++ /dev/null @@ -1,9 +0,0 @@ -[strict_crc32] ---innodb-checksum-algorithm=strict_crc32 ---innodb-page-size=4k ---innodb-force-recovery=2 - -[strict_full_crc32] ---innodb-checksum-algorithm=strict_full_crc32 ---innodb-page-size=4k ---innodb-force-recovery=2 diff --git a/mysql-test/suite/innodb/t/ibuf_not_empty.test b/mysql-test/suite/innodb/t/ibuf_not_empty.test deleted file mode 100644 index 9362f8daffa63..0000000000000 --- a/mysql-test/suite/innodb/t/ibuf_not_empty.test +++ /dev/null @@ -1,117 +0,0 @@ ---source include/have_innodb.inc ---source include/no_valgrind_without_big.inc -# innodb_change_buffering_debug option is debug only ---source include/have_debug.inc -# Embedded server tests do not support restarting ---source include/not_embedded.inc ---source include/have_sequence.inc - ---disable_query_log -call mtr.add_suppression("InnoDB: Failed to find tablespace for table `test`\\.`t1` in the cache\\. Attempting to load the tablespace with space id"); -call mtr.add_suppression("InnoDB: Allocated tablespace ID \\d+ for test.t1, old maximum was"); -call mtr.add_suppression("InnoDB: Failed to find tablespace for table `mysql`\\.`transaction_registry` in the cache\\. Attempting to load the tablespace with space id"); -call mtr.add_suppression("InnoDB: Allocated tablespace ID \\d+ for mysql.transaction_registry, old maximum was"); -call mtr.add_suppression("InnoDB: Trying to read 4096 bytes"); -call mtr.add_suppression("InnoDB: File './test/t1.ibd' is corrupted"); ---enable_query_log - -CREATE TABLE t1( - a INT AUTO_INCREMENT PRIMARY KEY, - b CHAR(1), - c INT, - INDEX(b)) -ENGINE=InnoDB STATS_PERSISTENT=0; - -# The flag innodb_change_buffering_debug is only available in debug builds. -# It instructs InnoDB to try to evict pages from the buffer pool when -# change buffering is possible, so that the change buffer will be used -# whenever possible. -SET GLOBAL innodb_change_buffering_debug = 1; -SET GLOBAL innodb_change_buffering=all; - -# Create enough rows for the table, so that the change buffer will be -# used for modifying the secondary index page. There must be multiple -# index pages, because changes to the root page are never buffered. -INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_1024; -let MYSQLD_DATADIR=`select @@datadir`; -let PAGE_SIZE=`select @@innodb_page_size`; - ---source include/shutdown_mysqld.inc - -# Corrupt the change buffer bitmap, to claim that pages are clean -perl; -do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; -my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; -open(FILE, "+<$file") || die "Unable to open $file"; -binmode FILE; -my $ps= $ENV{PAGE_SIZE}; -my $page; -die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; -my $full_crc32 = unpack("N",substr($page,54,4)) & 0x10; # FIL_SPACE_FLAGS -die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; -# Clean the change buffer bitmap. -substr($page,38,$ps - 38 - 8) = chr(0) x ($ps - 38 - 8); -my $polynomial = 0x82f63b78; # CRC-32C -if ($full_crc32) -{ - my $ck = mycrc32(substr($page, 0, $ps-4), 0, $polynomial); - substr($page, $ps-4, 4) = pack("N", $ck); -} -else -{ - my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^ - mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial)); - substr($page,0,4)=$ck; - substr($page,$ps-8,4)=$ck; -} -sysseek(FILE, $ps, 0) || die "Unable to rewind $file\n"; -syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; -close(FILE) || die "Unable to close $file"; -EOF - ---let $restart_parameters= --innodb-force-recovery=6 --innodb-change-buffer-dump ---source include/start_mysqld.inc - ---replace_regex /contains \d+ entries/contains 990 entries/ -check table t1; - ---source include/shutdown_mysqld.inc - -# Truncate the file to 5 pages, as if it were empty -perl; -do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; -my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; -open(FILE, "+<$file") || die "Unable to open $file"; -binmode FILE; -my $ps= $ENV{PAGE_SIZE}; -my $pages=5; -my $page; -die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; -my $full_crc32 = unpack("N",substr($page,54,4)) & 0x10; # FIL_SPACE_FLAGS -substr($page,46,4)=pack("N", $pages); -my $polynomial = 0x82f63b78; # CRC-32C -if ($full_crc32) -{ - my $ck = mycrc32(substr($page, 0, $ps-4), 0, $polynomial); - substr($page, $ps-4, 4) = pack("N", $ck); -} -else -{ - my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^ - mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial)); - substr($page,0,4)=$ck; - substr($page,$ps-8,4)=$ck; -} -sysseek(FILE, 0, 0) || die "Unable to rewind $file\n"; -syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; -truncate(FILE, $ps * $pages); -close(FILE) || die "Unable to close $file"; -EOF - ---let $restart_parameters=--innodb-force_recovery=0 ---source include/start_mysqld.inc -SET GLOBAL innodb_fast_shutdown=0; ---source include/restart_mysqld.inc - -# Cleanup -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/index_tree_operation.test b/mysql-test/suite/innodb/t/index_tree_operation.test index b9695db9346be..e7958b2955dcc 100644 --- a/mysql-test/suite/innodb/t/index_tree_operation.test +++ b/mysql-test/suite/innodb/t/index_tree_operation.test @@ -9,12 +9,6 @@ # Otherwise, the follwing records 999,998,997 cause each page per record. # ---disable_query_log -SET @old_innodb_file_per_table = @@innodb_file_per_table; ---enable_query_log - -SET GLOBAL innodb_file_per_table=ON; - CREATE TABLE t1 (a BIGINT PRIMARY KEY, b VARCHAR(4096)) ENGINE=InnoDB; INSERT INTO t1 VALUES (0, REPEAT('a', 4096)); INSERT INTO t1 VALUES (1000, REPEAT('a', 4096)); @@ -68,7 +62,3 @@ WHERE s1.space = s2.space AND name = 'test/t1' AND page_type = "INDEX" ORDER BY page_number; DROP TABLE t1; - ---disable_query_log -SET GLOBAL innodb_file_per_table = @old_innodb_file_per_table; ---enable_query_log diff --git a/mysql-test/suite/innodb/t/innodb-bug-14068765.test b/mysql-test/suite/innodb/t/innodb-bug-14068765.test index c2446e0fecf91..4435ac6802165 100644 --- a/mysql-test/suite/innodb/t/innodb-bug-14068765.test +++ b/mysql-test/suite/innodb/t/innodb-bug-14068765.test @@ -2,7 +2,7 @@ let MYSQLD_DATADIR =`SELECT @@datadir`; -# Export/import on the same instance, with --innodb-file-per-table=1 +# Export/import on the same instance CREATE DATABASE testdb_wl5522; CREATE TABLE testdb_wl5522.t1(col1 bit(1) , col2 boolean,col3 tinyint , col4 smallint , col5 mediumint ,col6 int , col7 bigint , col8 float (14,3) ,col9 double (14,3), col10 VARCHAR(20) CHARACTER SET utf8 , col11 TEXT CHARACTER SET binary , col12 ENUM('a','b','c') CHARACTER SET binary ,col13 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ,col14 CHAR(20) , col15 VARBINARY (400) , col16 BINARY(40), col17 BLOB (400) , col18 int not null primary key,col19 DATE ,col20 DATETIME , col21 TIMESTAMP ,col22 TIME , col23 YEAR ) ENGINE = Innodb; diff --git a/mysql-test/suite/innodb/t/innodb-bug-14084530.test b/mysql-test/suite/innodb/t/innodb-bug-14084530.test index f27fbbe31d7cb..2285b86c21a90 100644 --- a/mysql-test/suite/innodb/t/innodb-bug-14084530.test +++ b/mysql-test/suite/innodb/t/innodb-bug-14084530.test @@ -4,7 +4,7 @@ let MYSQLD_DATADIR =`SELECT @@datadir`; SET AUTOCOMMIT = 0; -# Export/import on the same instance, with --innodb-file-per-table=1 +# Export/import on the same instance CREATE DATABASE testdb_wl5522; CREATE TABLE testdb_wl5522.t1 (c1 int ) engine = Innodb; diff --git a/mysql-test/suite/innodb/t/innodb-change-buffer-recovery-master.opt b/mysql-test/suite/innodb/t/innodb-change-buffer-recovery-master.opt deleted file mode 100644 index e5d7090c88353..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-change-buffer-recovery-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_buffer_pool_size=24M diff --git a/mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test b/mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test deleted file mode 100644 index dbce2f91948fe..0000000000000 --- a/mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test +++ /dev/null @@ -1,78 +0,0 @@ ---echo # ---echo # Bug#69122 - INNODB DOESN'T REDO-LOG INSERT BUFFER MERGE ---echo # OPERATION IF IT IS DONE IN-PLACE ---echo # ---source include/have_innodb.inc -# innodb_change_buffering_debug option is debug only ---source include/have_debug.inc -# Embedded server does not support crashing ---source include/not_embedded.inc -# DBUG_SUICIDE() hangs under valgrind ---source include/not_valgrind.inc -# This test is slow on buildbot. ---source include/big_test.inc ---source include/have_sequence.inc - -call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery"); -call mtr.add_suppression("Plugin initialization aborted at srv0start\\.cc"); -call mtr.add_suppression("Plugin 'InnoDB'"); -FLUSH TABLES; - -CREATE TABLE t1( - a INT AUTO_INCREMENT PRIMARY KEY, - b CHAR(1), - c INT, - INDEX(b)) -ENGINE=InnoDB STATS_PERSISTENT=0; - ---let $_server_id= `SELECT @@server_id` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect - -# The flag innodb_change_buffering_debug is only available in debug builds. -# It instructs InnoDB to try to evict pages from the buffer pool when -# change buffering is possible, so that the change buffer will be used -# whenever possible. -SET GLOBAL innodb_change_buffering_debug = 1; -SET GLOBAL innodb_change_buffering = all; -let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; - -# Create enough rows for the table, so that the change buffer will be -# used for modifying the secondary index page. There must be multiple -# index pages, because changes to the root page are never buffered. -INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_8192; - -BEGIN; -SELECT b FROM t1 LIMIT 3; - -connect (con1,localhost,root,,); -BEGIN; -DELETE FROM t1 WHERE a=1; -# This should be buffered, if innodb_change_buffering_debug = 1 is in effect. -INSERT INTO t1 VALUES(1,'X',1); - -SET DEBUG_DBUG='+d,crash_after_log_ibuf_upd_inplace'; ---exec echo "wait" > $_expect_file_name ---error 2013 -# This should force a change buffer merge -SELECT b FROM t1 LIMIT 3; -disconnect con1; -connection default; -let SEARCH_PATTERN=Wrote log record for ibuf update in place operation; ---source include/search_pattern_in_file.inc - ---let $restart_parameters= --innodb-read-only ---source include/start_mysqld.inc -CHECK TABLE t1; ---source include/shutdown_mysqld.inc -let SEARCH_PATTERN=innodb_read_only prevents crash recovery; ---source include/search_pattern_in_file.inc - ---let $restart_parameters= --innodb-force-recovery=5 --debug-dbug=d,crash_after_log_ibuf_upd_inplace ---source include/start_mysqld.inc -SELECT * FROM t1 LIMIT 1; -# Slow shutdown will not merge the changes due to innodb_force_recovery=5. -SET GLOBAL innodb_fast_shutdown=0; ---let $restart_parameters= ---source include/restart_mysqld.inc -CHECK TABLE t1; -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-enlarge-blob.opt b/mysql-test/suite/innodb/t/innodb-enlarge-blob.opt index 2f9bf78f82edf..1251c5f2aedde 100644 --- a/mysql-test/suite/innodb/t/innodb-enlarge-blob.opt +++ b/mysql-test/suite/innodb/t/innodb-enlarge-blob.opt @@ -1,4 +1,3 @@ ---innodb-file-per-table --innodb-buffer-pool-size=32M --innodb-page-size=64k --innodb-strict-mode=OFF diff --git a/mysql-test/suite/innodb/t/innodb-fkcheck.test b/mysql-test/suite/innodb/t/innodb-fkcheck.test index 5ff3533fce1ce..bec4de7b67003 100644 --- a/mysql-test/suite/innodb/t/innodb-fkcheck.test +++ b/mysql-test/suite/innodb/t/innodb-fkcheck.test @@ -4,17 +4,6 @@ # # MDEV-10083: Orphan ibd file when playing with foreign keys # ---disable_query_log -SET @start_global_fpt = @@global.innodb_file_per_table; -SET @start_global_fkc = @@global.foreign_key_checks; ---enable_query_log - -set global innodb_file_per_table = 1; - ---disable_warnings -drop table if exists b; -drop database if exists bug_fk; ---enable_warnings let $MYSQLD_DATADIR = `select @@datadir`; @@ -114,12 +103,6 @@ show warnings; # # Cleanup # ---disable_query_log -SET @@global.innodb_file_per_table = @start_global_fpt; -SET @@global.foreign_key_checks = @start_global_fkc; ---enable_query_log - ---disable_warnings -drop table if exists b; -drop database if exists bug_fk; ---enable_warnings + +drop table b; +drop database bug_fk; diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test index ab4f5a965daf8..827941817f622 100644 --- a/mysql-test/suite/innodb/t/innodb-index-online.test +++ b/mysql-test/suite/innodb/t/innodb-index-online.test @@ -9,10 +9,6 @@ SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl call mtr.add_suppression("InnoDB: Warning: Small buffer pool size"); -# DISCARD TABLESPACE needs file-per-table -SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table; -SET GLOBAL innodb_file_per_table = on; - # Save the initial number of concurrent sessions. --source include/count_sessions.inc @@ -515,7 +511,6 @@ SET DEBUG_SYNC = 'RESET'; # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc -SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; --disable_warnings SET GLOBAL innodb_monitor_enable = default; SET GLOBAL innodb_monitor_disable = default; diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test index 45b1bc1ec8e68..5f0562e11ed30 100644 --- a/mysql-test/suite/innodb/t/innodb-table-online.test +++ b/mysql-test/suite/innodb/t/innodb-table-online.test @@ -11,10 +11,6 @@ call mtr.add_suppression("InnoDB: Warning: Small buffer pool size"); call mtr.add_suppression("InnoDB: Error: table 'test/t1'"); call mtr.add_suppression("MariaDB is trying to open a table handle but the .ibd file for"); -# DISCARD TABLESPACE needs file-per-table -SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table; -SET GLOBAL innodb_file_per_table = on; - # Save the initial number of concurrent sessions. --source include/count_sessions.inc @@ -447,7 +443,6 @@ disconnect con1; # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc -SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; --disable_warnings SET GLOBAL innodb_monitor_enable = default; SET GLOBAL innodb_monitor_disable = default; diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test index efa2b1ea403d8..e970bd842e2df 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test @@ -35,7 +35,6 @@ FLUSH TABLES; let MYSQLD_DATADIR =`SELECT @@datadir`; let $strerrfix=/ (\(.+\))//; -SET GLOBAL innodb_file_per_table = 1; CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; INSERT INTO t1 VALUES(1),(2),(3); @@ -52,8 +51,6 @@ ALTER TABLE t1 DISCARD TABLESPACE; DROP TABLE t1; -SET GLOBAL innodb_file_per_table = 1; - CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; INSERT INTO t1 VALUES(1),(2),(3); @@ -66,8 +63,6 @@ ALTER TABLE t1 DISCARD TABLESPACE; DROP TABLE t1; -SET GLOBAL innodb_file_per_table = 1; - # Create the table that we will use for crash recovery (during IMPORT) CREATE TABLE t1 (c1 INT) ENGINE = Innodb; INSERT INTO t1 VALUES (1), (2), (3), (4); @@ -130,9 +125,6 @@ EOF DROP TABLE t1; -SET @file_per_table= @@innodb_file_per_table; -SET GLOBAL innodb_file_per_table = 1; - CREATE TABLE t1 (c1 INT) ENGINE = Innodb; ALTER TABLE t1 DISCARD TABLESPACE; @@ -960,21 +952,6 @@ do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; ib_restore_tablespaces("test", "t1"); EOF -# Test failure after ibuf check -SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; - -# Need proper mapping of error codes :-( ---error ER_NOT_KEYFILE -ALTER TABLE t1 IMPORT TABLESPACE; - -SET SESSION debug_dbug=@saved_debug_dbug; - -# Restore files -perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; -ib_restore_tablespaces("test", "t1"); -EOF - # Test failure after adjusting the cluster index root page SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; @@ -1397,5 +1374,3 @@ call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it"); #cleanup --remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg --remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd - -SET GLOBAL INNODB_FILE_PER_TABLE=@file_per_table; diff --git a/mysql-test/suite/innodb/t/innodb-wl5522.test b/mysql-test/suite/innodb/t/innodb-wl5522.test index 19652d8e8fd16..c5c61ded6513c 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522.test @@ -98,7 +98,6 @@ if ($checksum_algorithm == "strict_full_crc32") { ALTER TABLE t2 IMPORT TABLESPACE; DROP TABLE t2; -SET GLOBAL innodb_file_per_table = 1; SELECT @@innodb_file_per_table; let MYSQLD_DATADIR =`SELECT @@datadir`; @@ -114,7 +113,7 @@ ALTER TABLE t1 IMPORT TABLESPACE; SELECT * FROM t1; DROP TABLE t1; -# Export/import on the same instance, with --innodb-file-per-table=1 +# Export/import on the same instance CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; @@ -158,7 +157,7 @@ SELECT COUNT(*) FROM t1; DROP TABLE t1; -# Export/import on the same instance, with --innodb-file-per-table=1 +# Export/import on the same instance # Insert some more records to move the LSN forward and then drop the # table and restore CREATE TABLE t1( @@ -204,7 +203,7 @@ SELECT COUNT(*) FROM t1; DROP TABLE t1; -# Export/import on the same instance, with --innodb-file-per-table=1 +# Export/import on the same instance # Insert some more records to move the LSN forward and then drop the # table and restore, this time the table has a secondary index too. CREATE TABLE t1( @@ -245,7 +244,7 @@ SELECT COUNT(*) FROM t1 WHERE c2 = 1; DROP TABLE t1; -# Export/import on the same instance, with --innodb-file-per-table=1 +# Export/import on the same instance # Insert some more records to move the LSN forward and then drop the # table and restore, this time the table has a secondary index too. # Rename the index on the create so that the IMPORT fails, drop index diff --git a/mysql-test/suite/innodb/t/innodb-wl5980-alter.test b/mysql-test/suite/innodb/t/innodb-wl5980-alter.test index 09c54db644fad..6627b77ed9c5f 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5980-alter.test +++ b/mysql-test/suite/innodb/t/innodb-wl5980-alter.test @@ -6,7 +6,6 @@ --source include/have_innodb.inc --source include/have_symlink.inc -SET @innodb_file_per_table_orig=@@GLOBAL.innodb_file_per_table; LET $regexp=/FTS_[0-9a-f_]+([A-Z0-9_]+)\.([islbd]{3})/FTS_AUX_\1.\2/; # Set up some variables @@ -14,7 +13,6 @@ LET $MYSQL_DATA_DIR = `select @@datadir`; LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir'; SET default_storage_engine=InnoDB; -SET GLOBAL innodb_file_per_table=ON; SET NAMES utf8mb4; @@ -706,5 +704,3 @@ DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign; --list_files $MYSQL_TMP_DIR/alt_dir/test --rmdir $MYSQL_TMP_DIR/alt_dir/test --rmdir $MYSQL_TMP_DIR/alt_dir - -SET GLOBAL innodb_file_per_table = @innodb_file_per_table_orig; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test index baced6e9e117d..c9e4dc25e7fce 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test @@ -69,7 +69,7 @@ EOF --move_file $file $file.now -# Complete purge (and change buffer merge). +# Complete purge. SET GLOBAL innodb_fast_shutdown=0; --source include/shutdown_mysqld.inc diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491-master.opt b/mysql-test/suite/innodb/t/innodb_bug14147491-master.opt index 614dd9356f1ee..8434ff04c6c20 100644 --- a/mysql-test/suite/innodb/t/innodb_bug14147491-master.opt +++ b/mysql-test/suite/innodb/t/innodb_bug14147491-master.opt @@ -1,4 +1,3 @@ ---innodb_file_per_table=1 --loose-skip-stack-trace --skip-core-file --loose-innodb_buffer_pool_load_at_startup=OFF diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491.test b/mysql-test/suite/innodb/t/innodb_bug14147491.test index 3c37f1b7cce33..4f4810f84ae49 100644 --- a/mysql-test/suite/innodb/t/innodb_bug14147491.test +++ b/mysql-test/suite/innodb/t/innodb_bug14147491.test @@ -21,8 +21,6 @@ SET GLOBAL innodb_fast_shutdown=0; --echo # Create and populate the table to be corrupted -set global innodb_file_per_table=ON; - CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB; INSERT INTO t1 (b) VALUES ('corrupt me'); --disable_query_log diff --git a/mysql-test/suite/innodb/t/innodb_bug39438-master.opt b/mysql-test/suite/innodb/t/innodb_bug39438-master.opt deleted file mode 100644 index 0746d13d1c0ba..0000000000000 --- a/mysql-test/suite/innodb/t/innodb_bug39438-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb-file-per-table=1 diff --git a/mysql-test/suite/innodb/t/innodb_bug39438.test b/mysql-test/suite/innodb/t/innodb_bug39438.test index 635d65f045b96..04275197e1317 100644 --- a/mysql-test/suite/innodb/t/innodb_bug39438.test +++ b/mysql-test/suite/innodb/t/innodb_bug39438.test @@ -3,10 +3,6 @@ # Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch # http://bugs.mysql.com/39438 # -# This test must be run with innodb_file_per_table=1 because the crash -# only occurs if that option is turned on and DISCARD TABLESPACE only -# works with innodb_file_per_table. -# SET default_storage_engine=InnoDB; diff --git a/mysql-test/suite/innodb/t/innodb_bug56947.test b/mysql-test/suite/innodb/t/innodb_bug56947.test index ce64f1a83223d..3e85e6148128c 100644 --- a/mysql-test/suite/innodb/t/innodb_bug56947.test +++ b/mysql-test/suite/innodb/t/innodb_bug56947.test @@ -4,7 +4,8 @@ -- source include/have_innodb.inc -- source include/have_debug.inc -SET GLOBAL innodb_file_per_table=0; +SET @save_fpt=@@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=OFF; create table bug56947(a int not null) engine = innodb; SET @saved_dbug = @@SESSION.debug_dbug; @@ -15,5 +16,5 @@ alter table bug56947 add unique index (a); check table bug56947; drop table bug56947; -SET @@global.innodb_file_per_table=DEFAULT; +SET GLOBAL innodb_file_per_table=@save_fpt; SET debug_dbug= @saved_dbug; diff --git a/mysql-test/suite/innodb/t/innodb_bug59733.test b/mysql-test/suite/innodb/t/innodb_bug59733.test deleted file mode 100644 index 0b1bff5193298..0000000000000 --- a/mysql-test/suite/innodb/t/innodb_bug59733.test +++ /dev/null @@ -1,53 +0,0 @@ -# -# Bug #59733 Possible deadlock when buffered changes are to be discarded -# in buf_page_create -# --- source include/have_innodb.inc - --- disable_query_log -# The flag innodb_change_buffering_debug is only available in debug builds. -# It instructs InnoDB to try to evict pages from the buffer pool when -# change buffering is possible, so that the change buffer will be used -# whenever possible. --- error 0,ER_UNKNOWN_SYSTEM_VARIABLE -SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug; --- error 0,ER_UNKNOWN_SYSTEM_VARIABLE -SET GLOBAL innodb_change_buffering_debug = 1; --- enable_query_log - -CREATE TABLE bug59733(a INT AUTO_INCREMENT PRIMARY KEY,b CHAR(1))ENGINE=InnoDB; - -# Create enough rows for the table, so that the insert buffer will be -# used. There must be multiple index pages, because changes to the -# root page are never buffered. - -INSERT INTO bug59733 VALUES(0,'x'); -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; -INSERT INTO bug59733 SELECT 0,b FROM bug59733; - -# Create the secondary index for which changes will be buffered. -CREATE INDEX b ON bug59733 (b); - -# This should be buffered, if innodb_change_buffering_debug = 1 is in effect. -DELETE FROM bug59733 WHERE (a%100)=0; - -# Drop the index in order to get free pages with orphaned buffered changes. -DROP INDEX b ON bug59733; - -# Create the index and attempt to reuse pages for which buffered changes exist. -CREATE INDEX b ON bug59733 (b); - -DROP TABLE bug59733; - --- disable_query_log --- error 0, ER_UNKNOWN_SYSTEM_VARIABLE -SET GLOBAL innodb_change_buffering_debug = @innodb_change_buffering_debug_orig; diff --git a/mysql-test/suite/innodb/t/innodb_bug68148.test b/mysql-test/suite/innodb/t/innodb_bug68148.test index ab4e031165677..432e8fbf03ebb 100644 --- a/mysql-test/suite/innodb/t/innodb_bug68148.test +++ b/mysql-test/suite/innodb/t/innodb_bug68148.test @@ -6,8 +6,6 @@ # MDEV-8845: Table disappear after modifying FK # -set global innodb_file_per_table=1; - CREATE TABLE ref_table1 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; CREATE TABLE ref_table2 (id int(11) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test index d04dd59f7e734..75e011a5094f3 100644 --- a/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test +++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test @@ -80,11 +80,6 @@ SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; DROP TABLE t1; -SET GLOBAL innodb_file_per_table=default; - -# Test Compressed Table -SET GLOBAL innodb_file_per_table=1; - CREATE TABLE t1( class INT, id INT, @@ -143,6 +138,4 @@ SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975; DROP TABLE t1; -SET GLOBAL innodb_file_per_table=default; - DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb/t/innodb_defragment.opt b/mysql-test/suite/innodb/t/innodb_defragment.opt index aea3d480c244b..12b046be78663 100644 --- a/mysql-test/suite/innodb/t/innodb_defragment.opt +++ b/mysql-test/suite/innodb/t/innodb_defragment.opt @@ -1,5 +1,4 @@ --loose-innodb-buffer-pool-stats --loose-innodb-buffer-page --loose-innodb-buffer-page-lru ---innodb-file-per-table ---innodb-defragment=1 \ No newline at end of file +--innodb-defragment=1 diff --git a/mysql-test/suite/innodb/t/insert_debug.test b/mysql-test/suite/innodb/t/insert_debug.test index c370c402ac7c9..7fe584a8ff7f5 100644 --- a/mysql-test/suite/innodb/t/insert_debug.test +++ b/mysql-test/suite/innodb/t/insert_debug.test @@ -7,13 +7,11 @@ --echo # CAUSES INFINITE PAGE SPLIT --echo # -SET GLOBAL innodb_change_buffering_debug=1; SET GLOBAL innodb_limit_optimistic_insert_debug=1; CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB PARTITION BY HASH (c1) PARTITIONS 15; DROP TABLE t1; -SET GLOBAL innodb_change_buffering_debug=0; SET GLOBAL innodb_limit_optimistic_insert_debug=0; --echo # diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test index 6f7080f5b502e..f54aebf317edd 100644 --- a/mysql-test/suite/innodb/t/log_corruption.test +++ b/mysql-test/suite/innodb/t/log_corruption.test @@ -57,16 +57,24 @@ my $head = pack("Nx[18]", 0); my $body = pack("x[8]Nx[10]Nx[16312]", 768, 97937874); my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); -# Dummy pages 1..6. -$body = pack("x[16338]"); -for (my($page) = 1; $page < 7; $page++) -{ - ## FIL_PAGE_OFFSET - $head = pack("Nx[18]", $page); - $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); - print OUT pack("N",$ck).$head.pack("x[16350]Nx[4]",$ck); -} + +# Dummy change buffer header page (page 3). +die unless seek(OUT, 3 * 16384, 0); +## FIL_PAGE_OFFSET, FIL_PAGE_PREV, FIL_PAGE_NEXT, FIL_PAGE_TYPE +my $head = pack("NNNx[8]n", 3, 0xffffffff, 0xffffffff, 6); +my $body = pack("x[62]nnx[16272]", 2, 50); +my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); +print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); + +# Dummy change buffer root page (page 4). +## FIL_PAGE_OFFSET, FIL_PAGE_PREV, FIL_PAGE_NEXT +my $head = pack("NNNx[10]", 4, 0xffffffff, 0xffffffff); +my $body = chr(0) x 16338; +my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); +print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); + # Dictionary header page (page 7). +die unless seek(OUT, 7 * 16384, 0); ## FIL_PAGE_OFFSET $head = pack("Nx[18]", 7); ## DICT_HDR_TABLES,DICT_HDR_INDEXES diff --git a/mysql-test/suite/innodb/t/log_data_file_size.opt b/mysql-test/suite/innodb/t/log_data_file_size.opt index d9a364a32872d..20e2cf0dc4086 100644 --- a/mysql-test/suite/innodb/t/log_data_file_size.opt +++ b/mysql-test/suite/innodb/t/log_data_file_size.opt @@ -1,2 +1,3 @@ --loose-innodb-sys-indexes --innodb-data-file-path=ibdata1:1M:autoextend +--innodb-undo-tablespaces=0 diff --git a/mysql-test/suite/innodb/t/log_file.test b/mysql-test/suite/innodb/t/log_file.test index 438fbe1a6e1fa..805a4b4cd5664 100644 --- a/mysql-test/suite/innodb/t/log_file.test +++ b/mysql-test/suite/innodb/t/log_file.test @@ -164,7 +164,7 @@ let SEARCH_PATTERN=undo tablespace .*undo003.* exists\. Creating system tablespa --source include/start_mysqld.inc eval $check_no_innodb; --source include/shutdown_mysqld.inc -let SEARCH_PATTERN=InnoDB: Expected to open innodb_undo_tablespaces=3 but was able to find only 1; +let SEARCH_PATTERN=InnoDB: Failed to open the undo tablespace; --source include/search_pattern_in_file.inc # clean up & Restore --source ../include/log_file_cleanup.inc @@ -176,7 +176,7 @@ let SEARCH_PATTERN=InnoDB: Expected to open innodb_undo_tablespaces=3 but was ab --source include/start_mysqld.inc eval $check_no_innodb; --source include/shutdown_mysqld.inc -let SEARCH_PATTERN=InnoDB: Expected to open innodb_undo_tablespaces=3 but was able to find only 0; +let SEARCH_PATTERN=InnoDB: Failed to open the undo tablespace; --source include/search_pattern_in_file.inc # clean up & Restore diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test index eb616d7f835db..1945be89599d6 100644 --- a/mysql-test/suite/innodb/t/log_file_name.test +++ b/mysql-test/suite/innodb/t/log_file_name.test @@ -7,7 +7,6 @@ # Embedded server does not support crashing --source include/not_embedded.inc -SET GLOBAL innodb_file_per_table=ON; FLUSH TABLES; CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/t/log_upgrade.test b/mysql-test/suite/innodb/t/log_upgrade.test index faf88c41bef23..a3d237875feac 100644 --- a/mysql-test/suite/innodb/t/log_upgrade.test +++ b/mysql-test/suite/innodb/t/log_upgrade.test @@ -45,9 +45,24 @@ my $head = pack("Nx[18]", 0); my $body = pack("x[8]Nx[10]Nx[16312]", 768, 97937874); my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); -# Dummy pages 1..6. -print OUT chr(0) x (6 * 16384); + +# Dummy change buffer header page (page 3). +die unless seek(OUT, 3 * 16384, 0); +## FIL_PAGE_OFFSET, FIL_PAGE_PREV, FIL_PAGE_NEXT, FIL_PAGE_TYPE +my $head = pack("NNNx[8]n", 3, 0xffffffff, 0xffffffff, 6); +my $body = pack("x[62]nnx[16272]", 2, 50); +my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); +print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); + +# Dummy change buffer root page (page 4). +## FIL_PAGE_OFFSET, FIL_PAGE_PREV, FIL_PAGE_NEXT +my $head = pack("NNNx[10]", 4, 0xffffffff, 0xffffffff); +my $body = chr(0) x 16338; +my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); +print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck); + # Dictionary header page (page 7). +die unless seek(OUT, 7 * 16384, 0); ## FIL_PAGE_OFFSET $head = pack("Nx[18]", 7); ## DICT_HDR_TABLES,DICT_HDR_INDEXES diff --git a/mysql-test/suite/innodb/t/mdev-15707.opt b/mysql-test/suite/innodb/t/mdev-15707.opt deleted file mode 100644 index fec3463c6d084..0000000000000 --- a/mysql-test/suite/innodb/t/mdev-15707.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb --innodb-buffer-pool-size=5MB --innodb-read-io-threads=1 --innodb-doublewrite=0 --innodb-flush-log-at-trx-commit=0 \ No newline at end of file diff --git a/mysql-test/suite/innodb/t/mdev-15707.test b/mysql-test/suite/innodb/t/mdev-15707.test deleted file mode 100644 index a0446ef4f811a..0000000000000 --- a/mysql-test/suite/innodb/t/mdev-15707.test +++ /dev/null @@ -1,30 +0,0 @@ ---source include/windows.inc -# This test is slow on buildbot. ---source include/big_test.inc - -# Deadlock in conjunction with the innodb change buffering. - -# When innodb change buffering kicks in, i.e secondary non-unique index -# does not fit into the bufferpool, then, on Windows, innodb -# background threads could deadlock whenever index page is -# read, and the page needs load/merge change buffer. -# The test tries to reproduce this situation, by creating index -# that does not fit into bufferpool, and doing a large update. - -CREATE TABLE t1( -a INT AUTO_INCREMENT PRIMARY KEY, -b CHAR(255), -INDEX(b)) -ENGINE=InnoDB; - -INSERT INTO t1(b) SELECT UUID(); -BEGIN; -let $i=`select cast(log2(@@innodb_buffer_pool_size/255) as int)`; -while ($i) -{ - INSERT INTO t1(b) SELECT UUID() FROM t1; - dec $i; -} -COMMIT; -UPDATE t1 SET b=UUID(); -DROP TABLE t1; \ No newline at end of file diff --git a/mysql-test/suite/innodb/t/monitor.test b/mysql-test/suite/innodb/t/monitor.test index 9b093d41892e4..7d41a5507e80c 100644 --- a/mysql-test/suite/innodb/t/monitor.test +++ b/mysql-test/suite/innodb/t/monitor.test @@ -258,7 +258,7 @@ drop table monitor_test; set global innodb_monitor_enable = file_num_open_files; -# Counters are unpredictable when innodb-file-per-table is on +# Counters are unpredictable --replace_column 2 # 3 # 4 # 5 # 6 # 7 # select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, diff --git a/mysql-test/suite/innodb/t/mvcc.test b/mysql-test/suite/innodb/t/mvcc.test index 7c37718c28a34..e0baf7f83d365 100644 --- a/mysql-test/suite/innodb/t/mvcc.test +++ b/mysql-test/suite/innodb/t/mvcc.test @@ -1,9 +1,6 @@ --source include/have_innodb.inc --source include/have_sequence.inc -SET @save_per_table= @@GLOBAL.innodb_file_per_table; -SET GLOBAL innodb_file_per_table= 1; - let MYSQLD_DATADIR =`SELECT @@datadir`; --echo # @@ -68,5 +65,3 @@ DELIMITER ;$$ INSERT INTO t1 SET id=1,c294=1; REPLACE t1 SET id=1,c294=1; DROP TABLE t1; - -SET GLOBAL innodb_file_per_table= @save_per_table; diff --git a/mysql-test/suite/innodb/t/partition_locking.test b/mysql-test/suite/innodb/t/partition_locking.test index e33df934a2813..13457c1d9be15 100644 --- a/mysql-test/suite/innodb/t/partition_locking.test +++ b/mysql-test/suite/innodb/t/partition_locking.test @@ -9,7 +9,7 @@ set default_storage_engine= innodb; set @@global.autocommit= 0; CREATE USER test@localhost; -grant CREATE, SELECT, UPDATE on *.* to test@localhost; +grant CREATE, SELECT, UPDATE, INSERT on *.* to test@localhost; CREATE USER test2@localhost; grant CREATE, SELECT, UPDATE on *.* to test2@localhost; diff --git a/mysql-test/suite/innodb/t/row_format_redundant.opt b/mysql-test/suite/innodb/t/row_format_redundant.opt index c44c611ed60c7..3147bad47130a 100644 --- a/mysql-test/suite/innodb/t/row_format_redundant.opt +++ b/mysql-test/suite/innodb/t/row_format_redundant.opt @@ -1 +1,2 @@ --innodb-checksum-algorithm=crc32 +--innodb-undo-tablespaces=0 diff --git a/mysql-test/suite/innodb/t/row_format_redundant.test b/mysql-test/suite/innodb/t/row_format_redundant.test index 6de7597e98335..6b5a559fc189a 100644 --- a/mysql-test/suite/innodb/t/row_format_redundant.test +++ b/mysql-test/suite/innodb/t/row_format_redundant.test @@ -26,14 +26,11 @@ let bugdir= $MYSQLTEST_VARDIR/tmp/row_format_redundant; SET GLOBAL innodb_fast_shutdown=0; --source include/restart_mysqld.inc -SET GLOBAL innodb_file_per_table=1; - --echo # --echo # Bug#21644827 - FTS, ASSERT !SRV_READ_ONLY_MODE || M_IMPL.M_LOG_MODE == --echo # MTR_LOG_NO_REDO --echo # -SET GLOBAL innodb_file_per_table=ON; create table t1 (a int not null, d varchar(15) not null, b varchar(198) not null, c char(156)) engine=InnoDB row_format=redundant; @@ -61,9 +58,6 @@ row_format=redundant; insert into t3 values(444, 'dddd', 'bbbbb', 'aaaaa'); insert into t3 values(555, 'eeee', 'ccccc', 'aaaaa'); -# read-only restart requires the change buffer to be empty; therefore we -# do a slow shutdown. -SET GLOBAL innodb_fast_shutdown=0; --let $restart_parameters= $d --innodb-read-only --source include/restart_mysqld.inc @@ -150,7 +144,7 @@ RENAME TABLE t1 TO tee_one; DROP TABLE t1; DROP TABLE t2,t3; ---let SEARCH_PATTERN= \[ERROR\] InnoDB: Table test/t1 in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=511\b +--let SEARCH_PATTERN= \[ERROR\] InnoDB: Table test/t1 in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=511\b.* --source include/search_pattern_in_file.inc --let $restart_parameters= diff --git a/mysql-test/suite/innodb/t/table_flags.opt b/mysql-test/suite/innodb/t/table_flags.opt index bca674950d203..3147bad47130a 100644 --- a/mysql-test/suite/innodb/t/table_flags.opt +++ b/mysql-test/suite/innodb/t/table_flags.opt @@ -1,2 +1,2 @@ --innodb-checksum-algorithm=crc32 ---skip-innodb-read-only-compressed +--innodb-undo-tablespaces=0 diff --git a/mysql-test/suite/innodb/t/table_flags.test b/mysql-test/suite/innodb/t/table_flags.test index 6b2e6ee3ea629..1c3efa1fbba28 100644 --- a/mysql-test/suite/innodb/t/table_flags.test +++ b/mysql-test/suite/innodb/t/table_flags.test @@ -40,7 +40,6 @@ let bugdir= $MYSQLTEST_VARDIR/tmp/table_flags; --let $restart_parameters=$d --innodb-stats-persistent=0 --source include/restart_mysqld.inc -SET GLOBAL innodb_file_per_table=1; CREATE TABLE tr(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; CREATE TABLE tc(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPACT; CREATE TABLE td(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC; diff --git a/mysql-test/suite/innodb/t/undo_truncate.test b/mysql-test/suite/innodb/t/undo_truncate.test index 19829ce21e75d..a5e0a52f798fc 100644 --- a/mysql-test/suite/innodb/t/undo_truncate.test +++ b/mysql-test/suite/innodb/t/undo_truncate.test @@ -1,6 +1,5 @@ --source include/have_innodb.inc --source include/innodb_page_size.inc ---source include/have_undo_tablespaces.inc --source include/not_embedded.inc --source include/have_sequence.inc --source include/no_valgrind_without_big.inc @@ -12,6 +11,11 @@ call mtr.add_suppression("InnoDB: Difficult to find free blocks in the buffer po call mtr.add_suppression("InnoDB: Trying to delete tablespace.*pending operations"); --enable_query_log +# Re-create the undo log tablespaces after slow shutdown +SET GLOBAL innodb_fast_shutdown=0; +let $restart_parameters="--innodb_undo_tablespaces=2"; +--source include/restart_mysqld.inc + SET GLOBAL innodb_undo_log_truncate = 0; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; @@ -53,6 +57,7 @@ let $trx_before= `select substr('$trx_before',9)+2`; SET GLOBAL innodb_purge_rseg_truncate_frequency=1; SET GLOBAL innodb_max_purge_lag_wait=0; set global innodb_fast_shutdown=0; +let $restart_parameters=; --source include/restart_mysqld.inc --replace_regex /.*Trx id counter ([0-9]+).*/\1/ let $trx_after= `SHOW ENGINE INNODB STATUS`; diff --git a/mysql-test/suite/innodb/t/undo_truncate_recover.test b/mysql-test/suite/innodb/t/undo_truncate_recover.test index e499ff3dfbe3f..1b27b0fe6e4d8 100644 --- a/mysql-test/suite/innodb/t/undo_truncate_recover.test +++ b/mysql-test/suite/innodb/t/undo_truncate_recover.test @@ -8,10 +8,14 @@ --source include/innodb_page_size_small.inc --source include/have_innodb.inc --source include/have_debug.inc ---source include/have_undo_tablespaces.inc # Tests with embedded server do not support restarting --source include/not_embedded.inc +# Re-create the undo log tablespaces after slow shutdown +SET GLOBAL innodb_fast_shutdown=0; +let $restart_parameters="--innodb_undo_tablespaces=2"; +--source include/restart_mysqld.inc + SET GLOBAL innodb_undo_log_truncate = 1; SET GLOBAL innodb_purge_rseg_truncate_frequency = 1; diff --git a/mysql-test/suite/innodb/t/undo_upgrade.opt b/mysql-test/suite/innodb/t/undo_upgrade.opt new file mode 100644 index 0000000000000..87bc4c4d7f7d7 --- /dev/null +++ b/mysql-test/suite/innodb/t/undo_upgrade.opt @@ -0,0 +1,2 @@ +--log-bin=1 +--innodb_undo_tablespaces=4 diff --git a/mysql-test/suite/innodb/t/undo_upgrade.test b/mysql-test/suite/innodb/t/undo_upgrade.test new file mode 100644 index 0000000000000..952d8b72b6904 --- /dev/null +++ b/mysql-test/suite/innodb/t/undo_upgrade.test @@ -0,0 +1,94 @@ +--source include/have_innodb.inc +--source include/innodb_page_size.inc +--source include/not_embedded.inc + +--echo # +--echo # MDEV-19229 Allow innodb_undo_tablespaces to be changed +--echo # after database creation +--echo # +call mtr.add_suppression("Found .* prepared XA transactions"); +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"); +call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=\\d+ because previous shutdown was not with innodb_fast_shutdown=0"); + +let $MYSQLD_DATADIR= `select @@datadir`; + +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +connect(con_purge,localhost,root,,,); +START TRANSACTION WITH CONSISTENT SNAPSHOT; + +connection default; +INSERT INTO t1 VALUES(1); +UPDATE t1 SET f1=100; + +let $restart_parameters=--innodb_undo_tablespaces=2; +--echo # case 1: Undo log left to purge +--source include/restart_mysqld.inc +--echo # Display 4 undo tablespaces +select @@global.innodb_undo_tablespaces; + +--echo # Should list 4 undo log tablespaces +list_files $MYSQLD_DATADIR undo*; + +--echo # case 2: XA transaction alone left +--source include/wait_all_purged.inc +XA START 'zombie'; +INSERT INTO t1 VALUES(2); +XA END 'zombie'; +XA PREPARE 'zombie'; + +--source include/restart_mysqld.inc + +--echo # Display 4 undo tablespaces +select @@global.innodb_undo_tablespaces; + +--echo # Should list 4 undo log tablespaces +list_files $MYSQLD_DATADIR undo*; + +XA COMMIT 'zombie'; + +--echo # case 3: Successful innodb_undo_tablespace upgrade +SET GLOBAL innodb_fast_shutdown=0; + +let $restart_parameters=--innodb_undo_tablespaces=2; +--source include/restart_mysqld.inc + +--echo # Display 2 undo tablespaces +SELECT @@global.innodb_undo_tablespaces; + +--echo # Should list 2 undo log tablespaces +list_files $MYSQLD_DATADIR undo*; + +DROP TABLE t1; +--source include/wait_all_purged.inc + +--echo # case 4: Reduce the innodb_undo_tablespace to 0 +let $restart_parameters=--innodb_undo_tablespaces=0; +--source include/restart_mysqld.inc + +--echo # Display 0 undo tablespace +SELECT @@global.innodb_undo_tablespaces; + +--echo # Shouldn't list any undo log tablespaces +list_files $MYSQLD_DATADIR undo*; + +--echo # case 5: Change undo tablespace when force_recovery < 5 +let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_force_recovery=4; +--source include/restart_mysqld.inc + +--echo # Display 2 undo tablespace +SELECT @@global.innodb_undo_tablespaces; + +--echo # Should list 2 undo log tablespaces +list_files $MYSQLD_DATADIR undo*; + +--echo # case 6: Fail to change undo tablespace when force_recovery > 4 +let $restart_parameters=--innodb_undo_tablespaces=4 --innodb_force_recovery=5; +--source include/restart_mysqld.inc + +--echo # Display 2 undo tablespace +SELECT @@global.innodb_undo_tablespaces; + +--echo # Should list 2 undo log tablespaces, not 4 +list_files $MYSQLD_DATADIR undo*; diff --git a/mysql-test/suite/innodb/t/undo_upgrade_debug.test b/mysql-test/suite/innodb/t/undo_upgrade_debug.test new file mode 100644 index 0000000000000..e274d6c020d99 --- /dev/null +++ b/mysql-test/suite/innodb/t/undo_upgrade_debug.test @@ -0,0 +1,70 @@ +--source include/have_innodb.inc +--source include/innodb_page_size.inc +--source include/have_debug.inc +--source include/not_embedded.inc + +--echo # +--echo # MDEV-19229 Allow innodb_undo_tablespaces to be changed +--echo # after database creation +--echo # +let $MYSQLD_DATADIR= `select @@datadir`; +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"); + +set global innodb_fast_shutdown=0; + +--echo # case 1: Abort after resetting TRX_SYS page rollback segments +let $restart_parameters=--innodb_undo_tablespaces=4 --debug_dbug="+d,after_rseg_reset_abort"; + +--source include/restart_mysqld.inc + +let $restart_parameters=--innodb_undo_tablespaces=4; +--source include/restart_mysqld.inc + +--echo # Should list 4 undo log tablespaces +list_files $MYSQLD_DATADIR undo*; + +--echo # case 2: Abort after deleting the old undo tablespaces +let $restart_parameters=--innodb_undo_tablespaces=2 --debug_dbug="+d,after_deleting_old_undo_abort"; + +--source include/restart_mysqld.inc + +let $restart_parameters=--innodb_undo_tablespaces=2; +--source include/restart_mysqld.inc + +--echo # Should list 2 undo log tablespaces +list_files $MYSQLD_DATADIR undo*; + +--echo # case 3: Abort after successfully deleting the old undo tablespace +let $restart_parameters=--innodb_undo_tablespaces=3 --debug_dbug="+d,after_deleting_old_undo_success"; + +--source include/restart_mysqld.inc + +let $restart_parameters=--innodb_undo_tablespaces=3; +--source include/restart_mysqld.inc + +--echo # Should list 3 undo log tablespaces +list_files $MYSQLD_DATADIR undo*; + +--echo # case 4: Abort after re-creating new undo tablespaces +let $restart_parameters=--innodb_undo_tablespaces=4 --debug_dbug="+d,after_reinit_undo_abort"; + +--source include/restart_mysqld.inc + +let $restart_parameters=--innodb_undo_tablespaces=4; +--source include/restart_mysqld.inc + +--echo # Should list 4 undo log tablespaces +list_files $MYSQLD_DATADIR undo*; + +--echo # case 5: Abort after re-creating new undo tablespaces successfully +let $restart_parameters=--innodb_undo_tablespaces=2 --debug_dbug="+d,after_reinit_undo_success"; + +--source include/restart_mysqld.inc + +let $restart_parameters=--innodb_undo_tablespaces=2; +--source include/restart_mysqld.inc + +--echo # Should list 2 undo log tablespaces +list_files $MYSQLD_DATADIR undo*; diff --git a/mysql-test/suite/innodb_fts/r/crash_recovery.result b/mysql-test/suite/innodb_fts/r/crash_recovery.result index 83e5ddaea90b3..52a58c7034dd9 100644 --- a/mysql-test/suite/innodb_fts/r/crash_recovery.result +++ b/mysql-test/suite/innodb_fts/r/crash_recovery.result @@ -161,6 +161,8 @@ DROP TABLE mdev19073, mdev19073_2; # MDEV-28706 Redundant InnoDB table fails during alter # SET @@global.innodb_file_per_table = 0; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t1 ( col_int INTEGER, col_text TEXT, col_text_1 TEXT diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result index 32dc87daa0447..cb61506906740 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext.result +++ b/mysql-test/suite/innodb_fts/r/fulltext.result @@ -721,6 +721,8 @@ DROP TABLE t1; # SET @save = @@global.innodb_file_per_table; SET @@global.innodb_file_per_table = 0; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t1 ( col_int INTEGER, col_text TEXT, col_int_g INTEGER GENERATED ALWAYS AS (col_int) @@ -730,6 +732,8 @@ ALTER TABLE t1 DROP KEY `ftidx` ; INSERT INTO t1 (col_int, col_text) VALUES ( 1255, NULL); DROP TABLE t1; SET @@global.innodb_file_per_table = @save; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release # # MDEV-20797 FULLTEXT search with apostrophe, # and mandatory words diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result index 52cbede731451..6d7a5647a633b 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result @@ -466,7 +466,8 @@ ROLLBACK; SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops'); s1 s2 DROP TABLE t2 , t1; -set global innodb_file_per_table=1; +SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed; +SET GLOBAL innodb_read_only_compressed=OFF; CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, a VARCHAR(200), @@ -649,7 +650,7 @@ id a b 6 MYSQL SECURITY when configured properly, mysql ... 7 TEST QUERY EXPANSION for database ... DROP TABLE t1; -SET GLOBAL innodb_file_per_table=1; +SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, a VARCHAR(200), diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result b/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result index d67981e08511b..0cbe1090e89ae 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result @@ -1,4 +1,3 @@ -drop table if exists t1; CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, a VARCHAR(200), @@ -133,7 +132,6 @@ AGAINST ('"xyz blob"@3' IN BOOLEAN MODE); count(*) 2 DROP TABLE t1; -set global innodb_file_per_table=1; CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, a TEXT, @@ -214,4 +212,3 @@ AGAINST ('"very blob"@3' IN BOOLEAN MODE); count(*) 1 DROP TABLE t1; -SET GLOBAL innodb_file_per_table=1; diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test index 4eaf5b2e0bd39..c0836372e9e48 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test @@ -427,15 +427,9 @@ DROP TABLE t2 , t1; # FTS index with compressed row format #------------------------------------------------------------------------------ -# Save innodb variables -let $innodb_file_per_table_orig=`select @@innodb_file_per_table`; - -set global innodb_file_per_table=1; - ---disable_query_log SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed; SET GLOBAL innodb_read_only_compressed=OFF; ---enable_query_log + # Create FTS table CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, @@ -583,10 +577,7 @@ SELECT * FROM t1 WHERE MATCH (a,b) SELECT * FROM t1 ORDER BY id; DROP TABLE t1; ---disable_query_log SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; ---enable_query_log -eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; #------------------------------------------------------------------------------ # FTS index with utf8 character testcase diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test b/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test index e3d8eb0c13b11..25ad4f0355ff3 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test @@ -5,14 +5,6 @@ # Functional testing with FTS proximity search using '@' # and try search default words ---disable_warnings -drop table if exists t1; ---enable_warnings - ---disable_query_log -let $innodb_file_per_table_orig = `select @@innodb_file_per_table`; ---enable_query_log - # Create FTS table CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, @@ -161,8 +153,6 @@ SELECT count(*) FROM t1 DROP TABLE t1; -set global innodb_file_per_table=1; - # Test fts with externally stored long column CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, @@ -257,5 +247,3 @@ SELECT count(*) FROM t1 AGAINST ('"very blob"@3' IN BOOLEAN MODE); DROP TABLE t1; - -eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; diff --git a/mysql-test/suite/innodb_zip/r/bug36169.result b/mysql-test/suite/innodb_zip/r/bug36169.result index 7e165e0f7d45b..c7e234b5ba11b 100644 --- a/mysql-test/suite/innodb_zip/r/bug36169.result +++ b/mysql-test/suite/innodb_zip/r/bug36169.result @@ -1 +1 @@ -SET GLOBAL innodb_file_per_table=ON; +DROP TABLE IF EXISTS table6; diff --git a/mysql-test/suite/innodb_zip/r/bug53591.result b/mysql-test/suite/innodb_zip/r/bug53591.result index 779064d054f49..0c6386df022a5 100644 --- a/mysql-test/suite/innodb_zip/r/bug53591.result +++ b/mysql-test/suite/innodb_zip/r/bug53591.result @@ -1,9 +1,4 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); -SET GLOBAL innodb_file_per_table=on; -SET GLOBAL innodb_strict_mode=on; -set old_alter_table=0; -Warnings: -Warning 1287 '@@old_alter_table' is deprecated and will be removed in a future release. Please use '@@alter_algorithm' instead CREATE TABLE bug53591(a text charset utf8 not null) ENGINE=InnoDB KEY_BLOCK_SIZE=1; ALTER TABLE bug53591 ADD PRIMARY KEY(a(220)); @@ -12,5 +7,3 @@ SHOW WARNINGS; Level Code Message Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is {checked_valid}. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs DROP TABLE bug53591; -SET GLOBAL innodb_file_per_table=1; -SET GLOBAL innodb_strict_mode=DEFAULT; diff --git a/mysql-test/suite/innodb_zip/r/bug56680.result b/mysql-test/suite/innodb_zip/r/bug56680.result index 1a1a5b407074c..3c325351c3ae4 100644 --- a/mysql-test/suite/innodb_zip/r/bug56680.result +++ b/mysql-test/suite/innodb_zip/r/bug56680.result @@ -1,5 +1,4 @@ SET GLOBAL tx_isolation='REPEATABLE-READ'; -SET GLOBAL innodb_file_per_table=on; CREATE TABLE bug56680( a INT AUTO_INCREMENT PRIMARY KEY, b CHAR(1), diff --git a/mysql-test/suite/innodb_zip/r/cmp_drop_table.result b/mysql-test/suite/innodb_zip/r/cmp_drop_table.result index e1f63268d0b25..530932e99fb51 100644 --- a/mysql-test/suite/innodb_zip/r/cmp_drop_table.result +++ b/mysql-test/suite/innodb_zip/r/cmp_drop_table.result @@ -1,4 +1,3 @@ -set global innodb_file_per_table=on; create table t1(a text) engine=innodb key_block_size=4; SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0; page_size diff --git a/mysql-test/suite/innodb_zip/r/create_options.result b/mysql-test/suite/innodb_zip/r/create_options.result index a678d7a85f329..0f4c1239d7379 100644 --- a/mysql-test/suite/innodb_zip/r/create_options.result +++ b/mysql-test/suite/innodb_zip/r/create_options.result @@ -1,5 +1,4 @@ SET default_storage_engine=InnoDB; -SET GLOBAL innodb_file_per_table=ON; SET SESSION innodb_strict_mode = ON; # Test 1) StrictMode=ON, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0 # KEY_BLOCK_SIZE=0 means 'no KEY_BLOCK_SIZE is specified' @@ -280,6 +279,8 @@ Level Code Message # innodb_file_per_table=OFF and that they can be set to default # values during strict mode. SET GLOBAL innodb_file_per_table=OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release DROP TABLE t1; CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=1; Got one of the listed errors @@ -354,9 +355,13 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME ROW_FORMAT CREATE_OPTIONS t1 Dynamic SET GLOBAL innodb_file_per_table=ON; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release DROP TABLE t1; CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; SET GLOBAL innodb_file_per_table=OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ALTER TABLE t1 ADD COLUMN f1 INT; SHOW WARNINGS; Level Code Message @@ -367,6 +372,8 @@ ALTER TABLE t1 ADD COLUMN f2 INT; SHOW WARNINGS; Level Code Message SET GLOBAL innodb_file_per_table=ON; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ################################################## SET SESSION innodb_strict_mode = OFF; # Test 9) StrictMode=OFF, CREATE and ALTER with each ROW_FORMAT & KEY_BLOCK_SIZE=0 @@ -722,6 +729,8 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME ROW_FORMAT CREATE_OPTIONS t1 Compressed row_format=COMPRESSED key_block_size=2 SET GLOBAL innodb_file_per_table=OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ALTER TABLE t1 ADD COLUMN f1 INT; SHOW WARNINGS; Level Code Message @@ -729,6 +738,8 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME ROW_FORMAT CREATE_OPTIONS t1 Compressed row_format=COMPRESSED key_block_size=2 SET GLOBAL innodb_file_per_table=ON; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ALTER TABLE t1 ADD COLUMN f2 INT; SHOW WARNINGS; Level Code Message @@ -743,6 +754,8 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME ROW_FORMAT CREATE_OPTIONS t1 Dynamic row_format=DYNAMIC SET GLOBAL innodb_file_per_table=OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ALTER TABLE t1 ADD COLUMN f1 INT; SHOW WARNINGS; Level Code Message @@ -750,6 +763,8 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME ROW_FORMAT CREATE_OPTIONS t1 Dynamic row_format=DYNAMIC SET GLOBAL innodb_file_per_table=ON; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ALTER TABLE t1 ADD COLUMN f2 INT; SHOW WARNINGS; Level Code Message diff --git a/mysql-test/suite/innodb_zip/r/index_large_prefix.result b/mysql-test/suite/innodb_zip/r/index_large_prefix.result index ce3023277136e..81bdcdeb7400f 100644 --- a/mysql-test/suite/innodb_zip/r/index_large_prefix.result +++ b/mysql-test/suite/innodb_zip/r/index_large_prefix.result @@ -1,5 +1,4 @@ SET default_storage_engine=InnoDB; -set global innodb_file_per_table=1; ### Test 1 ### create table worklog5743(a TEXT not null, primary key (a(1000))) ROW_FORMAT=DYNAMIC; show warnings; @@ -449,4 +448,3 @@ create index idx on worklog5743(a(768)); ERROR HY000: Index column size too large. The maximum column size is 767 bytes create index idx2 on worklog5743(a(767)); drop table worklog5743; -SET GLOBAL innodb_file_per_table=1; diff --git a/mysql-test/suite/innodb_zip/r/innodb-zip.result b/mysql-test/suite/innodb_zip/r/innodb-zip.result index 0a3119f48a489..c44eefcbbb01e 100644 --- a/mysql-test/suite/innodb_zip/r/innodb-zip.result +++ b/mysql-test/suite/innodb_zip/r/innodb-zip.result @@ -6,7 +6,10 @@ WHERE table_schema='mysqltest_innodb_zip'; table_name row_format data_length index_length SET @save_innodb_stats_on_metadata=@@global.innodb_stats_on_metadata; set session innodb_strict_mode=0; +SET @save_fpt=@@GLOBAL.innodb_file_per_table; set global innodb_file_per_table=off; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SET @@global.innodb_stats_on_metadata=ON; create table t0(a int primary key) engine=innodb row_format=compressed; Warnings: @@ -32,6 +35,8 @@ Warnings: Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1. set global innodb_file_per_table=on; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release create table t6(a int primary key) engine=innodb key_block_size=1 row_format=redundant; Warnings: @@ -153,7 +158,6 @@ count(*) 1 update t1 set c3 = repeat('E', 20000) where c1 = 1; drop table t1; -set global innodb_file_per_table = on; set innodb_strict_mode = off; create table t1 (id int primary key) engine = innodb key_block_size = 0; drop table t1; @@ -247,6 +251,8 @@ Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql' and table_schema != 'sys' order by table_name; table_schema table_name row_format data_length index_length set global innodb_file_per_table = off; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release create table t1 (id int primary key) engine = innodb key_block_size = 1; ERROR HY000: Can't create table `mysqltest_innodb_zip`.`t1` (errno: 140 "Wrong create options") show warnings; @@ -286,4 +292,8 @@ mysqltest_innodb_zip t7 Dynamic {valid} 0 mysqltest_innodb_zip t8 Compact {valid} 0 mysqltest_innodb_zip t9 Redundant {valid} 0 drop table t7, t8, t9; +SET GLOBAL innodb_file_per_table=@save_fpt; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release +SET @@global.innodb_stats_on_metadata=@save_innodb_stats_on_metadata; DROP DATABASE mysqltest_innodb_zip; diff --git a/mysql-test/suite/innodb_zip/r/large_blob.result b/mysql-test/suite/innodb_zip/r/large_blob.result index 7070d610f584c..55bb90aab5c83 100644 --- a/mysql-test/suite/innodb_zip/r/large_blob.result +++ b/mysql-test/suite/innodb_zip/r/large_blob.result @@ -1,8 +1,9 @@ # # This tests the use of large blobs in InnoDB. # -call mtr.add_suppression("InnoDB: Warning: a long semaphore wait"); SET GLOBAL innodb_file_per_table = OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release # # System tablespace, Row Format = Redundant # @@ -26,6 +27,8 @@ INSERT INTO t1 VALUES (1, ''); UPDATE t1 SET c2=@longblob; DROP TABLE t1; SET GLOBAL innodb_file_per_table = ON; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release # # Separate tablespace, Row Format = Redundant # diff --git a/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff b/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff index 494da214f2e65..0ba8a299ab96c 100644 --- a/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff +++ b/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff @@ -21,9 +21,9 @@ -test/t3 DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd +test/t3 DEFAULT 2048 MYSQLD_DATADIR/test/t3.ibd test/t4 DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd + innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 DROP TABLE t1, t2, t3, t4; - # Test 4) The maximum row size is dependent upon the page size. -@@ -51,141 +51,90 @@ +@@ -52,141 +52,90 @@ SET SESSION innodb_strict_mode = ON; CREATE TABLE t1 ( c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), @@ -211,7 +211,7 @@ ALTER TABLE t1 KEY_BLOCK_SIZE=4; SHOW WARNINGS; Level Code Message -@@ -217,15 +166,21 @@ +@@ -218,15 +167,21 @@ DROP TABLE t1; SET SESSION innodb_strict_mode = OFF; CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; @@ -233,7 +233,7 @@ SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -@@ -269,6 +224,7 @@ +@@ -272,6 +227,7 @@ ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message @@ -241,7 +241,7 @@ Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options") Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB -@@ -276,105 +232,11 @@ +@@ -279,107 +235,13 @@ ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message @@ -250,6 +250,8 @@ Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options") Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB SET GLOBAL innodb_file_per_table = ON; + Warnings: + Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release -# Test 7) This series of tests were moved from innodb-index to here -# because the second alter table t1 assumes a 16k page size. -# Moving the test allows the rest of innodb-index to be run on all @@ -348,7 +350,7 @@ # Test 8) Test creating a table that could lead to undo log overflow. CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, h blob,i blob,j blob,k blob,l blob,m blob,n blob, -@@ -389,10 +251,6 @@ +@@ -394,10 +256,6 @@ UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b, k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b; CREATE INDEX t1a ON t1 (a(767)); @@ -359,7 +361,7 @@ UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c; CREATE INDEX t1f ON t1 (f(767)); -@@ -407,37 +265,15 @@ +@@ -412,37 +270,15 @@ COMMIT; CREATE INDEX t1g ON t1 (g(767)); UPDATE t1 SET g=@e; @@ -401,7 +403,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( -@@ -463,28 +299,12 @@ +@@ -468,28 +304,12 @@ `t` blob DEFAULT NULL, `u` blob DEFAULT NULL, KEY `t1a` (`a`(767)), @@ -432,7 +434,7 @@ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC DROP TABLE t1; # Bug#12547647 UPDATE LOGGING COULD EXCEED LOG PAGE SIZE -@@ -569,27 +389,25 @@ +@@ -574,27 +394,25 @@ DROP TABLE t1; CREATE TABLE t1( c text NOT NULL, d text NOT NULL, diff --git a/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff b/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff index a22fa9e9b9580..0d215684e2fd9 100644 --- a/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff +++ b/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff @@ -21,9 +21,9 @@ -test/t3 DEFAULT 8192 MYSQLD_DATADIR/test/t3.ibd +test/t3 DEFAULT 4096 MYSQLD_DATADIR/test/t3.ibd test/t4 DEFAULT DEFAULT MYSQLD_DATADIR/test/t4.ibd + innodb_temporary DEFAULT DEFAULT MYSQLD_DATADIR/ibtmp1 DROP TABLE t1, t2, t3, t4; - # Test 4) The maximum row size is dependent upon the page size. -@@ -53,133 +53,97 @@ +@@ -54,133 +54,97 @@ c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), c11 char(200), c12 char(200), c13 char(200), c14 char(200), c15 char(200), @@ -199,7 +199,7 @@ SHOW WARNINGS; Level Code Message SELECT table_name, row_format, create_options -@@ -217,8 +181,11 @@ +@@ -218,8 +182,11 @@ DROP TABLE t1; SET SESSION innodb_strict_mode = OFF; CREATE TABLE t1 (i int) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16; @@ -211,7 +211,7 @@ SELECT table_name, row_format, create_options FROM information_schema.tables WHERE table_name = 't1'; table_name row_format create_options -@@ -276,105 +243,11 @@ +@@ -279,107 +246,13 @@ ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options") SHOW WARNINGS; Level Code Message @@ -220,6 +220,8 @@ Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options") Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB SET GLOBAL innodb_file_per_table = ON; + Warnings: + Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release -# Test 7) This series of tests were moved from innodb-index to here -# because the second alter table t1 assumes a 16k page size. -# Moving the test allows the rest of innodb-index to be run on all @@ -318,7 +320,7 @@ # Test 8) Test creating a table that could lead to undo log overflow. CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, h blob,i blob,j blob,k blob,l blob,m blob,n blob, -@@ -389,10 +262,6 @@ +@@ -394,10 +267,6 @@ UPDATE t1 SET a=@b,b=@b,c=@b,d=@b,e=@b,f=@b,g=@b,h=@b,i=@b,j=@b, k=@b,l=@b,m=@b,n=@b,o=@b,p=@b,q=@b,r=@b,s=@b,t=@b,u=@b; CREATE INDEX t1a ON t1 (a(767)); @@ -329,7 +331,7 @@ UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c, k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c; CREATE INDEX t1f ON t1 (f(767)); -@@ -407,30 +276,6 @@ +@@ -412,30 +281,6 @@ COMMIT; CREATE INDEX t1g ON t1 (g(767)); UPDATE t1 SET g=@e; @@ -360,7 +362,7 @@ CREATE INDEX t1t ON t1 (t(767)); BEGIN; UPDATE t1 SET t=@e; -@@ -463,24 +308,8 @@ +@@ -468,24 +313,8 @@ `t` blob DEFAULT NULL, `u` blob DEFAULT NULL, KEY `t1a` (`a`(767)), @@ -385,7 +387,7 @@ KEY `t1t` (`t`(767)), KEY `t1u` (`u`(767)), KEY `t1ut` (`u`(767),`t`(767)), -@@ -572,14 +401,14 @@ +@@ -577,14 +406,14 @@ PRIMARY KEY (c(767),d(767))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; Warnings: @@ -402,7 +404,7 @@ DROP TABLE t1; CREATE TABLE t1( c text NOT NULL, d text NOT NULL, -@@ -589,7 +418,7 @@ +@@ -594,7 +423,7 @@ CREATE TABLE t1(c text, PRIMARY KEY (c(440))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; Warnings: diff --git a/mysql-test/suite/innodb_zip/r/page_size.result b/mysql-test/suite/innodb_zip/r/page_size.result index 47effe0688443..71e8e5461d3a0 100644 --- a/mysql-test/suite/innodb_zip/r/page_size.result +++ b/mysql-test/suite/innodb_zip/r/page_size.result @@ -263,6 +263,8 @@ DROP TABLE t1; # Test 6) KEY_BLOCK_SIZE with innodb_file_per_table=OFF SET SESSION innodb_strict_mode = ON; SET GLOBAL innodb_file_per_table = OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SHOW VARIABLES LIKE 'innodb_file_per_table'; Variable_name Value innodb_file_per_table OFF @@ -281,6 +283,8 @@ Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options") Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB SET GLOBAL innodb_file_per_table = ON; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release # Test 7) This series of tests were moved from innodb-index to here # because the second alter table t1 assumes a 16k page size. # Moving the test allows the rest of innodb-index to be run on all diff --git a/mysql-test/suite/innodb_zip/r/restart.result b/mysql-test/suite/innodb_zip/r/restart.result index eb1bfe67c5d47..b57fe1e89e6d6 100644 --- a/mysql-test/suite/innodb_zip/r/restart.result +++ b/mysql-test/suite/innodb_zip/r/restart.result @@ -3,7 +3,6 @@ SET default_storage_engine=InnoDB; # A series of tests to make sure tables are opened after restart. # Bug#13357607 Compressed file-per-table tablespaces fail to open # -set global innodb_file_per_table=on; # # Create and insert records into a REDUNDANT row formatted table. # @@ -265,9 +264,6 @@ t7_restart#p#p1#sp#s3.ibd # Start the server and show that tables are still visible and accessible. # # restart -SHOW VARIABLES LIKE 'innodb_file_per_table'; -Variable_name Value -innodb_file_per_table ON SHOW CREATE TABLE t1_restart; Table Create Table t1_restart CREATE TABLE `t1_restart` ( @@ -522,9 +518,6 @@ t7_restart#p#p1#sp#s3.ibd # Start the server and show the tablespaces. # # restart -SHOW VARIABLES LIKE 'innodb_file_per_table'; -Variable_name Value -innodb_file_per_table ON === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Page_Size Zip_Size Path test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd @@ -723,9 +716,6 @@ t77_restart#p#p1#sp#s3.ibd # Restart the server # # restart -SHOW VARIABLES LIKE 'innodb_file_per_table'; -Variable_name Value -innodb_file_per_table ON === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === Space_Name Page_Size Zip_Size Path test/t4_restart DEFAULT DEFAULT MYSQLD_DATADIR/test/t4_restart.ibd 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 62a28a981cdb3..f44190680c095 100644 --- a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result @@ -94,11 +94,6 @@ ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Got error 42 '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_check_bitmap_failure"; -ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Index for table 't1' is corrupt; try to repair it -SET SESSION debug_dbug=@saved_debug_dbug; -restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; ALTER TABLE t1 IMPORT TABLESPACE; ERROR HY000: Index for table 't1' is corrupt; try to repair it diff --git a/mysql-test/suite/innodb_zip/r/wl5522_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_zip.result index 1b044d68680fd..a7cc00cb1fd4c 100644 --- a/mysql-test/suite/innodb_zip/r/wl5522_zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_zip.result @@ -263,6 +263,8 @@ c1 c2 unlink: t1.cfg DROP TABLE t1; SET GLOBAL innodb_file_per_table = 0; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB; @@ -280,6 +282,8 @@ Warning 1809 Table `test`.`t1` in system tablespace UNLOCK TABLES; DROP TABLE t1; SET GLOBAL innodb_file_per_table = 1; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT, INDEX idx(c2)) ENGINE=InnoDB diff --git a/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result b/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result index 05b4793eb4d87..f46678340e2a7 100644 --- a/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result +++ b/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result @@ -8,7 +8,6 @@ # check the size and compression stats of the table tab5 #****************************************************************** # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_cmp_per_index_enabled=ON; SET GLOBAL innodb_compression_level=0; #****************************************************************** @@ -318,7 +317,6 @@ The size of the tab5.ibd file: 5242880 # set the flag on (default off) SET GLOBAL innodb_cmp_per_index_enabled=ON; # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_compression_level=0; # fetch the compressed page and check the stats # The stats figure may be different/same for each restart. @@ -655,7 +653,6 @@ The size of the tab5.ibd file: 2097152 # set the flag on (default off) SET GLOBAL innodb_cmp_per_index_enabled=ON; # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_compression_level=0; # fetch the compressed page and check the stats # The stats figure may be different/same for each restart. @@ -1615,7 +1612,6 @@ DROP TABLE tab5; SET GLOBAL innodb_cmp_per_index_enabled=0; SET GLOBAL innodb_cmp_per_index_enabled=1; # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_compression_level=9; #****************************************************************** # Test 2-1K: innodb_cmp_per_index_enabled=ON and innodb_compression_level=9 with page size 1K @@ -1926,7 +1922,6 @@ The size of the tab5.ibd file: 65536 # set the flag on (default off) SET GLOBAL innodb_cmp_per_index_enabled=ON; # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_compression_level=9; # fetch the compressed page and check the stats # The stats figure may be different/same for each restart. @@ -2265,7 +2260,6 @@ The size of the tab5.ibd file: 65536 # set the flag on (default off) SET GLOBAL innodb_cmp_per_index_enabled=ON; # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_compression_level=9; # fetch the compressed page and check the stats # The stats figure may be different/same for each restart. @@ -4710,8 +4704,6 @@ SELECT @@innodb_cmp_per_index_enabled; @@innodb_cmp_per_index_enabled 1 SELECT @@innodb_compression_failure_threshold_pct; @@innodb_compression_failure_threshold_pct 0 -SELECT @@innodb_file_per_table; -@@innodb_file_per_table 1 SELECT @@innodb_compression_level; @@innodb_compression_level 6 #****************************************************************** @@ -5022,7 +5014,6 @@ The size of the tab5.ibd file: 65536 SET GLOBAL innodb_cmp_per_index_enabled=ON; # set the flags SET GLOBAL innodb_compression_failure_threshold_pct=0; -SET GLOBAL innodb_file_per_table=on; # fetch the compressed page and check the stats # The stats figure may be different/same for each restart. =============== @@ -6289,7 +6280,6 @@ DROP TABLE tab5; SET GLOBAL innodb_cmp_per_index_enabled=OFF; SET GLOBAL innodb_cmp_per_index_enabled=ON; # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_cmp_per_index_enabled=ON; SET GLOBAL innodb_compression_failure_threshold_pct=10; SET GLOBAL innodb_compression_level=Default; @@ -6298,8 +6288,6 @@ SELECT @@innodb_cmp_per_index_enabled; @@innodb_cmp_per_index_enabled 1 SELECT @@innodb_compression_failure_threshold_pct; @@innodb_compression_failure_threshold_pct 10 -SELECT @@innodb_file_per_table; -@@innodb_file_per_table 1 SELECT @@innodb_compression_level; @@innodb_compression_level 6 #****************************************************************** @@ -6610,8 +6598,6 @@ The size of the tab5.ibd file: 65536 SET GLOBAL innodb_cmp_per_index_enabled=ON; # set the flags SET GLOBAL innodb_compression_failure_threshold_pct=10; -SET GLOBAL innodb_file_per_table=on; -SET GLOBAL innodb_compression_failure_threshold_pct=10; # fetch the compressed page and check the stats # The stats figure may be different/same for each restart. =============== @@ -7874,7 +7860,6 @@ DROP TABLE tab5; # reset the stat table before starting next testcase SET GLOBAL innodb_cmp_per_index_enabled=0; SET GLOBAL innodb_cmp_per_index_enabled=1; -SET GLOBAL innodb_file_per_table=ON; SET GLOBAL innodb_compression_level=default; SET GLOBAL innodb_compression_failure_threshold_pct=default; # create a table page size=1K @@ -7923,6 +7908,5 @@ compress_ops_ok 1 DROP TABLE tab5, test.tab5; DROP DATABASE sb; # reset the flags -SET GLOBAL innodb_file_per_table=default; SET GLOBAL innodb_cmp_per_index_enabled=default; SET GLOBAL innodb_compression_failure_threshold_pct=default; diff --git a/mysql-test/suite/innodb_zip/t/bug36169.test b/mysql-test/suite/innodb_zip/t/bug36169.test index 07566b204bdca..8ab970f67b2cf 100644 --- a/mysql-test/suite/innodb_zip/t/bug36169.test +++ b/mysql-test/suite/innodb_zip/t/bug36169.test @@ -5,9 +5,6 @@ -- source include/innodb_page_size_small.inc -let $file_per_table=`select @@innodb_file_per_table`; -SET GLOBAL innodb_file_per_table=ON; - # # The following is copied from http://bugs.mysql.com/36169 # (http://bugs.mysql.com/file.php?id=9121) @@ -1155,7 +1152,5 @@ DROP TABLE IF EXISTS table2; DROP TABLE IF EXISTS table3; DROP TABLE IF EXISTS table4; DROP TABLE IF EXISTS table5; +-- enable_query_log DROP TABLE IF EXISTS table6; - -EVAL SET GLOBAL innodb_file_per_table=$file_per_table; -SET sql_mode = default; diff --git a/mysql-test/suite/innodb_zip/t/bug53591.test b/mysql-test/suite/innodb_zip/t/bug53591.test index 17c79e0f6f881..ef4d12ad078ec 100644 --- a/mysql-test/suite/innodb_zip/t/bug53591.test +++ b/mysql-test/suite/innodb_zip/t/bug53591.test @@ -2,13 +2,6 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); -let $file_per_table=`select @@innodb_file_per_table`; - -SET GLOBAL innodb_file_per_table=on; -SET GLOBAL innodb_strict_mode=on; - -set old_alter_table=0; - CREATE TABLE bug53591(a text charset utf8 not null) ENGINE=InnoDB KEY_BLOCK_SIZE=1; -- replace_result 8126 {checked_valid} 4030 {checked_valid} 1982 {checked_valid} @@ -18,6 +11,3 @@ ALTER TABLE bug53591 ADD PRIMARY KEY(a(220)); SHOW WARNINGS; DROP TABLE bug53591; - -EVAL SET GLOBAL innodb_file_per_table=$file_per_table; -SET GLOBAL innodb_strict_mode=DEFAULT; diff --git a/mysql-test/suite/innodb_zip/t/bug56680.test b/mysql-test/suite/innodb_zip/t/bug56680.test index 54cbc7ca798ca..0d441dea0f563 100644 --- a/mysql-test/suite/innodb_zip/t/bug56680.test +++ b/mysql-test/suite/innodb_zip/t/bug56680.test @@ -16,7 +16,6 @@ SET GLOBAL innodb_change_buffering_debug = 1; -- enable_query_log SET GLOBAL tx_isolation='REPEATABLE-READ'; -SET GLOBAL innodb_file_per_table=on; CREATE TABLE bug56680( a INT AUTO_INCREMENT PRIMARY KEY, diff --git a/mysql-test/suite/innodb_zip/t/cmp_drop_table.test b/mysql-test/suite/innodb_zip/t/cmp_drop_table.test index ae6bfd9fb594b..e64514fc9fbbe 100644 --- a/mysql-test/suite/innodb_zip/t/cmp_drop_table.test +++ b/mysql-test/suite/innodb_zip/t/cmp_drop_table.test @@ -3,12 +3,8 @@ # scans through pages -- source include/not_encrypted.inc -let $per_table=`select @@innodb_file_per_table`; - -- let $query_i_s = SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0 -set global innodb_file_per_table=on; - create table t1(a text) engine=innodb key_block_size=4; -- disable_query_log @@ -50,10 +46,3 @@ while ($i) -- eval $query_i_s drop table t2; - -# -# restore environment to the state it was before this test execution -# - --- disable_query_log -eval set global innodb_file_per_table=$per_table; diff --git a/mysql-test/suite/innodb_zip/t/create_options.test b/mysql-test/suite/innodb_zip/t/create_options.test index fce64060df3df..9840a28a2ce13 100644 --- a/mysql-test/suite/innodb_zip/t/create_options.test +++ b/mysql-test/suite/innodb_zip/t/create_options.test @@ -59,11 +59,6 @@ --source include/innodb_page_size_small.inc SET default_storage_engine=InnoDB; -# These values can change during the test -LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`; - -SET GLOBAL innodb_file_per_table=ON; - # The first half of these tests are with strict mode ON. SET SESSION innodb_strict_mode = ON; @@ -481,7 +476,3 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE --echo # Cleanup DROP TABLE t1; - ---disable_query_log -EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; ---enable_query_log diff --git a/mysql-test/suite/innodb_zip/t/index_large_prefix.test b/mysql-test/suite/innodb_zip/t/index_large_prefix.test index a254c4e61eea5..5c1e31a2db770 100644 --- a/mysql-test/suite/innodb_zip/t/index_large_prefix.test +++ b/mysql-test/suite/innodb_zip/t/index_large_prefix.test @@ -10,10 +10,6 @@ SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed; SET GLOBAL innodb_read_only_compressed=OFF; --enable_query_log -let $innodb_file_per_table_orig=`select @@innodb_file_per_table`; - -set global innodb_file_per_table=1; - -- echo ### Test 1 ### # Create a table of DYNAMIC format, with a primary index of 1000 bytes in # size @@ -408,5 +404,3 @@ create index idx2 on worklog5743(a(767)); SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; --enable_query_log drop table worklog5743; - -eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; diff --git a/mysql-test/suite/innodb_zip/t/index_large_prefix_4k.test b/mysql-test/suite/innodb_zip/t/index_large_prefix_4k.test index 04f7ac65edf71..8ada226779aaa 100644 --- a/mysql-test/suite/innodb_zip/t/index_large_prefix_4k.test +++ b/mysql-test/suite/innodb_zip/t/index_large_prefix_4k.test @@ -10,10 +10,6 @@ SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed; SET GLOBAL innodb_read_only_compressed=OFF; --enable_query_log -let $innodb_file_per_table_orig=`select @@innodb_file_per_table`; - -set global innodb_file_per_table=1; - -- echo ### Test 1 ### # Create a table of DYNAMIC format, with a primary index of 768 bytes in # size @@ -380,5 +376,3 @@ create index idx2 on worklog5743(a(767)); SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; --enable_query_log drop table worklog5743; - -eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; diff --git a/mysql-test/suite/innodb_zip/t/index_large_prefix_8k.test b/mysql-test/suite/innodb_zip/t/index_large_prefix_8k.test index c9cd9574a95c8..e20de5e3e9395 100644 --- a/mysql-test/suite/innodb_zip/t/index_large_prefix_8k.test +++ b/mysql-test/suite/innodb_zip/t/index_large_prefix_8k.test @@ -10,10 +10,6 @@ SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed; SET GLOBAL innodb_read_only_compressed=OFF; --enable_query_log -let $innodb_file_per_table_orig=`select @@innodb_file_per_table`; - -set global innodb_file_per_table=1; - -- echo ### Test 1 ### # Create a table of DYNAMIC format, with a primary index of 1000 bytes in # size @@ -402,5 +398,3 @@ create index idx2 on worklog5743(a(767)); SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; --enable_query_log drop table worklog5743; - -eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; diff --git a/mysql-test/suite/innodb_zip/t/innodb-zip.test b/mysql-test/suite/innodb_zip/t/innodb-zip.test index 507900aa88cce..47867f3fa3e17 100644 --- a/mysql-test/suite/innodb_zip/t/innodb-zip.test +++ b/mysql-test/suite/innodb_zip/t/innodb-zip.test @@ -6,12 +6,12 @@ SELECT table_name, row_format, data_length, index_length FROM information_schema.tables WHERE table_schema='mysqltest_innodb_zip'; -let $per_table=`select @@innodb_file_per_table`; SET @save_innodb_stats_on_metadata=@@global.innodb_stats_on_metadata; --let $query_i_s = SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql' and table_schema != 'sys' order by table_name set session innodb_strict_mode=0; +SET @save_fpt=@@GLOBAL.innodb_file_per_table; set global innodb_file_per_table=off; SET @@global.innodb_stats_on_metadata=ON; @@ -123,8 +123,6 @@ select count(*) from t1 where c4 = repeat('C', 20000); update t1 set c3 = repeat('E', 20000) where c1 = 1; drop table t1; -set global innodb_file_per_table = on; - set innodb_strict_mode = off; create table t1 (id int primary key) engine = innodb key_block_size = 0; drop table t1; @@ -254,9 +252,7 @@ drop table t7, t8, t9; # restore environment to the state it was before this test execution # --- disable_query_log -eval set global innodb_file_per_table=$per_table; +SET GLOBAL innodb_file_per_table=@save_fpt; SET @@global.innodb_stats_on_metadata=@save_innodb_stats_on_metadata; ---enable_query_log DROP DATABASE mysqltest_innodb_zip; diff --git a/mysql-test/suite/innodb_zip/t/large_blob.test b/mysql-test/suite/innodb_zip/t/large_blob.test index dd208129d0871..d8163737a173c 100644 --- a/mysql-test/suite/innodb_zip/t/large_blob.test +++ b/mysql-test/suite/innodb_zip/t/large_blob.test @@ -7,9 +7,6 @@ --source include/big_test.inc --disable_query_log -# These values can change during the test -let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; - # Create a 20MB blob that does not compress easily. # 1000 Random characters is enough to keep compression low. set @alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -27,8 +24,6 @@ while ($1 > 1) set @longblob=repeat(@blob,200000); --enable_query_log -call mtr.add_suppression("InnoDB: Warning: a long semaphore wait"); - SET GLOBAL innodb_file_per_table = OFF; --echo # @@ -123,7 +118,3 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES (1, ''); UPDATE t1 SET c2=@longblob; DROP TABLE t1; - ---disable_query_log -EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; ---enable_query_log diff --git a/mysql-test/suite/innodb_zip/t/restart.test b/mysql-test/suite/innodb_zip/t/restart.test index c442b919d71ad..644496d70d654 100644 --- a/mysql-test/suite/innodb_zip/t/restart.test +++ b/mysql-test/suite/innodb_zip/t/restart.test @@ -34,12 +34,8 @@ call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot --disable_query_log let $MYSQL_DATA_DIR= `select @@datadir`; let $data_directory = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir'; - -let $innodb_file_per_table_orig=`select @@innodb_file_per_table`; --enable_query_log -set global innodb_file_per_table=on; - --echo # --echo # Create and insert records into a REDUNDANT row formatted table. --echo # @@ -181,7 +177,6 @@ SELECT count(*) FROM t7_restart; --echo # --source include/start_mysqld.inc -SHOW VARIABLES LIKE 'innodb_file_per_table'; SHOW CREATE TABLE t1_restart; SHOW CREATE TABLE t2_restart; SHOW CREATE TABLE t3_restart; @@ -274,8 +269,6 @@ SHOW CREATE TABLE t7_restart; --echo # --source include/start_mysqld.inc -SHOW VARIABLES LIKE 'innodb_file_per_table'; - --source suite/innodb/include/show_i_s_tablespaces.inc SELECT count(*) FROM t5_restart; @@ -364,7 +357,6 @@ SHOW CREATE TABLE t77_restart; --echo # Restart the server --echo # --source include/restart_mysqld.inc -SHOW VARIABLES LIKE 'innodb_file_per_table'; --source suite/innodb/include/show_i_s_tablespaces.inc @@ -599,8 +591,3 @@ DROP TABLE t77_restart; --rmdir $MYSQL_TMP_DIR/alt_dir --rmdir $MYSQL_TMP_DIR/new_dir/test --rmdir $MYSQL_TMP_DIR/new_dir - --- disable_query_log -eval set global innodb_file_per_table=$innodb_file_per_table_orig; --- enable_query_log - diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test index 36dcd1e454be9..b5bc2a94f0153 100644 --- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test +++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test @@ -226,21 +226,6 @@ do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test", "t1"); EOF -# Test failure after ibuf check -SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; - -# Need proper mapping of error codes :-( ---error ER_NOT_KEYFILE -ALTER TABLE t1 IMPORT TABLESPACE; - -SET SESSION debug_dbug=@saved_debug_dbug; - -# Restore files -perl; -do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; -ib_restore_tablespaces("test", "t1"); -EOF - # Test failure after adjusting the cluster index root page SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; diff --git a/mysql-test/suite/innodb_zip/t/wl5522_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_zip.test index dbb698cc545f3..f223d36a6de7b 100644 --- a/mysql-test/suite/innodb_zip/t/wl5522_zip.test +++ b/mysql-test/suite/innodb_zip/t/wl5522_zip.test @@ -83,7 +83,7 @@ ALTER TABLE t1 IMPORT TABLESPACE; SELECT * FROM t1; DROP TABLE t1; -# Export/import on the same instance, with --innodb-file-per-table=1 +# Export/import on the same instance CREATE TABLE t1( c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; @@ -127,7 +127,7 @@ SELECT COUNT(*) FROM t1; DROP TABLE t1; -# Export/import on the same instance, with --innodb-file-per-table=1 +# Export/import on the same instance # Insert some more records to move the LSN forward and then drop the # table and restore CREATE TABLE t1( @@ -174,7 +174,7 @@ SELECT COUNT(*) FROM t1; DROP TABLE t1; -# Export/import on the same instance, with --innodb-file-per-table=1 +# Export/import on the same instance # Insert some more records to move the LSN forward and then drop the # table and restore, this time the table has a secondary index too. CREATE TABLE t1( @@ -217,7 +217,7 @@ SELECT COUNT(*) FROM t1 WHERE c2 = 1; DROP TABLE t1; -# Export/import on the same instance, with --innodb-file-per-table=1 +# Export/import on the same instance # Insert some more records to move the LSN forward and then drop the # table and restore, this time the table has a secondary index too. # Rename the index on the create so that the IMPORT fails, drop index diff --git a/mysql-test/suite/innodb_zip/t/wl6347_comp_indx_stat.test b/mysql-test/suite/innodb_zip/t/wl6347_comp_indx_stat.test index be9a05b36ce54..ae32b03a78670 100644 --- a/mysql-test/suite/innodb_zip/t/wl6347_comp_indx_stat.test +++ b/mysql-test/suite/innodb_zip/t/wl6347_comp_indx_stat.test @@ -20,7 +20,6 @@ let MYSQLD_DATADIR=`SELECT @@datadir`; let $innodb_compression_level = `SELECT @@global.innodb_compression_level`; --echo # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_cmp_per_index_enabled=ON; SET GLOBAL innodb_compression_level=0; --disable_query_log @@ -73,7 +72,6 @@ SET GLOBAL innodb_read_only_compressed=OFF; --enable_query_log --echo # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_compression_level=0; --echo # fetch the compressed page and check the stats @@ -135,7 +133,6 @@ SET @inl_val=2; SET GLOBAL innodb_cmp_per_index_enabled=ON; --echo # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_compression_level=0; --echo # fetch the compressed page and check the stats @@ -296,7 +293,6 @@ SET GLOBAL innodb_cmp_per_index_enabled=0; SET GLOBAL innodb_cmp_per_index_enabled=1; --echo # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_compression_level=9; @@ -345,7 +341,6 @@ SET @inl_val=2; SET GLOBAL innodb_cmp_per_index_enabled=ON; --echo # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_compression_level=9; @@ -413,7 +408,6 @@ SET @inl_val=2; SET GLOBAL innodb_cmp_per_index_enabled=ON; --echo # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_compression_level=9; @@ -801,7 +795,6 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; --echo # check the flags SELECT @@innodb_cmp_per_index_enabled; SELECT @@innodb_compression_failure_threshold_pct; -SELECT @@innodb_file_per_table; SELECT @@innodb_compression_level; --echo #****************************************************************** @@ -848,8 +841,6 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; --echo # set the flags SET GLOBAL innodb_compression_failure_threshold_pct=0; -SET GLOBAL innodb_file_per_table=on; - --echo # fetch the compressed page and check the stats --echo # The stats figure may be different/same for each restart. @@ -1053,7 +1044,6 @@ SET GLOBAL innodb_cmp_per_index_enabled=OFF; SET GLOBAL innodb_cmp_per_index_enabled=ON; --echo # set the flags -SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_cmp_per_index_enabled=ON; SET GLOBAL innodb_compression_failure_threshold_pct=10; SET GLOBAL innodb_compression_level=Default; @@ -1062,7 +1052,6 @@ SET GLOBAL innodb_compression_level=Default; --echo # check the flags SELECT @@innodb_cmp_per_index_enabled; SELECT @@innodb_compression_failure_threshold_pct; -SELECT @@innodb_file_per_table; SELECT @@innodb_compression_level; --echo #****************************************************************** @@ -1109,9 +1098,6 @@ SET GLOBAL innodb_cmp_per_index_enabled=ON; --echo # set the flags SET GLOBAL innodb_compression_failure_threshold_pct=10; -SET GLOBAL innodb_file_per_table=on; -SET GLOBAL innodb_compression_failure_threshold_pct=10; - --echo # fetch the compressed page and check the stats --echo # The stats figure may be different/same for each restart. @@ -1312,7 +1298,6 @@ DROP TABLE tab5; SET GLOBAL innodb_cmp_per_index_enabled=0; SET GLOBAL innodb_cmp_per_index_enabled=1; -SET GLOBAL innodb_file_per_table=ON; SET GLOBAL innodb_compression_level=default; SET GLOBAL innodb_compression_failure_threshold_pct=default; @@ -1351,7 +1336,6 @@ DROP TABLE tab5, test.tab5; DROP DATABASE sb; --echo # reset the flags -eval SET GLOBAL innodb_file_per_table=default; eval SET GLOBAL innodb_cmp_per_index_enabled=default; --disable_query_log eval SET GLOBAL innodb_compression_level=$innodb_compression_level; diff --git a/mysql-test/suite/mariabackup/full_backup.result b/mysql-test/suite/mariabackup/full_backup.result index e69d00f86f639..1d0dffd528dfd 100644 --- a/mysql-test/suite/mariabackup/full_backup.result +++ b/mysql-test/suite/mariabackup/full_backup.result @@ -17,6 +17,7 @@ DROP TABLE t; # undo log tablespaces # call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces"); +call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=0 because previous shutdown was not with innodb_fast_shutdown=0"); # restart: --innodb_undo_tablespaces=0 # xtrabackup backup # xtrabackup prepare diff --git a/mysql-test/suite/mariabackup/full_backup.test b/mysql-test/suite/mariabackup/full_backup.test index a02435274389c..fb043f63be050 100644 --- a/mysql-test/suite/mariabackup/full_backup.test +++ b/mysql-test/suite/mariabackup/full_backup.test @@ -34,6 +34,7 @@ rmdir $targetdir; --echo # undo log tablespaces --echo # call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces"); +call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=0 because previous shutdown was not with innodb_fast_shutdown=0"); let $restart_parameters=--innodb_undo_tablespaces=0; --source include/restart_mysqld.inc diff --git a/mysql-test/suite/mariabackup/mdev-14447.result b/mysql-test/suite/mariabackup/mdev-14447.result index 16d3ab561f6ee..5db4693d75fb2 100644 --- a/mysql-test/suite/mariabackup/mdev-14447.result +++ b/mysql-test/suite/mariabackup/mdev-14447.result @@ -1,5 +1,7 @@ call mtr.add_suppression("InnoDB: New log files created"); SET GLOBAL innodb_file_per_table=0; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB; # Create full backup , modify table, then create incremental/differential backup SET debug_dbug='+d,skip_page_checksum',foreign_key_checks=0,unique_checks=0; diff --git a/mysql-test/suite/mariabackup/skip_innodb.test b/mysql-test/suite/mariabackup/skip_innodb.test index 14e4bc007f664..25495b308b029 100644 --- a/mysql-test/suite/mariabackup/skip_innodb.test +++ b/mysql-test/suite/mariabackup/skip_innodb.test @@ -1,3 +1,4 @@ +--source include/innodb_undo_tablespaces.inc let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; CREATE TABLE t(i int); INSERT INTO t VALUES(1); @@ -9,4 +10,4 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir; SELECT * from t; DROP TABLE t; -rmdir $targetdir; \ No newline at end of file +rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/undo_upgrade.result b/mysql-test/suite/mariabackup/undo_upgrade.result new file mode 100644 index 0000000000000..7b77e9ff6e697 --- /dev/null +++ b/mysql-test/suite/mariabackup/undo_upgrade.result @@ -0,0 +1,19 @@ +set global innodb_fast_shutdown=0; +# restart: --innodb_undo_tablespaces=2 +CREATE TABLE t1(a varchar(60)) ENGINE INNODB; +start transaction; +INSERT INTO t1 VALUES(1); +# xtrabackup backup +# Restart the server with 4 undo tablespaces +set global innodb_fast_shutdown=0; +# restart: --innodb_undo_tablespaces=4 +# incremental backup should fail +FOUND 1 /--incremental backup is impossible if the server had been restarted with different innodb_undo_tablespaces/ in backup.log +# Take full backup again +# Prepare full backup +# Display 4 undo log files from target directory +undo001 +undo002 +undo003 +undo004 +DROP TABLE t1; diff --git a/mysql-test/suite/mariabackup/undo_upgrade.test b/mysql-test/suite/mariabackup/undo_upgrade.test new file mode 100644 index 0000000000000..3d59926978266 --- /dev/null +++ b/mysql-test/suite/mariabackup/undo_upgrade.test @@ -0,0 +1,50 @@ +--source include/have_innodb.inc +--source include/innodb_page_size.inc + +let basedir=$MYSQLTEST_VARDIR/tmp/backup; +let incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; + +set global innodb_fast_shutdown=0; +let $restart_parameters=--innodb_undo_tablespaces=2; +--source include/restart_mysqld.inc + +CREATE TABLE t1(a varchar(60)) ENGINE INNODB; +start transaction; +INSERT INTO t1 VALUES(1); + +--echo # xtrabackup backup +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir; +--enable_result_log + +--echo # Restart the server with 4 undo tablespaces +let $restart_parameters=--innodb_undo_tablespaces=4; +set global innodb_fast_shutdown=0; +--source include/restart_mysqld.inc + +let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; +--echo # incremental backup should fail +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir 2> $backuplog; + +--let SEARCH_PATTERN=--incremental backup is impossible if the server had been restarted with different innodb_undo_tablespaces +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +remove_file $backuplog; +rmdir $incremental_dir; +rmdir $basedir; + +--echo # Take full backup again +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir; +--enable_result_log +--disable_result_log + +echo # Prepare full backup; +exec $XTRABACKUP --prepare --target-dir=$basedir; + +--echo # Display 4 undo log files from target directory +list_files $basedir undo*; + +DROP TABLE t1; +rmdir $basedir; diff --git a/mysql-test/suite/mariabackup/xb_compressed_encrypted.opt b/mysql-test/suite/mariabackup/xb_compressed_encrypted.opt index 4105fecfe5852..52ef47f3fca12 100644 --- a/mysql-test/suite/mariabackup/xb_compressed_encrypted.opt +++ b/mysql-test/suite/mariabackup/xb_compressed_encrypted.opt @@ -5,4 +5,3 @@ --loose-file-key-management --loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt --innodb_strict_mode ---innodb_file_per_table diff --git a/mysql-test/suite/mariabackup/xb_fulltext_encrypted.opt b/mysql-test/suite/mariabackup/xb_fulltext_encrypted.opt index b3ef366361ade..e3a9e5a437f11 100644 --- a/mysql-test/suite/mariabackup/xb_fulltext_encrypted.opt +++ b/mysql-test/suite/mariabackup/xb_fulltext_encrypted.opt @@ -1,6 +1,5 @@ --plugin-load-add=$FILE_KEY_MANAGEMENT_SO --innodb_strict_mode ---innodb_file_per_table --innodb-encryption-rotate-key-age=2 --innodb-encryption-threads=4 --innodb-tablespaces-encryption diff --git a/mysql-test/suite/mariabackup/xb_history.result b/mysql-test/suite/mariabackup/xb_history.result index b6a1ac211477b..9feb5f41bd2d1 100644 --- a/mysql-test/suite/mariabackup/xb_history.result +++ b/mysql-test/suite/mariabackup/xb_history.result @@ -1,5 +1,37 @@ -SELECT COUNT(*) FROM PERCONA_SCHEMA.xtrabackup_history; +DROP TABLE IF EXISTS mysql.mariadb_backup_history; +SHOW CREATE TABLE mysql.mariadb_backup_history; +Table Create Table +mariadb_backup_history CREATE TABLE `mariadb_backup_history` ( + `uuid` varchar(40) NOT NULL, + `name` varchar(255) DEFAULT NULL, + `tool_name` varchar(255) DEFAULT NULL, + `tool_command` text DEFAULT NULL, + `tool_version` varchar(255) DEFAULT NULL, + `ibbackup_version` varchar(255) DEFAULT NULL, + `server_version` varchar(255) DEFAULT NULL, + `start_time` timestamp NULL DEFAULT NULL, + `end_time` timestamp NULL DEFAULT NULL, + `lock_time` bigint(20) unsigned DEFAULT NULL, + `binlog_pos` varchar(128) DEFAULT NULL, + `innodb_from_lsn` bigint(20) unsigned DEFAULT NULL, + `innodb_to_lsn` bigint(20) unsigned DEFAULT NULL, + `partial` enum('Y','N') DEFAULT NULL, + `incremental` enum('Y','N') DEFAULT NULL, + `format` enum('file','tar','xbstream') DEFAULT NULL, + `compressed` enum('Y','N') DEFAULT NULL, + PRIMARY KEY (`uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci +SELECT COUNT(*) FROM mysql.mariadb_backup_history; COUNT(*) 1 -DROP TABLE PERCONA_SCHEMA.xtrabackup_history; -DROP DATABASE PERCONA_SCHEMA; +SELECT name FROM mysql.mariadb_backup_history; +name +foo +SELECT COUNT(*) FROM mysql.mariadb_backup_history; +COUNT(*) +2 +SELECT name FROM mysql.mariadb_backup_history; +name + +foo +DROP TABLE mysql.mariadb_backup_history; diff --git a/mysql-test/suite/mariabackup/xb_history.test b/mysql-test/suite/mariabackup/xb_history.test index 54ec5f2e729c4..f9374a1aaab2f 100644 --- a/mysql-test/suite/mariabackup/xb_history.test +++ b/mysql-test/suite/mariabackup/xb_history.test @@ -1,10 +1,27 @@ #--source include/innodb_page_size.inc +--disable_warnings +DROP TABLE IF EXISTS mysql.mariadb_backup_history; +--enable_warnings + let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; --disable_result_log exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --history=foo --backup --target-dir=$targetdir; --enable_result_log -SELECT COUNT(*) FROM PERCONA_SCHEMA.xtrabackup_history; -DROP TABLE PERCONA_SCHEMA.xtrabackup_history; -DROP DATABASE PERCONA_SCHEMA; rmdir $targetdir; + +SHOW CREATE TABLE mysql.mariadb_backup_history; +SELECT COUNT(*) FROM mysql.mariadb_backup_history; +SELECT name FROM mysql.mariadb_backup_history; + +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --history --backup --target-dir=$targetdir; +--enable_result_log +rmdir $targetdir; + +SELECT COUNT(*) FROM mysql.mariadb_backup_history; +--sorted_result +SELECT name FROM mysql.mariadb_backup_history; + +DROP TABLE mysql.mariadb_backup_history; diff --git a/mysql-test/suite/multi_source/info_logs.result b/mysql-test/suite/multi_source/info_logs.result index c19620b46ccea..a35a20bdbf764 100644 --- a/mysql-test/suite/multi_source/info_logs.result +++ b/mysql-test/suite/multi_source/info_logs.result @@ -94,17 +94,17 @@ MASTER 2.2 # EOF # show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos - Slave has read all relay log; waiting for more updates Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No optimistic 0 NULL Slave has read all relay log; waiting for more updates 0 0 0 0 1073741824 7 0 60.000 -MASTER 2.2 Slave has read all relay log; waiting for more updates Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master@00202@002e2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No optimistic 0 NULL Slave has read all relay log; waiting for more updates 0 0 0 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos + Slave has read all relay log; waiting for more updates Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No optimistic 0 NULL Slave has read all relay log; waiting for more updates 0 0 0 0 1073741824 7 0 60.000 +MASTER 2.2 Slave has read all relay log; waiting for more updates Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master@00202@002e2.000002 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No optimistic 0 NULL Slave has read all relay log; waiting for more updates 0 0 0 0 1073741824 7 0 60.000 include/wait_for_slave_to_start.inc set default_master_connection = 'MASTER 2.2'; include/wait_for_slave_to_start.inc set default_master_connection = ''; show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos - Slave has read all relay log; waiting for more updates Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No optimistic 0 NULL Slave has read all relay log; waiting for more updates 0 0 0 0 1073741824 6 0 60.000 -MASTER 2.2 Slave has read all relay log; waiting for more updates Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master@00202@002e2.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No optimistic 0 NULL Slave has read all relay log; waiting for more updates 0 0 0 0 1073741824 6 0 60.000 +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos + Slave has read all relay log; waiting for more updates Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 relay.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 1 No optimistic 0 NULL Slave has read all relay log; waiting for more updates 0 0 0 0 1073741824 6 0 60.000 +MASTER 2.2 Slave has read all relay log; waiting for more updates Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 relay-master@00202@002e2.000004 master-bin.000001 Yes Yes 0 0 None 0 No 0 No 0 0 2 No optimistic 0 NULL Slave has read all relay log; waiting for more updates 0 0 0 0 1073741824 6 0 60.000 # # List of files matching '*info*' pattern # after slave server restart diff --git a/mysql-test/suite/multi_source/multi_source_slave_alias_replica.result b/mysql-test/suite/multi_source/multi_source_slave_alias_replica.result index 25cd85d70183e..355919def5a0d 100644 --- a/mysql-test/suite/multi_source/multi_source_slave_alias_replica.result +++ b/mysql-test/suite/multi_source/multi_source_slave_alias_replica.result @@ -34,6 +34,7 @@ Relay_Log_Pos Relay_Master_Log_File master-bin.000001 Slave_IO_Running Yes Slave_SQL_Running Yes +Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table @@ -95,6 +96,7 @@ Relay_Log_Pos Relay_Master_Log_File master-bin.000001 Slave_IO_Running Yes Slave_SQL_Running Yes +Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table diff --git a/mysql-test/suite/multi_source/replicate_rewrite_db_dynamic.cnf b/mysql-test/suite/multi_source/replicate_rewrite_db_dynamic.cnf new file mode 100644 index 0000000000000..a22ddacd30f2b --- /dev/null +++ b/mysql-test/suite/multi_source/replicate_rewrite_db_dynamic.cnf @@ -0,0 +1,19 @@ +!include my.cnf + +[mysqld.1] +gtid-domain-id=1 +server-id=1 +log-bin +log-slave-updates + +[mysqld.2] +gtid-domain-id=2 +server-id=2 +log-bin +log-slave-updates + +[mysqld.3] +gtid-domain-id=3 +server-id=3 +log-bin +log-slave-updates diff --git a/mysql-test/suite/multi_source/replicate_rewrite_db_dynamic.result b/mysql-test/suite/multi_source/replicate_rewrite_db_dynamic.result new file mode 100644 index 0000000000000..3be8b36459374 --- /dev/null +++ b/mysql-test/suite/multi_source/replicate_rewrite_db_dynamic.result @@ -0,0 +1,67 @@ +connect server_1,127.0.0.1,root,,,$SERVER_MYPORT_1; +connect server_2,127.0.0.1,root,,,$SERVER_MYPORT_2; +connect server_3,127.0.0.1,root,,,$SERVER_MYPORT_3; +# Connect the slave (server_3) to two masters (server_1 and server_2) +connection server_3; +CHANGE MASTER 'm1' TO master_port=MYPORT_1, master_host='127.0.0.1', master_user='root'; +CHANGE MASTER 'm2' TO master_port=MYPORT_2, master_host='127.0.0.1', master_user='root'; +# Apply events from server_1 (m1) into m1_test +create database m1_test; +SET @@global.'m1'.replicate_rewrite_db='test->m1_test'; +# Apply events from server_2 (m2) into m2_test +create database m2_test; +SET @@global.'m2'.replicate_rewrite_db='test->m2_test'; +start all slaves; +Warnings: +Note 1937 SLAVE 'm2' started +Note 1937 SLAVE 'm1' started +set default_master_connection = 'm1'; +include/wait_for_slave_to_start.inc +set default_master_connection = 'm2'; +include/wait_for_slave_to_start.inc +# Create test data for servers 1 and 2 with different data +connection server_1; +create table t (a int); +insert into t values (1); +insert into t values (2); +insert into t values (3); +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_2; +create table t (a int); +insert into t values (4); +insert into t values (5); +insert into t values (6); +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +# Ensure the slave correctly replicates data from each master into its +# respective database +include/diff_tables.inc [server_1:test.t,server_3:m1_test.t] +include/diff_tables.inc [server_2:test.t,server_3:m2_test.t] +# +# Cleanup +connection server_1; +DROP TABLE t; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_2; +DROP TABLE t; +include/save_master_gtid.inc +connection server_3; +include/sync_with_master_gtid.inc +connection server_3; +stop all slaves; +Warnings: +Note 1938 SLAVE 'm2' stopped +Note 1938 SLAVE 'm1' stopped +SET default_master_connection = "m1"; +include/wait_for_slave_to_stop.inc +SET default_master_connection = "m2"; +include/wait_for_slave_to_stop.inc +RESET SLAVE ALL; +DROP DATABASE m1_test; +DROP DATABASE m2_test; +# End of replicate_rewrite_db_dynamic.test diff --git a/mysql-test/suite/multi_source/replicate_rewrite_db_dynamic.test b/mysql-test/suite/multi_source/replicate_rewrite_db_dynamic.test new file mode 100644 index 0000000000000..e1bbfabe18068 --- /dev/null +++ b/mysql-test/suite/multi_source/replicate_rewrite_db_dynamic.test @@ -0,0 +1,96 @@ +# +# Test multi-source dynamically setting of replication filter +# "replicate_rewrite_db" +# +# This test ensures that setting a replica's replicate_rewrite_db works on a +# per-master basis. To ensure this, this test connects a replica to two +# different primary server instances. Each primary uses the same database +# name and table name. To ensure the data operations don't interfere with one +# another on the replica, it sets replicate_rewrite_db individually per +# connection to apply the events from each primary into a database specific to +# that connection. +# + +--source include/not_embedded.inc +--source include/have_innodb.inc + +--connect (server_1,127.0.0.1,root,,,$SERVER_MYPORT_1) +--connect (server_2,127.0.0.1,root,,,$SERVER_MYPORT_2) +--connect (server_3,127.0.0.1,root,,,$SERVER_MYPORT_3) + + +--echo # Connect the slave (server_3) to two masters (server_1 and server_2) +--connection server_3 +--replace_result $SERVER_MYPORT_1 MYPORT_1 +eval CHANGE MASTER 'm1' TO master_port=$SERVER_MYPORT_1, master_host='127.0.0.1', master_user='root'; +--replace_result $SERVER_MYPORT_2 MYPORT_2 +eval CHANGE MASTER 'm2' TO master_port=$SERVER_MYPORT_2, master_host='127.0.0.1', master_user='root'; + +--echo # Apply events from server_1 (m1) into m1_test +create database m1_test; +SET @@global.'m1'.replicate_rewrite_db='test->m1_test'; + +--echo # Apply events from server_2 (m2) into m2_test +create database m2_test; +SET @@global.'m2'.replicate_rewrite_db='test->m2_test'; + +start all slaves; +set default_master_connection = 'm1'; +--source include/wait_for_slave_to_start.inc +set default_master_connection = 'm2'; +--source include/wait_for_slave_to_start.inc + +--echo # Create test data for servers 1 and 2 with different data +--connection server_1 +create table t (a int); +insert into t values (1); +insert into t values (2); +insert into t values (3); +--source include/save_master_gtid.inc +--connection server_3 +--source include/sync_with_master_gtid.inc + +--connection server_2 +create table t (a int); +insert into t values (4); +insert into t values (5); +insert into t values (6); +--source include/save_master_gtid.inc +--connection server_3 +--source include/sync_with_master_gtid.inc + +--echo # Ensure the slave correctly replicates data from each master into its +--echo # respective database +--let $diff_tables=server_1:test.t,server_3:m1_test.t +--source include/diff_tables.inc + +--let $diff_tables=server_2:test.t,server_3:m2_test.t +--source include/diff_tables.inc + + +--echo # +--echo # Cleanup + +--connection server_1 +DROP TABLE t; +--source include/save_master_gtid.inc +--connection server_3 +--source include/sync_with_master_gtid.inc + +--connection server_2 +DROP TABLE t; +--source include/save_master_gtid.inc +--connection server_3 +--source include/sync_with_master_gtid.inc + +--connection server_3 +stop all slaves; +SET default_master_connection = "m1"; +--source include/wait_for_slave_to_stop.inc +SET default_master_connection = "m2"; +--source include/wait_for_slave_to_stop.inc +RESET SLAVE ALL; +DROP DATABASE m1_test; +DROP DATABASE m2_test; + +--echo # End of replicate_rewrite_db_dynamic.test diff --git a/mysql-test/suite/multi_source/reset_slave.result b/mysql-test/suite/multi_source/reset_slave.result index a55a6ec235fa4..2e9ce5e896f36 100644 --- a/mysql-test/suite/multi_source/reset_slave.result +++ b/mysql-test/suite/multi_source/reset_slave.result @@ -13,15 +13,15 @@ insert into t1 values (1),(2); connection slave; stop slave 'master1'; show slave 'master1' status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups - 127.0.0.1 root MYPORT_1 60 master-bin.000001 mysqld-relay-bin-master1.000002 master-bin.000001 No No 0 0 None 0 No NULL No 0 0 1 Slave_Pos 0-1-3 optimistic 0 NULL 2 1 0 +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups + 127.0.0.1 root MYPORT_1 60 master-bin.000001 mysqld-relay-bin-master1.000002 master-bin.000001 No No 0 0 None 0 No NULL No 0 0 1 Slave_Pos 0-1-3 optimistic 0 NULL 2 1 0 mysqld-relay-bin-master1.000001 mysqld-relay-bin-master1.000002 mysqld-relay-bin-master1.index reset slave 'master1'; show slave 'master1' status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups - 127.0.0.1 root MYPORT_1 60 4 No No 0 0 0 None 0 No NULL No 0 0 1 Slave_Pos optimistic 0 NULL 2 1 0 +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups + 127.0.0.1 root MYPORT_1 60 4 No No 0 0 0 None 0 No NULL No 0 0 1 Slave_Pos optimistic 0 NULL 2 1 0 reset slave 'master1' all; show slave 'master1' status; ERROR HY000: There is no master connection 'master1' diff --git a/mysql-test/suite/multi_source/simple.result b/mysql-test/suite/multi_source/simple.result index 5a167907b3b8a..65c25b88e44e7 100644 --- a/mysql-test/suite/multi_source/simple.result +++ b/mysql-test/suite/multi_source/simple.result @@ -32,6 +32,7 @@ Relay_Log_Pos Relay_Master_Log_File master-bin.000001 Slave_IO_Running Yes Slave_SQL_Running Yes +Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table @@ -93,6 +94,7 @@ Relay_Log_Pos Relay_Master_Log_File master-bin.000001 Slave_IO_Running Yes Slave_SQL_Running Yes +Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table @@ -219,6 +221,7 @@ Relay_Log_Pos Relay_Master_Log_File master-bin.000001 Slave_IO_Running No Slave_SQL_Running No +Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table @@ -276,6 +279,7 @@ Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running No Slave_SQL_Running No +Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table @@ -337,6 +341,7 @@ Relay_Log_Pos Relay_Master_Log_File master-bin.000001 Slave_IO_Running Yes Slave_SQL_Running Yes +Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table @@ -400,6 +405,7 @@ Relay_Log_Pos Relay_Master_Log_File master-bin.000001 Slave_IO_Running Yes Slave_SQL_Running Yes +Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table @@ -465,6 +471,7 @@ Relay_Log_Pos Relay_Master_Log_File master-bin.000001 Slave_IO_Running No Slave_SQL_Running No +Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table diff --git a/mysql-test/suite/multi_source/syntax.result b/mysql-test/suite/multi_source/syntax.result index 35f4b3048adef..3c7c91c35c807 100644 --- a/mysql-test/suite/multi_source/syntax.result +++ b/mysql-test/suite/multi_source/syntax.result @@ -1,11 +1,11 @@ include/master-slave.inc [connection master] show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups show slave '' status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups show all slaves status; -Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Rewrite_DB Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos # # Check error handling # diff --git a/mysql-test/suite/parts/inc/part_exch_qa_7.inc b/mysql-test/suite/parts/inc/part_exch_qa_7.inc index e6276fe3ca249..117077675942e 100644 --- a/mysql-test/suite/parts/inc/part_exch_qa_7.inc +++ b/mysql-test/suite/parts/inc/part_exch_qa_7.inc @@ -1,4 +1,5 @@ CREATE USER test_2@localhost; +GRANT SELECT,INSERT,CREATE,ALTER,DROP on test.* to test_2@localhost; --source include/not_embedded.inc --disable_result_log diff --git a/mysql-test/suite/parts/r/alter_data_directory_innodb.result b/mysql-test/suite/parts/r/alter_data_directory_innodb.result index 8c07093f12728..e8f976372d6d5 100644 --- a/mysql-test/suite/parts/r/alter_data_directory_innodb.result +++ b/mysql-test/suite/parts/r/alter_data_directory_innodb.result @@ -40,6 +40,8 @@ t CREATE TABLE `t` ( PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) SET @TMP = @@GLOBAL.INNODB_FILE_PER_TABLE; SET GLOBAL INNODB_FILE_PER_TABLE=OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE; Warnings: Warning 1280 Name 'pk' ignored for PRIMARY key. @@ -53,6 +55,8 @@ t CREATE TABLE `t` ( (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) SET GLOBAL INNODB_FILE_PER_TABLE=@TMP; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO ( PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB diff --git a/mysql-test/suite/parts/r/longname.result b/mysql-test/suite/parts/r/longname.result index eb850d6f16c4d..8524eb8499d54 100644 --- a/mysql-test/suite/parts/r/longname.result +++ b/mysql-test/suite/parts/r/longname.result @@ -31,6 +31,8 @@ PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB); ERROR HY000: The path specified for @0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@0n@... is too long SET @file_per_table=@@GLOBAL.innodb_file_per_table; SET GLOBAL innodb_file_per_table=0; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE mysqltest1.t1 (a INT) ENGINE=INNODB PARTITION BY RANGE (a) SUBPARTITION BY HASH(a) (PARTITION `$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$` @@ -41,6 +43,8 @@ SUBPARTITION `0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef`) ); SET GLOBAL innodb_file_per_table=@file_per_table; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SHOW CREATE TABLE mysqltest1.t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result b/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result index 9d05d04cccade..6d361bb14655c 100644 --- a/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result +++ b/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result @@ -8,6 +8,8 @@ SET SESSION innodb_strict_mode = ON; # InnoDB only supports DATA DIRECTORY with innodb_file_per_table=ON # SET GLOBAL innodb_file_per_table = OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t1 (c1 INT) ENGINE = InnoDB PARTITION BY HASH (c1) ( PARTITION p0 @@ -36,6 +38,8 @@ Error 6 Error on delete of 'MYSQLD_DATADIR/test/t1.par' (Errcode: 2 "No such fil # SET SESSION innodb_strict_mode = OFF; SET GLOBAL innodb_file_per_table = ON; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t1 (c1 INT) ENGINE = InnoDB PARTITION BY HASH (c1) (PARTITION p0 @@ -134,6 +138,8 @@ DROP TABLE t1; # properly when used with DATA DIRECTORY # SET GLOBAL innodb_file_per_table = ON; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release CREATE TABLE t1 ( myid INT(11) NOT NULL, @@ -326,4 +332,6 @@ DROP TABLE t1, t2; # Cleanup # SET GLOBAL innodb_file_per_table=@file_per_table; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SET SESSION innodb_strict_mode=@strict_mode; diff --git a/mysql-test/suite/parts/r/partition_exch_qa_7_innodb.result b/mysql-test/suite/parts/r/partition_exch_qa_7_innodb.result index 0913bbaa55b7a..4613a2fd06468 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_7_innodb.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_7_innodb.result @@ -1,4 +1,5 @@ CREATE USER test_2@localhost; +GRANT SELECT,INSERT,CREATE,ALTER,DROP on test.* to test_2@localhost; send ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; connect test_2,localhost,test_2,,test,$MASTER_MYPORT,$MASTER_MYSOCK; diff --git a/mysql-test/suite/parts/r/partition_exch_qa_7_myisam.result b/mysql-test/suite/parts/r/partition_exch_qa_7_myisam.result index 0913bbaa55b7a..4613a2fd06468 100644 --- a/mysql-test/suite/parts/r/partition_exch_qa_7_myisam.result +++ b/mysql-test/suite/parts/r/partition_exch_qa_7_myisam.result @@ -1,4 +1,5 @@ CREATE USER test_2@localhost; +GRANT SELECT,INSERT,CREATE,ALTER,DROP on test.* to test_2@localhost; send ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10; connect test_2,localhost,test_2,,test,$MASTER_MYPORT,$MASTER_MYSOCK; diff --git a/mysql-test/suite/parts/r/reorganize_partition_innodb.result b/mysql-test/suite/parts/r/reorganize_partition_innodb.result index b56cb6bbaeb2e..b22337812199d 100644 --- a/mysql-test/suite/parts/r/reorganize_partition_innodb.result +++ b/mysql-test/suite/parts/r/reorganize_partition_innodb.result @@ -40,6 +40,8 @@ t CREATE TABLE `t` ( PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) SET @TMP = @@GLOBAL.INNODB_FILE_PER_TABLE; SET GLOBAL INNODB_FILE_PER_TABLE=OFF; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE; Warnings: Warning 1280 Name 'pk' ignored for PRIMARY key. @@ -53,6 +55,8 @@ t CREATE TABLE `t` ( (PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB, PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB) SET GLOBAL INNODB_FILE_PER_TABLE=@TMP; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO ( PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB diff --git a/mysql-test/suite/parts/t/debug_innodb_crash-master.opt b/mysql-test/suite/parts/t/debug_innodb_crash-master.opt index b7f94e14e12c0..d8813652cd63a 100644 --- a/mysql-test/suite/parts/t/debug_innodb_crash-master.opt +++ b/mysql-test/suite/parts/t/debug_innodb_crash-master.opt @@ -1 +1 @@ ---loose-innodb-file-per-table=1 --loose-skip-stack-trace --skip-core-file --loose-innodb-buffer-pool-size=32M +--loose-skip-stack-trace --skip-core-file --loose-innodb-buffer-pool-size=32M diff --git a/mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt b/mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt deleted file mode 100644 index 115a0ba2cc8db..0000000000000 --- a/mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb_file_per_table diff --git a/mysql-test/suite/perfschema/include/event_aggregate_load.inc b/mysql-test/suite/perfschema/include/event_aggregate_load.inc index b27a3113318bf..a4815eafd0fcd 100644 --- a/mysql-test/suite/perfschema/include/event_aggregate_load.inc +++ b/mysql-test/suite/perfschema/include/event_aggregate_load.inc @@ -39,7 +39,7 @@ execute dump_hosts; # # To avoid noise from main, the background threads are disabled. -connect (con1, localhost, user1, , ); +connect (con1, localhost, user1, ,test); --connection default @@ -122,7 +122,7 @@ execute dump_hosts; # select * from performance_schema.events_waits_history_long; # select PROCESSLIST_USER, PROCESSLIST_HOST, INSTRUMENTED from performance_schema.threads; -connect (con2, localhost, user2, , ); +connect (con2, localhost, user2, ,test); --connection default @@ -201,7 +201,7 @@ execute dump_accounts; execute dump_users; execute dump_hosts; -connect (con3, localhost, user3, , ); +connect (con3, localhost, user3, ,test); --connection default @@ -280,7 +280,7 @@ execute dump_accounts; execute dump_users; execute dump_hosts; -connect (con4, localhost, user4, , ); +connect (con4, localhost, user4, ,test); --connection default diff --git a/mysql-test/suite/perfschema/r/connect_attrs.result b/mysql-test/suite/perfschema/r/connect_attrs.result index aa61eb306a2db..6db8f3585d074 100644 --- a/mysql-test/suite/perfschema/r/connect_attrs.result +++ b/mysql-test/suite/perfschema/r/connect_attrs.result @@ -25,7 +25,7 @@ FROM performance_schema.session_account_connect_attrs; COUNT(DISTINCT PROCESSLIST_ID) 1 CREATE USER wl5924@localhost; -connect non_privileged_user,localhost,wl5924,,test; +connect non_privileged_user,localhost,wl5924,,"*NO-ONE*"; connection default; # must return 1 SELECT COUNT(DISTINCT PROCESSLIST_ID) diff --git a/mysql-test/suite/perfschema/r/connection_type_notwin.result b/mysql-test/suite/perfschema/r/connection_type_notwin.result index d0415cf8df693..079c71345b10d 100644 --- a/mysql-test/suite/perfschema/r/connection_type_notwin.result +++ b/mysql-test/suite/perfschema/r/connection_type_notwin.result @@ -20,7 +20,7 @@ SET @old_general_log_file= @@global.general_log_file; SET GLOBAL general_log_file = '.../log/rewrite_general_con.log'; SET GLOBAL log_output = 'FILE,TABLE'; SET GLOBAL general_log= 'ON'; -connect con1, localhost, root,,; +connect con1, localhost, root,,test; select NAME, PROCESSLIST_USER, PROCESSLIST_HOST, CONNECTION_TYPE from performance_schema.threads where PROCESSLIST_ID = connection_id(); diff --git a/mysql-test/suite/perfschema/r/connection_type_win.result b/mysql-test/suite/perfschema/r/connection_type_win.result index 8dc064babff73..c6c8b6cc77b31 100644 --- a/mysql-test/suite/perfschema/r/connection_type_win.result +++ b/mysql-test/suite/perfschema/r/connection_type_win.result @@ -55,7 +55,7 @@ select user_host, command_type, argument from mysql.general_log where command_type = "Connect"; user_host [root] @ santa.claus.ipv4.example.com [192.0.2.4] command_type Connect -argument root@santa.claus.ipv4.example.com on test using TCP/IP +argument root@santa.claus.ipv4.example.com on using TCP/IP user_host [root] @ santa.claus.ipv4.example.com [192.0.2.4] command_type Connect argument root@santa.claus.ipv4.example.com on test using TCP/IP @@ -65,7 +65,6 @@ argument rootssl@santa.claus.ipv4.example.com on test using SSL/TLS select substring(argument, locate("Connect", argument)) from test_log where argument like "%Connect%on test%"; substring(argument, locate("Connect", argument)) Connect root@santa.claus.ipv4.example.com on test using TCP/IP -substring(argument, locate("Connect", argument)) Connect root@santa.claus.ipv4.example.com on test using TCP/IP substring(argument, locate("Connect", argument)) Connect rootssl@santa.claus.ipv4.example.com on test using SSL/TLS DROP TABLE test_log; SET GLOBAL general_log_file= @old_general_log_file; diff --git a/mysql-test/suite/perfschema/r/event_aggregate.result b/mysql-test/suite/perfschema/r/event_aggregate.result index 4ad4c77394159..805378f585024 100644 --- a/mysql-test/suite/perfschema/r/event_aggregate.result +++ b/mysql-test/suite/perfschema/r/event_aggregate.result @@ -83,7 +83,7 @@ root 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 1 1 -connect con1, localhost, user1, , ; +connect con1, localhost, user1, ,test; connection default; "================== Step 2 ==================" call dump_thread(); @@ -339,7 +339,7 @@ user1 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 2 2 -connect con2, localhost, user2, , ; +connect con2, localhost, user2, ,test; connection default; "================== Step 4 ==================" call dump_thread(); @@ -663,7 +663,7 @@ user2 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 3 3 -connect con3, localhost, user3, , ; +connect con3, localhost, user3, ,test; connection default; "================== Step 6 ==================" call dump_thread(); @@ -1045,7 +1045,7 @@ user3 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 4 4 -connect con4, localhost, user4, , ; +connect con4, localhost, user4, ,test; connection default; "================== Step 8 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a.result index 9ce3bb7efe84e..30948c2e611a3 100644 --- a/mysql-test/suite/perfschema/r/event_aggregate_no_a.result +++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a.result @@ -82,7 +82,7 @@ root 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 1 1 -connect con1, localhost, user1, , ; +connect con1, localhost, user1, ,test; connection default; "================== Step 2 ==================" call dump_thread(); @@ -308,7 +308,7 @@ user1 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 2 2 -connect con2, localhost, user2, , ; +connect con2, localhost, user2, ,test; connection default; "================== Step 4 ==================" call dump_thread(); @@ -574,7 +574,7 @@ user2 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 3 3 -connect con3, localhost, user3, , ; +connect con3, localhost, user3, ,test; connection default; "================== Step 6 ==================" call dump_thread(); @@ -870,7 +870,7 @@ user3 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 4 4 -connect con4, localhost, user4, , ; +connect con4, localhost, user4, ,test; connection default; "================== Step 8 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result index 6590c162dda2a..956ea6c6488bd 100644 --- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result +++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result @@ -68,7 +68,7 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS root 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con1, localhost, user1, , ; +connect con1, localhost, user1, ,test; connection default; "================== Step 2 ==================" call dump_thread(); @@ -266,7 +266,7 @@ root 1 1 user1 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con2, localhost, user2, , ; +connect con2, localhost, user2, ,test; connection default; "================== Step 4 ==================" call dump_thread(); @@ -504,7 +504,7 @@ user1 1 1 user2 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con3, localhost, user3, , ; +connect con3, localhost, user3, ,test; connection default; "================== Step 6 ==================" call dump_thread(); @@ -772,7 +772,7 @@ user2 1 1 user3 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con4, localhost, user4, , ; +connect con4, localhost, user4, ,test; connection default; "================== Step 8 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result index b7cf3b8a5ce4c..fbaa9a8d83f6b 100644 --- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result +++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result @@ -81,7 +81,7 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 1 1 -connect con1, localhost, user1, , ; +connect con1, localhost, user1, ,test; connection default; "================== Step 2 ==================" call dump_thread(); @@ -277,7 +277,7 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 2 2 -connect con2, localhost, user2, , ; +connect con2, localhost, user2, ,test; connection default; "================== Step 4 ==================" call dump_thread(); @@ -485,7 +485,7 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 3 3 -connect con3, localhost, user3, , ; +connect con3, localhost, user3, ,test; connection default; "================== Step 6 ==================" call dump_thread(); @@ -695,7 +695,7 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 4 4 -connect con4, localhost, user4, , ; +connect con4, localhost, user4, ,test; connection default; "================== Step 8 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result index 24de36da22b7e..af535623e9a3d 100644 --- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result +++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result @@ -67,7 +67,7 @@ execute dump_users; USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con1, localhost, user1, , ; +connect con1, localhost, user1, ,test; connection default; "================== Step 2 ==================" call dump_thread(); @@ -235,7 +235,7 @@ execute dump_users; USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con2, localhost, user2, , ; +connect con2, localhost, user2, ,test; connection default; "================== Step 4 ==================" call dump_thread(); @@ -415,7 +415,7 @@ execute dump_users; USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con3, localhost, user3, , ; +connect con3, localhost, user3, ,test; connection default; "================== Step 6 ==================" call dump_thread(); @@ -597,7 +597,7 @@ execute dump_users; USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con4, localhost, user4, , ; +connect con4, localhost, user4, ,test; connection default; "================== Step 8 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_h.result index 2f0c96d72344c..1209d37667e58 100644 --- a/mysql-test/suite/perfschema/r/event_aggregate_no_h.result +++ b/mysql-test/suite/perfschema/r/event_aggregate_no_h.result @@ -69,7 +69,7 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS root 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con1, localhost, user1, , ; +connect con1, localhost, user1, ,test; connection default; "================== Step 2 ==================" call dump_thread(); @@ -297,7 +297,7 @@ root 1 1 user1 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con2, localhost, user2, , ; +connect con2, localhost, user2, ,test; connection default; "================== Step 4 ==================" call dump_thread(); @@ -593,7 +593,7 @@ user1 1 1 user2 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con3, localhost, user3, , ; +connect con3, localhost, user3, ,test; connection default; "================== Step 6 ==================" call dump_thread(); @@ -947,7 +947,7 @@ user2 1 1 user3 1 1 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con4, localhost, user4, , ; +connect con4, localhost, user4, ,test; connection default; "================== Step 8 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_u.result b/mysql-test/suite/perfschema/r/event_aggregate_no_u.result index 618201d9b8536..39da9783c9697 100644 --- a/mysql-test/suite/perfschema/r/event_aggregate_no_u.result +++ b/mysql-test/suite/perfschema/r/event_aggregate_no_u.result @@ -82,7 +82,7 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 1 1 -connect con1, localhost, user1, , ; +connect con1, localhost, user1, ,test; connection default; "================== Step 2 ==================" call dump_thread(); @@ -308,7 +308,7 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 2 2 -connect con2, localhost, user2, , ; +connect con2, localhost, user2, ,test; connection default; "================== Step 4 ==================" call dump_thread(); @@ -574,7 +574,7 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 3 3 -connect con3, localhost, user3, , ; +connect con3, localhost, user3, ,test; connection default; "================== Step 6 ==================" call dump_thread(); @@ -870,7 +870,7 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 4 4 -connect con4, localhost, user4, , ; +connect con4, localhost, user4, ,test; connection default; "================== Step 8 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result index d6dd322a70c1e..818c61e0630e7 100644 --- a/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result +++ b/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result @@ -68,7 +68,7 @@ execute dump_users; USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con1, localhost, user1, , ; +connect con1, localhost, user1, ,test; connection default; "================== Step 2 ==================" call dump_thread(); @@ -266,7 +266,7 @@ execute dump_users; USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con2, localhost, user2, , ; +connect con2, localhost, user2, ,test; connection default; "================== Step 4 ==================" call dump_thread(); @@ -504,7 +504,7 @@ execute dump_users; USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con3, localhost, user3, , ; +connect con3, localhost, user3, ,test; connection default; "================== Step 6 ==================" call dump_thread(); @@ -772,7 +772,7 @@ execute dump_users; USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS -connect con4, localhost, user4, , ; +connect con4, localhost, user4, ,test; connection default; "================== Step 8 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/global_read_lock.result b/mysql-test/suite/perfschema/r/global_read_lock.result index df98b9bd1bb21..31e1751d7b91b 100644 --- a/mysql-test/suite/perfschema/r/global_read_lock.result +++ b/mysql-test/suite/perfschema/r/global_read_lock.result @@ -3,7 +3,7 @@ update performance_schema.setup_instruments set enabled='YES'; create user pfsuser@localhost; grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost; flush privileges; -connect con1, localhost, pfsuser, , test; +connect con1, localhost, pfsuser, ,"*NO-ONE*"; lock tables performance_schema.setup_instruments read; select * from performance_schema.setup_instruments; unlock tables; diff --git a/mysql-test/suite/perfschema/r/privilege.result b/mysql-test/suite/perfschema/r/privilege.result index 79d69b87ca735..75b018426bcc1 100644 --- a/mysql-test/suite/perfschema/r/privilege.result +++ b/mysql-test/suite/perfschema/r/privilege.result @@ -5,6 +5,9 @@ GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION create user 'pfs_user_1'@localhost; create user 'pfs_user_2'@localhost; create user 'pfs_user_3'@localhost; +grant SELECT,INSERT,UPDATE,DELETE,DROP,CREATE on test.* to 'pfs_user_1'@localhost; +grant SELECT,INSERT,UPDATE,DELETE,DROP,CREATE on test.* to 'pfs_user_2'@localhost; +grant SELECT,INSERT,UPDATE,DELETE,DROP,CREATE on test.* to 'pfs_user_3'@localhost; grant ALL on *.* to 'pfs_user_1'@localhost with GRANT OPTION; grant ALL on performance_schema.* to 'pfs_user_2'@localhost with GRANT OPTION; @@ -521,7 +524,7 @@ flush privileges; # Test cases from WL#4818 # Setup user CREATE user pfs_user_4; -connect pfs_user_4, localhost, pfs_user_4, , ; +connect pfs_user_4, localhost, pfs_user_4, ,"*NO-ONE*"; # # WL#4818, NFS4: Normal user does not have access to view data # without grants diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result index 94cc2b33b49ef..6dd885281b3a1 100644 --- a/mysql-test/suite/perfschema/r/privilege_table_io.result +++ b/mysql-test/suite/perfschema/r/privilege_table_io.result @@ -119,8 +119,6 @@ wait/io/table/sql/handler TABLE mysql global_priv fetch 1 wait/io/table/sql/handler TABLE mysql global_priv fetch 1 wait/io/table/sql/handler TABLE mysql global_priv fetch 1 wait/io/table/sql/handler TABLE mysql db fetch 1 -wait/io/table/sql/handler TABLE mysql db fetch 1 -wait/io/table/sql/handler TABLE mysql db fetch 1 wait/io/table/sql/handler TABLE mysql proxies_priv fetch 1 wait/io/table/sql/handler TABLE mysql proxies_priv fetch 1 wait/io/table/sql/handler TABLE mysql proxies_priv fetch 1 diff --git a/mysql-test/suite/perfschema/r/read_only.result b/mysql-test/suite/perfschema/r/read_only.result index 344526bbd6314..aa18efc928fdf 100644 --- a/mysql-test/suite/perfschema/r/read_only.result +++ b/mysql-test/suite/perfschema/r/read_only.result @@ -3,7 +3,7 @@ set @start_read_only= @@global.read_only; create user pfsuser@localhost; grant SELECT, UPDATE on performance_schema.* to pfsuser@localhost; flush privileges; -connect con1, localhost, pfsuser, , test; +connect con1, localhost, pfsuser, ,"*NO-ONE*"; connection default; set global read_only=0; connection con1; @@ -35,7 +35,7 @@ connection default; grant READ_ONLY ADMIN on *.* to pfsuser@localhost; flush privileges; disconnect con1; -connect con1, localhost, pfsuser, , test; +connect con1, localhost, pfsuser, ,"*NO-ONE*"; select @@global.read_only; @@global.read_only 1 diff --git a/mysql-test/suite/perfschema/t/connect_attrs.test b/mysql-test/suite/perfschema/t/connect_attrs.test index c703badef8518..2d2c2ce266e1b 100644 --- a/mysql-test/suite/perfschema/t/connect_attrs.test +++ b/mysql-test/suite/perfschema/t/connect_attrs.test @@ -45,7 +45,7 @@ SELECT COUNT(DISTINCT PROCESSLIST_ID) CREATE USER wl5924@localhost; -connect(non_privileged_user,localhost,wl5924,,test); +connect(non_privileged_user,localhost,wl5924,,"*NO-ONE*"); connection default; --echo # must return 1 diff --git a/mysql-test/suite/perfschema/t/connection_type_notwin.test b/mysql-test/suite/perfschema/t/connection_type_notwin.test index 07028e1fb81fe..bb96d69076365 100644 --- a/mysql-test/suite/perfschema/t/connection_type_notwin.test +++ b/mysql-test/suite/perfschema/t/connection_type_notwin.test @@ -33,7 +33,7 @@ eval SET GLOBAL general_log_file = '$MYSQLTEST_VARDIR/log/rewrite_general_con.lo SET GLOBAL log_output = 'FILE,TABLE'; SET GLOBAL general_log= 'ON'; -connect(con1, localhost, root,,); +connect(con1, localhost, root,,test); select NAME, PROCESSLIST_USER, PROCESSLIST_HOST, CONNECTION_TYPE from performance_schema.threads diff --git a/mysql-test/suite/perfschema/t/global_read_lock.test b/mysql-test/suite/perfschema/t/global_read_lock.test index 4217de0d72302..430d6eed5dc34 100644 --- a/mysql-test/suite/perfschema/t/global_read_lock.test +++ b/mysql-test/suite/perfschema/t/global_read_lock.test @@ -15,7 +15,7 @@ create user pfsuser@localhost; grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost; flush privileges; -connect (con1, localhost, pfsuser, , test); +connect (con1, localhost, pfsuser, ,"*NO-ONE*"); lock tables performance_schema.setup_instruments read; --disable_result_log diff --git a/mysql-test/suite/perfschema/t/privilege.test b/mysql-test/suite/perfschema/t/privilege.test index a0af41e0372dd..06e7cdf0cae24 100644 --- a/mysql-test/suite/perfschema/t/privilege.test +++ b/mysql-test/suite/perfschema/t/privilege.test @@ -8,6 +8,9 @@ show grants; create user 'pfs_user_1'@localhost; create user 'pfs_user_2'@localhost; create user 'pfs_user_3'@localhost; +grant SELECT,INSERT,UPDATE,DELETE,DROP,CREATE on test.* to 'pfs_user_1'@localhost; +grant SELECT,INSERT,UPDATE,DELETE,DROP,CREATE on test.* to 'pfs_user_2'@localhost; +grant SELECT,INSERT,UPDATE,DELETE,DROP,CREATE on test.* to 'pfs_user_3'@localhost; grant ALL on *.* to 'pfs_user_1'@localhost with GRANT OPTION; # Test denied privileges on performance_schema.* @@ -228,7 +231,7 @@ flush privileges; --echo # Setup user CREATE user pfs_user_4; ---connect (pfs_user_4, localhost, pfs_user_4, , ) +--connect (pfs_user_4, localhost, pfs_user_4, ,"*NO-ONE*") --echo # --echo # WL#4818, NFS4: Normal user does not have access to view data diff --git a/mysql-test/suite/perfschema/t/read_only.test b/mysql-test/suite/perfschema/t/read_only.test index 2d8e41595d121..4cbaad0de6b8f 100644 --- a/mysql-test/suite/perfschema/t/read_only.test +++ b/mysql-test/suite/perfschema/t/read_only.test @@ -16,7 +16,7 @@ create user pfsuser@localhost; grant SELECT, UPDATE on performance_schema.* to pfsuser@localhost; flush privileges; -connect (con1, localhost, pfsuser, , test); +connect (con1, localhost, pfsuser, ,"*NO-ONE*"); connection default; @@ -55,7 +55,7 @@ grant READ_ONLY ADMIN on *.* to pfsuser@localhost; flush privileges; disconnect con1; -connect (con1, localhost, pfsuser, , test); +connect (con1, localhost, pfsuser, ,"*NO-ONE*"); select @@global.read_only; show grants; diff --git a/mysql-test/suite/plugins/r/dialog.result b/mysql-test/suite/plugins/r/dialog.result index 0fcbb41ebe026..b0acc311843e3 100644 --- a/mysql-test/suite/plugins/r/dialog.result +++ b/mysql-test/suite/plugins/r/dialog.result @@ -1,5 +1,6 @@ install plugin three_attempts soname 'dialog_examples.so'; create user test_dialog identified via three_attempts using 'SECRET'; +GRANT SELECT ON test.* TO test_dialog; # # -pSECRET is picked up, no questions asked. # diff --git a/mysql-test/suite/plugins/r/multiauth.result b/mysql-test/suite/plugins/r/multiauth.result index d1ecd600d8412..e506e3f80c103 100644 --- a/mysql-test/suite/plugins/r/multiauth.result +++ b/mysql-test/suite/plugins/r/multiauth.result @@ -1,6 +1,8 @@ install soname 'auth_ed25519'; create user 'USER' identified via unix_socket OR mysql_native_password as password("GOOD"); +grant select on test.* to 'USER' ; create user mysqltest1 identified via unix_socket OR mysql_native_password as password("good"); +grant select on test.* to mysqltest1; show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*8409037B3E362D6DAE24C8E667F4D3B66716144E' @@ -16,7 +18,9 @@ mysqltest1@localhost mysqltest1@% test mysqltest: Could not open connection 'default': 1045 Access denied for user 'mysqltest1'@'localhost' (using password: YES) drop user 'USER', mysqltest1; create user 'USER' identified via mysql_native_password as password("GOOD") OR unix_socket; +grant select on test.* to 'USER' ; create user mysqltest1 identified via mysql_native_password as password("good") OR unix_socket; +grant select on test.* to mysqltest1; show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA mysql_native_password USING '*8409037B3E362D6DAE24C8E667F4D3B66716144E' OR unix_socket @@ -32,7 +36,9 @@ mysqltest1@localhost mysqltest1@% test mysqltest: Could not open connection 'default': 1698 Access denied for user 'mysqltest1'@'localhost' drop user 'USER', mysqltest1; create user 'USER' identified via unix_socket OR ed25519 as password("GOOD"); +grant select on test.* to 'USER' ; create user mysqltest1 identified via unix_socket OR ed25519 as password("good"); +grant select on test.* to mysqltest1; show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' @@ -48,7 +54,9 @@ mysqltest1@localhost mysqltest1@% test mysqltest: Could not open connection 'default': 1045 Access denied for user 'mysqltest1'@'localhost' (using password: YES) drop user 'USER', mysqltest1; create user 'USER' identified via ed25519 as password("GOOD") OR unix_socket; +grant select on test.* to 'USER' ; create user mysqltest1 identified via ed25519 as password("good") OR unix_socket; +grant select on test.* to mysqltest1; show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' OR unix_socket @@ -64,7 +72,9 @@ mysqltest1@localhost mysqltest1@% test mysqltest: Could not open connection 'default': 1698 Access denied for user 'mysqltest1'@'localhost' drop user 'USER', mysqltest1; create user 'USER' identified via ed25519 as password("GOOD") OR unix_socket OR mysql_native_password as password("works"); +grant select on test.* to 'USER' ; create user mysqltest1 identified via ed25519 as password("good") OR unix_socket OR mysql_native_password as password("works"); +grant select on test.* to mysqltest1; show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' OR unix_socket OR mysql_native_password USING '*7D8C3DF236D9163B6C274A9D47704BC496988460' @@ -84,6 +94,7 @@ mysqltest1@localhost mysqltest1@% test mysqltest: Could not open connection 'default': 1045 Access denied for user 'mysqltest1'@'localhost' (using password: YES) drop user 'USER', mysqltest1; create user mysqltest1 identified via mysql_native_password as password("good") OR mysql_native_password as password("works"); +grant select on test.* to mysqltest1; show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA mysql_native_password USING '*8409037B3E362D6DAE24C8E667F4D3B66716144E' OR mysql_native_password USING '*7D8C3DF236D9163B6C274A9D47704BC496988460' @@ -155,7 +166,9 @@ create user mysqltest1 identified via ed25519 as password("good") OR unix_socket ERROR HY000: Column count of mysql.user is wrong. Expected 3, found 47. Created with MariaDB XX.YY.ZZ, now running XX.YY.ZZ. Please use mariadb-upgrade to fix this error # switching back from mysql.user to mysql.global_priv create user 'USER' identified via mysql_native_password as '1234567890123456789012345678901234567890a' OR unix_socket; +grant select on test.* to 'USER' ; create user mysqltest1 identified via mysql_native_password as '1234567890123456789012345678901234567890a' OR unix_socket; +grant select on test.* to mysqltest1; update mysql.global_priv set priv=replace(priv, '1234567890123456789012345678901234567890a', 'invalid password'); flush privileges; show create user mysqltest1; @@ -174,6 +187,7 @@ user() current_user() database() mysqltest1@localhost mysqltest1@% test drop user 'USER', mysqltest1; create user mysqltest1 identified via ed25519 as password("good"); +grant select on test.* to mysqltest1; show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' diff --git a/mysql-test/suite/plugins/r/pam.result b/mysql-test/suite/plugins/r/pam.result index b858891616923..ceb81690cd87a 100644 --- a/mysql-test/suite/plugins/r/pam.result +++ b/mysql-test/suite/plugins/r/pam.result @@ -1,6 +1,8 @@ install plugin pam soname 'auth_pam.so'; create user test_pam identified via pam using 'mariadb_mtr'; +grant all on test.* to test_pam; create user pam_test; +grant all on test.* to pam_test; grant proxy on pam_test to test_pam; # # athentication is successful, challenge/pin are ok @@ -72,6 +74,7 @@ select user(), current_user(), database(); drop user test_pam; drop user pam_test; create user PAM_TEST identified via pam using 'mariadb_mtr'; +grant all on test.* to PAM_TEST; # # athentication is unsuccessful # @@ -95,6 +98,7 @@ drop user PAM_TEST; # MDEV-27341 Use SET PASSWORD to change PAM service # create user pam_test identified via pam using 'mariadb_mtr'; +grant all on test.* to pam_test; Challenge input first. Enter: ************************* Now, the magic number! diff --git a/mysql-test/suite/plugins/r/pam_cleartext.result b/mysql-test/suite/plugins/r/pam_cleartext.result index 07c379a4b7fd1..6a4d21edbf271 100644 --- a/mysql-test/suite/plugins/r/pam_cleartext.result +++ b/mysql-test/suite/plugins/r/pam_cleartext.result @@ -1,6 +1,8 @@ install plugin pam soname 'auth_pam.so'; create user test_pam identified via pam using 'mariadb_mtr'; +grant all on test.* to test_pam; create user pam_test; +grant all on test.* to pam_test; grant proxy on pam_test to test_pam; show variables like 'pam_use_%'; Variable_name Value diff --git a/mysql-test/suite/plugins/r/pam_v1.result b/mysql-test/suite/plugins/r/pam_v1.result index 66776e3bca7ee..c90d17188d61a 100644 --- a/mysql-test/suite/plugins/r/pam_v1.result +++ b/mysql-test/suite/plugins/r/pam_v1.result @@ -1,6 +1,8 @@ install plugin pam soname 'auth_pam_v1.so'; create user test_pam identified via pam using 'mariadb_mtr'; +grant all on test.* to test_pam; create user pam_test; +grant all on test.* to pam_test; grant proxy on pam_test to test_pam; # # athentication is successful, challenge/pin are ok diff --git a/mysql-test/suite/plugins/r/qc_info_priv.result b/mysql-test/suite/plugins/r/qc_info_priv.result index 9aa15885563ab..ea866d510303b 100644 --- a/mysql-test/suite/plugins/r/qc_info_priv.result +++ b/mysql-test/suite/plugins/r/qc_info_priv.result @@ -31,6 +31,7 @@ STATEMENT_SCHEMA STATEMENT_TEXT RESULT_BLOCKS_COUNT RESULT_BLOCKS_SIZE RESULT_BL test select * from t1 1 512 # -1 1011 513 binary utf32 utf32_bin Europe/Moscow 4 7 STRICT_ALL_TABLES ar_SD 1 1 1 # 0 0 0 # 0 test select * from t1 1 512 # -1 1024 1048576 latin1 latin1 latin1_swedish_ci SYSTEM 0 4 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION en_US 1 1 1 # 0 0 1 # 0 create user mysqltest; +grant select on test.* to mysqltest; connect conn1,localhost,mysqltest,,; connection conn1; select a from t1; diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 9768040aa943c..ae40d54e8df90 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -247,7 +247,7 @@ connect(localhost,plug,plug_dest,test,MYSQL_PORT,MYSQL_SOCK); connect plug_con,localhost,plug,plug_dest; ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES) GRANT PROXY ON plug_dest TO plug; -connect plug_con,localhost,plug,plug_dest; +connect plug_con,localhost,plug,plug_dest,"*NO-ONE*"; connection plug_con; select USER(),CURRENT_USER(); USER() CURRENT_USER() @@ -476,10 +476,10 @@ TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,,,0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT PROXY ON plug_dest TO plug',0 -TIME,HOSTNAME,plug,localhost,ID,0,CONNECT,test,,0 -TIME,HOSTNAME,plug,localhost,ID,0,PROXY_CONNECT,test,`plug_dest`@`%`,0 -TIME,HOSTNAME,plug,localhost,ID,ID,QUERY,test,'select USER(),CURRENT_USER()',0 -TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,test,,0 +TIME,HOSTNAME,plug,localhost,ID,0,CONNECT,,,0 +TIME,HOSTNAME,plug,localhost,ID,0,PROXY_CONNECT,,`plug_dest`@`%`,0 +TIME,HOSTNAME,plug,localhost,ID,ID,QUERY,,'select USER(),CURRENT_USER()',0 +TIME,HOSTNAME,plug,localhost,ID,0,DISCONNECT,,,0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv, diff --git a/mysql-test/suite/plugins/r/unix_socket.result b/mysql-test/suite/plugins/r/unix_socket.result index b663d3412215c..81fef9f7c96b3 100644 --- a/mysql-test/suite/plugins/r/unix_socket.result +++ b/mysql-test/suite/plugins/r/unix_socket.result @@ -2,6 +2,7 @@ # with named user # create user 'USER' identified via unix_socket; +grant select on test.* to 'USER'; # # name match = ok # @@ -27,3 +28,4 @@ USER@localhost @% test # delete from mysql.user where user=''; FLUSH PRIVILEGES; +delete from mysql.db; diff --git a/mysql-test/suite/plugins/t/dialog.test b/mysql-test/suite/plugins/t/dialog.test index 1dd52cfde34e9..efababa96b949 100644 --- a/mysql-test/suite/plugins/t/dialog.test +++ b/mysql-test/suite/plugins/t/dialog.test @@ -14,6 +14,7 @@ if (!$DIALOG_EXAMPLES_SO) { --replace_result .dll .so eval install plugin three_attempts soname '$DIALOG_EXAMPLES_SO'; create user test_dialog identified via three_attempts using 'SECRET'; +GRANT SELECT ON test.* TO test_dialog; --write_file $MYSQLTEST_VARDIR/tmp/dialog_good.txt foo diff --git a/mysql-test/suite/plugins/t/multiauth.test b/mysql-test/suite/plugins/t/multiauth.test index 86c98a5d5c328..d2a93cf100694 100644 --- a/mysql-test/suite/plugins/t/multiauth.test +++ b/mysql-test/suite/plugins/t/multiauth.test @@ -28,6 +28,7 @@ select user(), current_user(), database(); EOF --let $creplace=create user '$USER' +--let $greplace=grant select on test.* to '$USER' --let $dreplace=drop user '$USER' # @@ -35,7 +36,10 @@ EOF # --replace_result $creplace "create user 'USER'" eval $creplace identified via unix_socket OR mysql_native_password as password("GOOD"); +--replace_result $greplace "grant select on test.* to 'USER'" +eval $greplace ; create user mysqltest1 identified via unix_socket OR mysql_native_password as password("good"); +grant select on test.* to mysqltest1; show create user mysqltest1; --echo # name match = ok --exec $try_auth -u $USER @@ -52,7 +56,10 @@ eval $dreplace, mysqltest1; # --replace_result $creplace "create user 'USER'" eval $creplace identified via mysql_native_password as password("GOOD") OR unix_socket; +--replace_result $greplace "grant select on test.* to 'USER'" +eval $greplace ; create user mysqltest1 identified via mysql_native_password as password("good") OR unix_socket; +grant select on test.* to mysqltest1; show create user mysqltest1; --echo # name match = ok --exec $try_auth -u $USER @@ -69,7 +76,10 @@ eval $dreplace, mysqltest1; # --replace_result $creplace "create user 'USER'" eval $creplace identified via unix_socket OR ed25519 as password("GOOD"); +--replace_result $greplace "grant select on test.* to 'USER'" +eval $greplace ; create user mysqltest1 identified via unix_socket OR ed25519 as password("good"); +grant select on test.* to mysqltest1; show create user mysqltest1; --echo # name match = ok --exec $try_auth -u $USER @@ -86,7 +96,10 @@ eval $dreplace, mysqltest1; # --replace_result $creplace "create user 'USER'" eval $creplace identified via ed25519 as password("GOOD") OR unix_socket; +--replace_result $greplace "grant select on test.* to 'USER'" +eval $greplace ; create user mysqltest1 identified via ed25519 as password("good") OR unix_socket; +grant select on test.* to mysqltest1; show create user mysqltest1; --echo # name match = ok --exec $try_auth -u $USER @@ -103,7 +116,10 @@ eval $dreplace, mysqltest1; # --replace_result $creplace "create user 'USER'" eval $creplace identified via ed25519 as password("GOOD") OR unix_socket OR mysql_native_password as password("works"); +--replace_result $greplace "grant select on test.* to 'USER'" +eval $greplace ; create user mysqltest1 identified via ed25519 as password("good") OR unix_socket OR mysql_native_password as password("works"); +grant select on test.* to mysqltest1; show create user mysqltest1; --echo # name match = ok --exec $try_auth -u $USER @@ -121,6 +137,7 @@ eval $dreplace, mysqltest1; # password,password # create user mysqltest1 identified via mysql_native_password as password("good") OR mysql_native_password as password("works"); +grant select on test.* to mysqltest1; show create user mysqltest1; --echo # password good = ok --exec $try_auth -u mysqltest1 -pgood @@ -165,7 +182,10 @@ create user mysqltest1 identified via ed25519 as password("good") OR unix_socket # --replace_result $creplace "create user 'USER'" eval $creplace identified via mysql_native_password as '1234567890123456789012345678901234567890a' OR unix_socket; +--replace_result $greplace "grant select on test.* to 'USER'" +eval $greplace ; create user mysqltest1 identified via mysql_native_password as '1234567890123456789012345678901234567890a' OR unix_socket; +grant select on test.* to mysqltest1; update mysql.global_priv set priv=replace(priv, '1234567890123456789012345678901234567890a', 'invalid password'); flush privileges; show create user mysqltest1; @@ -184,6 +204,7 @@ eval $dreplace, mysqltest1; # missing client-side plugin # create user mysqltest1 identified via ed25519 as password("good"); +grant select on test.* to mysqltest1; show create user mysqltest1; --echo # no plugin = failure # covers Linux (1st re), FreeBSD (2nd), AIX (3rd and 4th) diff --git a/mysql-test/suite/plugins/t/pam.test b/mysql-test/suite/plugins/t/pam.test index dbe108d1efaf9..c953e05fa684c 100644 --- a/mysql-test/suite/plugins/t/pam.test +++ b/mysql-test/suite/plugins/t/pam.test @@ -86,6 +86,7 @@ alter user test_pam password expire; drop user test_pam; drop user pam_test; create user PAM_TEST identified via pam using 'mariadb_mtr'; +grant all on test.* to PAM_TEST; --echo # --echo # athentication is unsuccessful @@ -109,6 +110,7 @@ drop user PAM_TEST; --echo # MDEV-27341 Use SET PASSWORD to change PAM service --echo # create user pam_test identified via pam using 'mariadb_mtr'; +grant all on test.* to pam_test; --write_file $MYSQLTEST_VARDIR/tmp/setpwd.txt not very secret challenge 9225 diff --git a/mysql-test/suite/plugins/t/pam_init.inc b/mysql-test/suite/plugins/t/pam_init.inc index 131b787f6b927..f3a948421ed91 100644 --- a/mysql-test/suite/plugins/t/pam_init.inc +++ b/mysql-test/suite/plugins/t/pam_init.inc @@ -7,7 +7,9 @@ if (!$PAM_PLUGIN_VERSION) { eval install plugin pam soname '$PAM_PLUGIN_VERSION'; create user test_pam identified via pam using 'mariadb_mtr'; +grant all on test.* to test_pam; create user pam_test; +grant all on test.* to pam_test; grant proxy on pam_test to test_pam; let $plugindir=`SELECT @@global.plugin_dir`; diff --git a/mysql-test/suite/plugins/t/qc_info_priv.test b/mysql-test/suite/plugins/t/qc_info_priv.test index 59258731508e4..f5052702768d9 100644 --- a/mysql-test/suite/plugins/t/qc_info_priv.test +++ b/mysql-test/suite/plugins/t/qc_info_priv.test @@ -4,6 +4,7 @@ set @save_query_cache_size=@@global.query_cache_size; # try an unprivileged user create user mysqltest; +grant select on test.* to mysqltest; connect (conn1,localhost,mysqltest,,); connection conn1; select a from t1; diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index d8f8b9d01651f..3a78a4049e8dc 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -200,7 +200,7 @@ connect(plug_con,localhost,plug,plug_dest); --sleep 2 GRANT PROXY ON plug_dest TO plug; --sleep 2 -connect(plug_con,localhost,plug,plug_dest); +connect(plug_con,localhost,plug,plug_dest,"*NO-ONE*"); connection plug_con; select USER(),CURRENT_USER(); connection default; diff --git a/mysql-test/suite/plugins/t/unix_socket.test b/mysql-test/suite/plugins/t/unix_socket.test index be2afb0ca6656..892b6f7516197 100644 --- a/mysql-test/suite/plugins/t/unix_socket.test +++ b/mysql-test/suite/plugins/t/unix_socket.test @@ -5,8 +5,11 @@ --echo # --let $replace=create user '$USER' +--let $greplace=grant select on test.* to '$USER' --replace_result $replace "create user 'USER'" eval create user '$USER' identified via unix_socket; +--replace_result $greplace "grant select on test.* to 'USER'" +eval grant select on test.* to '$USER'; --write_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt --let $replace1=$USER@localhost @@ -49,3 +52,5 @@ grant SELECT ON test.* TO '' identified via unix_socket; delete from mysql.user where user=''; FLUSH PRIVILEGES; --remove_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt + +delete from mysql.db; diff --git a/mysql-test/suite/roles/acl_statistics.result b/mysql-test/suite/roles/acl_statistics.result index f43f692cc4891..c60e0297af362 100644 --- a/mysql-test/suite/roles/acl_statistics.result +++ b/mysql-test/suite/roles/acl_statistics.result @@ -1,7 +1,7 @@ SHOW STATUS LIKE 'Acl%'; Variable_name Value Acl_column_grants 0 -Acl_database_grants 2 +Acl_database_grants 0 Acl_function_grants 0 Acl_procedure_grants 0 Acl_package_spec_grants 0 @@ -16,7 +16,7 @@ COLUMN_GRANTS 0 SELECT count(*) DATABASE_GRANTS from mysql.db; DATABASE_GRANTS -2 +0 SELECT count(*) FUNCTION_GRANTS from mysql.procs_priv where routine_type='FUNCTION'; FUNCTION_GRANTS 0 @@ -66,7 +66,7 @@ GRANT EXECUTE ON FUNCTION mysql.test_func TO r2; SHOW STATUS LIKE 'Acl%'; Variable_name Value Acl_column_grants 2 -Acl_database_grants 4 +Acl_database_grants 2 Acl_function_grants 3 Acl_procedure_grants 2 Acl_package_spec_grants 0 @@ -81,7 +81,7 @@ COLUMN_GRANTS 2 SELECT count(*) DATABASE_GRANTS from mysql.db; DATABASE_GRANTS -4 +2 SELECT count(*) FUNCTION_GRANTS from mysql.procs_priv where routine_type='FUNCTION'; FUNCTION_GRANTS 3 diff --git a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test index dac6eab21e998..e86e93f7a3b1b 100644 --- a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test +++ b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test @@ -17,7 +17,7 @@ alter table user drop column max_statement_time; flush privileges; ---replace_regex /10\d\d\d\d/MYSQL_VERSION_ID/ +--replace_regex /1\d\d\d\d\d/MYSQL_VERSION_ID/ --error ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE create role test_role; --error ER_CANNOT_USER diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result index 8b5e36d8b3c87..091ba255bc60f 100644 --- a/mysql-test/suite/roles/definer.result +++ b/mysql-test/suite/roles/definer.result @@ -5,15 +5,19 @@ insert t1 values (1,10,100),(2,20,200); create role role1; grant select (a) on mysqltest1.t1 to role1; grant event,execute,trigger on mysqltest1.* to role1; +grant select on test.* to role1; grant role1 to current_user; create role role2; grant insert,select on mysqltest1.t1 to role2; grant event,execute,trigger on mysqltest1.* to role2; +grant select on test.* to role2; create user foo@localhost; grant create view on mysqltest1.* to foo@localhost; +grant select, create view on test.* to foo@localhost; create role role4; grant select on mysqltest1.t1 to role4; grant role4 to foo@localhost; +grant select on test.* to role4; create definer=current_role view test.v1 as select a+b,c from t1; ERROR 0L000: Invalid definer set role role1; @@ -41,6 +45,7 @@ Grants for foo@localhost GRANT `role4` TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT CREATE VIEW ON `mysqltest1`.* TO `foo`@`localhost` +GRANT SELECT, CREATE VIEW ON `test`.* TO `foo`@`localhost` select * from test.v1; ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them select * from test.v2; @@ -642,7 +647,7 @@ grant r1 to user1; grant r1 to r2; grant r2 to user1; grant r3 to user1; -connect user1, localhost,user1,,,,,; +connect user1, localhost,user1,,"*NO-ONE*",,,; set role r2; use rtest; CREATE DEFINER=current_role() PROCEDURE user1_proc() SQL SECURITY INVOKER @@ -717,7 +722,7 @@ CREATE DEFINER=`user_like_role`@`%` PROCEDURE sensitive_proc() SQL SECURITY INVO BEGIN SELECT NOW(), VERSION(); END;// -connect user_like_role, localhost, user_like_role,,,,,; +connect user_like_role, localhost, user_like_role,,"*NO-ONE*",,,; use rtest; show create procedure sensitive_proc; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation @@ -726,7 +731,7 @@ sensitive_proc STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USE BEGIN SELECT NOW(), VERSION(); END latin1 latin1_swedish_ci latin1_swedish_ci -connect foo, localhost, foo,,,,,; +connect foo, localhost, foo,,"*NO-ONE*",,,; set role user_like_role; use rtest; # diff --git a/mysql-test/suite/roles/definer.test b/mysql-test/suite/roles/definer.test index c1e56f3f94b2b..4cd42d59b2476 100644 --- a/mysql-test/suite/roles/definer.test +++ b/mysql-test/suite/roles/definer.test @@ -19,6 +19,7 @@ insert t1 values (1,10,100),(2,20,200); create role role1; grant select (a) on mysqltest1.t1 to role1; grant event,execute,trigger on mysqltest1.* to role1; +grant select on test.* to role1; grant role1 to current_user; @@ -26,13 +27,16 @@ grant role1 to current_user; create role role2; grant insert,select on mysqltest1.t1 to role2; grant event,execute,trigger on mysqltest1.* to role2; +grant select on test.* to role2; # create a non-priv user and a priv role granted to him create user foo@localhost; grant create view on mysqltest1.* to foo@localhost; +grant select, create view on test.* to foo@localhost; create role role4; grant select on mysqltest1.t1 to role4; grant role4 to foo@localhost; +grant select on test.* to role4; ################################################## # views @@ -355,7 +359,7 @@ grant r1 to r2; grant r2 to user1; grant r3 to user1; -connect (user1, localhost,user1,,,,,); +connect (user1, localhost,user1,,"*NO-ONE*",,,); set role r2; use rtest; @@ -433,11 +437,11 @@ CREATE DEFINER=`user_like_role`@`%` PROCEDURE sensitive_proc() SQL SECURITY INVO END;// DELIMITER ;// -connect (user_like_role, localhost, user_like_role,,,,,); +connect (user_like_role, localhost, user_like_role,,"*NO-ONE*",,,); use rtest; show create procedure sensitive_proc; -connect (foo, localhost, foo,,,,,); +connect (foo, localhost, foo,,"*NO-ONE*",,,); set role user_like_role; use rtest; diff --git a/mysql-test/suite/roles/flush_roles-12366.result b/mysql-test/suite/roles/flush_roles-12366.result index f65c97e0ee39a..043f79f8f7f5f 100644 --- a/mysql-test/suite/roles/flush_roles-12366.result +++ b/mysql-test/suite/roles/flush_roles-12366.result @@ -240,7 +240,6 @@ connect con1,localhost,u,,; SHOW DATABASES; Database information_schema -test SET ROLE operations_cluster; SHOW DATABASES; Database @@ -261,7 +260,6 @@ oms_live_sg oms_live_th oms_live_tw oms_live_vn -test SELECT COUNT(1) FROM oms_live_sg.a; COUNT(1) 0 @@ -364,7 +362,6 @@ connect con3,localhost,u,,; SHOW DATABASES; Database information_schema -test SET ROLE operations_cluster; SHOW DATABASES; Database @@ -385,7 +382,6 @@ oms_live_sg oms_live_th oms_live_tw oms_live_vn -test SELECT COUNT(1) FROM oms_live_sg.a; COUNT(1) 0 diff --git a/mysql-test/suite/roles/none_public.result b/mysql-test/suite/roles/none_public.result index c253ae1478b68..a6c896c9d2daf 100644 --- a/mysql-test/suite/roles/none_public.result +++ b/mysql-test/suite/roles/none_public.result @@ -1,48 +1,72 @@ create role role1; create role none; -ERROR OP000: Invalid role specification `none` +ERROR OP000: Invalid role specification `NONE` create role public; -ERROR OP000: Invalid role specification `public` +ERROR OP000: Invalid role specification `PUBLIC` drop role none; -ERROR HY000: Operation DROP ROLE failed for 'none' +ERROR HY000: Operation DROP ROLE failed for 'NONE' +drop role public; +ERROR HY000: Operation DROP ROLE failed for PUBLIC grant none to role1; -ERROR OP000: Invalid role specification `none` +ERROR OP000: Invalid role specification `NONE` grant role1 to none; ERROR OP000: Invalid role specification `none` grant select on *.* to none; ERROR OP000: Invalid role specification `none` grant public to role1; -ERROR OP000: Invalid role specification `public` +ERROR OP000: Invalid role specification `PUBLIC` grant role1 to public; -ERROR OP000: Invalid role specification `public` grant select on *.* to public; -ERROR OP000: Invalid role specification `public` grant role1 to current_role; ERROR OP000: Invalid role specification `NONE` revoke none from role1; -ERROR OP000: Invalid role specification `none` +ERROR OP000: Invalid role specification `NONE` revoke role1 from none; ERROR OP000: Invalid role specification `none` revoke select on *.* from none; ERROR OP000: Invalid role specification `none` revoke public from role1; -ERROR OP000: Invalid role specification `public` +ERROR OP000: Invalid role specification `PUBLIC` revoke role1 from public; -ERROR OP000: Invalid role specification `public` revoke select on *.* from public; -ERROR OP000: Invalid role specification `public` show grants for none; ERROR OP000: Invalid role specification `none` show grants for public; -ERROR OP000: Invalid role specification `public` +Grants for PUBLIC create definer=none view test.v1 as select 1; ERROR OP000: Invalid role specification `none` create definer=public view test.v1 as select 1; ERROR OP000: Invalid role specification `public` drop role role1; -insert mysql.global_priv values ('', 'none', '{"is_role":true}'), ('', 'public', '{"is_role":true}'); +create user foo@localhost; +connect foo,localhost,foo; +set default role public; +ERROR OP000: Invalid role specification `PUBLIC` +disconnect foo; +connection default; +update mysql.global_priv set priv=json_insert(priv, '$.default_role', 'none') where user='foo'; +connect foo,localhost,foo; +show grants; +Grants for foo@localhost +GRANT USAGE ON *.* TO `foo`@`localhost` +select * from information_schema.enabled_roles; +ROLE_NAME +NULL +disconnect foo; +connection default; +update mysql.global_priv set priv=json_insert(priv, '$.default_role', 'public') where user='foo'; +connect foo,localhost,foo; +show grants; +Grants for foo@localhost +GRANT USAGE ON *.* TO `foo`@`localhost` +select * from information_schema.enabled_roles; +ROLE_NAME +NULL +disconnect foo; +connection default; +drop user foo@localhost; +insert mysql.global_priv values ('', 'none', '{"is_role":true}'); flush privileges; Warnings: Error 1959 Invalid role specification `none` -Error 1959 Invalid role specification `public` delete from mysql.global_priv where host=''; diff --git a/mysql-test/suite/roles/none_public.test b/mysql-test/suite/roles/none_public.test index a0ec2315cfc80..e88ed45c492aa 100644 --- a/mysql-test/suite/roles/none_public.test +++ b/mysql-test/suite/roles/none_public.test @@ -8,6 +8,8 @@ create role none; create role public; --error ER_CANNOT_USER drop role none; +--error ER_CANNOT_USER +drop role public; --error ER_INVALID_ROLE grant none to role1; @@ -17,9 +19,7 @@ grant role1 to none; grant select on *.* to none; --error ER_INVALID_ROLE grant public to role1; ---error ER_INVALID_ROLE grant role1 to public; ---error ER_INVALID_ROLE grant select on *.* to public; --error ER_INVALID_ROLE @@ -33,14 +33,11 @@ revoke role1 from none; revoke select on *.* from none; --error ER_INVALID_ROLE revoke public from role1; ---error ER_INVALID_ROLE revoke role1 from public; ---error ER_INVALID_ROLE revoke select on *.* from public; --error ER_INVALID_ROLE show grants for none; ---error ER_INVALID_ROLE show grants for public; --error ER_INVALID_ROLE @@ -50,6 +47,29 @@ create definer=public view test.v1 as select 1; drop role role1; -insert mysql.global_priv values ('', 'none', '{"is_role":true}'), ('', 'public', '{"is_role":true}'); +create user foo@localhost; +connect foo,localhost,foo; +--error ER_INVALID_ROLE +set default role public; +disconnect foo; + +connection default; +update mysql.global_priv set priv=json_insert(priv, '$.default_role', 'none') where user='foo'; +connect foo,localhost,foo; +show grants; +select * from information_schema.enabled_roles; +disconnect foo; + +connection default; +update mysql.global_priv set priv=json_insert(priv, '$.default_role', 'public') where user='foo'; +connect foo,localhost,foo; +show grants; +select * from information_schema.enabled_roles; +disconnect foo; + +connection default; +drop user foo@localhost; + +insert mysql.global_priv values ('', 'none', '{"is_role":true}'); flush privileges; delete from mysql.global_priv where host=''; diff --git a/mysql-test/suite/roles/recursive.inc b/mysql-test/suite/roles/recursive.inc index 940a3c9e0db90..7642f2d69bfe2 100644 --- a/mysql-test/suite/roles/recursive.inc +++ b/mysql-test/suite/roles/recursive.inc @@ -17,6 +17,7 @@ source include/not_embedded.inc; create user foo@localhost; +grant select on test.* to foo@localhost; create role role1; create role role2; create role role3; diff --git a/mysql-test/suite/roles/recursive.result b/mysql-test/suite/roles/recursive.result index daacd2ed2501e..0706b0a57bdf0 100644 --- a/mysql-test/suite/roles/recursive.result +++ b/mysql-test/suite/roles/recursive.result @@ -1,4 +1,5 @@ create user foo@localhost; +grant select on test.* to foo@localhost; create role role1; create role role2; create role role3; @@ -26,6 +27,7 @@ ERROR HY000: Cannot grant role 'role10' to: 'role2' connect foo, localhost, foo; show grants; Grants for foo@localhost +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT `role10` TO `foo`@`localhost` select * from information_schema.applicable_roles; @@ -57,6 +59,7 @@ count(*) show grants; Grants for foo@localhost GRANT SELECT ON *.* TO `role1` +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role2` @@ -115,6 +118,7 @@ count(*) show grants; Grants for foo@localhost GRANT SELECT ON `mysql`.* TO `role1` +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` @@ -158,6 +162,7 @@ count(*) show grants; Grants for foo@localhost GRANT SELECT ON `mysql`.`roles_mapping` TO `role1` +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` @@ -203,6 +208,7 @@ count(concat(User)) show grants; Grants for foo@localhost GRANT SELECT (`User`) ON `mysql`.`roles_mapping` TO `role1` +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` @@ -238,6 +244,7 @@ show grants; Grants for foo@localhost GRANT SELECT (`Host`) ON `mysql`.`roles_mapping` TO `role3` GRANT SELECT (`User`) ON `mysql`.`roles_mapping` TO `role1` +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` diff --git a/mysql-test/suite/roles/recursive_dbug.result b/mysql-test/suite/roles/recursive_dbug.result index b94f55ae6fb0b..f6abc4060182a 100644 --- a/mysql-test/suite/roles/recursive_dbug.result +++ b/mysql-test/suite/roles/recursive_dbug.result @@ -3,6 +3,7 @@ Variable_name Value set @old_dbug=@@global.debug_dbug; set global debug_dbug="+d,role_merge_stats"; create user foo@localhost; +grant select on test.* to foo@localhost; create role role1; create role role2; create role role3; @@ -30,6 +31,7 @@ ERROR HY000: Cannot grant role 'role10' to: 'role2' connect foo, localhost, foo; show grants; Grants for foo@localhost +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT `role10` TO `foo`@`localhost` select * from information_schema.applicable_roles; @@ -71,6 +73,7 @@ count(*) show grants; Grants for foo@localhost GRANT SELECT ON *.* TO `role1` +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role2` @@ -139,6 +142,7 @@ count(*) show grants; Grants for foo@localhost GRANT SELECT ON `mysql`.* TO `role1` +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` @@ -192,6 +196,7 @@ count(*) show grants; Grants for foo@localhost GRANT SELECT ON `mysql`.`roles_mapping` TO `role1` +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` @@ -247,6 +252,7 @@ count(concat(User)) show grants; Grants for foo@localhost GRANT SELECT (`User`) ON `mysql`.`roles_mapping` TO `role1` +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` @@ -287,6 +293,7 @@ show grants; Grants for foo@localhost GRANT SELECT (`Host`) ON `mysql`.`roles_mapping` TO `role3` GRANT SELECT (`User`) ON `mysql`.`roles_mapping` TO `role1` +GRANT SELECT ON `test`.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `foo`@`localhost` GRANT USAGE ON *.* TO `role10` GRANT USAGE ON *.* TO `role1` diff --git a/mysql-test/suite/roles/set_role-9614.result b/mysql-test/suite/roles/set_role-9614.result index 318d9ced73e00..d4d689b87e470 100644 --- a/mysql-test/suite/roles/set_role-9614.result +++ b/mysql-test/suite/roles/set_role-9614.result @@ -61,13 +61,11 @@ connect john, localhost, john,,information_schema; show databases; Database information_schema -test set role client; show databases; Database bug_db information_schema -test use bug_db; # # Try using the database as usertestjohn. @@ -76,13 +74,11 @@ connect usertestjohn, localhost, usertestjohn,,information_schema; show databases; Database information_schema -test set role client; show databases; Database bug_db information_schema -test show grants; Grants for usertestjohn@% GRANT `client` TO `usertestjohn`@`%` diff --git a/mysql-test/suite/roles/set_role-database-recursive.result b/mysql-test/suite/roles/set_role-database-recursive.result index be31e645362e7..594ea059988dc 100644 --- a/mysql-test/suite/roles/set_role-database-recursive.result +++ b/mysql-test/suite/roles/set_role-database-recursive.result @@ -19,8 +19,6 @@ localhost test_user test_role1 N localhost test_user test_role2 N select user, host from mysql.db; user host - % - % grant select on mysql.* to test_role2; flush privileges; select * from mysql.roles_mapping; diff --git a/mysql-test/suite/roles/show_create_database-10463.result b/mysql-test/suite/roles/show_create_database-10463.result index 121aab4fe1da6..94f7d7e95baaf 100644 --- a/mysql-test/suite/roles/show_create_database-10463.result +++ b/mysql-test/suite/roles/show_create_database-10463.result @@ -12,7 +12,6 @@ connect con1,localhost,beep,,; show databases; Database information_schema -test show create database db; ERROR 42000: Access denied for user 'beep'@'localhost' to database 'db' select table_schema, table_name from information_schema.tables @@ -23,7 +22,6 @@ show databases; Database db information_schema -test show create database db; Database Create Database db CREATE DATABASE `db` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ @@ -41,7 +39,6 @@ connect con2,localhost,beep2,,; show databases; Database information_schema -test show create database db; ERROR 42000: Access denied for user 'beep2'@'localhost' to database 'db' select table_schema, table_name from information_schema.tables @@ -52,7 +49,6 @@ show databases; Database db information_schema -test show create database db; Database Create Database db CREATE DATABASE `db` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */ diff --git a/mysql-test/suite/roles/show_grants.result b/mysql-test/suite/roles/show_grants.result index 7ae499a9cfca1..21c5a74efe45a 100644 --- a/mysql-test/suite/roles/show_grants.result +++ b/mysql-test/suite/roles/show_grants.result @@ -19,8 +19,6 @@ localhost test_user test_role1 N localhost test_user test_role2 N select user, host from mysql.db; user host - % - % grant select on mysql.* to test_role2; flush privileges; select * from information_schema.applicable_roles; diff --git a/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result b/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result index 2c602ea53aaa1..37d86920f93dc 100644 --- a/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result +++ b/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result @@ -179,7 +179,7 @@ slave-bin.000001 # Gtid 1 # GTID 0-1-16 slave-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by server */ slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # @@ -200,7 +200,7 @@ ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=#/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_bug31076.result b/mysql-test/suite/rpl/r/rpl_bug31076.result index 8fcbba1c4cd65..2d0512ceb82be 100644 --- a/mysql-test/suite/rpl/r/rpl_bug31076.result +++ b/mysql-test/suite/rpl/r/rpl_bug31076.result @@ -36,7 +36,7 @@ KEY `visit_id` (`visit_id`), KEY `data` (`data`) ) ENGINE=MyISAM AUTO_INCREMENT=33900731 DEFAULT CHARSET=latin1; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; BINLOG ' O1ZVRw8BAAAAZgAAAGoAAAAAAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA diff --git a/mysql-test/suite/rpl/r/rpl_hrtime.result b/mysql-test/suite/rpl/r/rpl_hrtime.result index 230029d911975..feae41219655c 100644 --- a/mysql-test/suite/rpl/r/rpl_hrtime.result +++ b/mysql-test/suite/rpl/r/rpl_hrtime.result @@ -30,14 +30,14 @@ connection master; drop table t1; include/rpl_end.inc /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1293832861/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result index 6a91d9d89dec0..f44ce43ac0b9d 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev382.result +++ b/mysql-test/suite/rpl/r/rpl_mdev382.result @@ -172,14 +172,14 @@ master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=14 master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f\'le.txt' INTO TABLE `db1``; select 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!") ;file_id=# master-bin.000001 # Query 1 # COMMIT /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `db1``; select 'oops!'`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -272,14 +272,14 @@ master-bin.000001 # User var 1 # @```d```=_latin1 X'7878787878787878787878787878 master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98)) master-bin.000001 # Query 1 # COMMIT /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `db1``; select 'oops!'`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -379,7 +379,7 @@ master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# master-bin.000002 # Query 1 # use `test`; INSERT INTO t1 VALUES(1) master-bin.000002 # Query 1 # COMMIT /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -388,7 +388,7 @@ START TRANSACTION use `ts``et`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_old_master_29078.result b/mysql-test/suite/rpl/r/rpl_old_master_29078.result index 093e2ae0c2464..bc7f188a48e3b 100644 --- a/mysql-test/suite/rpl/r/rpl_old_master_29078.result +++ b/mysql-test/suite/rpl/r/rpl_old_master_29078.result @@ -9,14 +9,14 @@ connection master; flush binary logs; create table t2 (a timestamp); /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1658586280/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_parallel_29322.result b/mysql-test/suite/rpl/r/rpl_parallel_29322.result index 205a7dbc9cfc8..752fb32122588 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_29322.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_29322.result @@ -35,14 +35,14 @@ flush binary logs; flush binary logs; insert into t2 values (null, 2); /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1658586280/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; @@ -130,14 +130,14 @@ flush binary logs; flush binary logs; insert into t2 values (null, 2); /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1658586280/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8mb3 *//*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_read_only.result b/mysql-test/suite/rpl/r/rpl_read_only.result index dbcd58a224f81..647918889641f 100644 --- a/mysql-test/suite/rpl/r/rpl_read_only.result +++ b/mysql-test/suite/rpl/r/rpl_read_only.result @@ -3,6 +3,7 @@ include/master-slave.inc call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); connection master; create user test; +grant all on test.* to test; connection slave; connect master2,127.0.0.1,test,,test,$MASTER_MYPORT,; connect slave2,127.0.0.1,test,,test,$SLAVE_MYPORT,; diff --git a/mysql-test/suite/rpl/r/rpl_rewrite_db_sys_vars.result b/mysql-test/suite/rpl/r/rpl_rewrite_db_sys_vars.result new file mode 100644 index 0000000000000..5720f647b90cf --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_rewrite_db_sys_vars.result @@ -0,0 +1,163 @@ +include/master-slave.inc +[connection master] +# +# MDEV-15530 Variable replicate_rewrite_db cannot be found +# in "show global variables" +# +# Create DBs and verify that slave has to be stopped before setting sys var +connection slave; +select @@session.server_id; +@@session.server_id +2 +create database replica_db1; +create database y; +create database test_replica; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +primary_db1->replica_db1,x->y +# Ensuring SHOW SLAVE STATUS produces correct value for Replicate_Rewrite_DB... +# ...success +# Create DBs and tables on primary +connection master; +create database primary_db1; +create database x; +use primary_db1; +create table my_table (t int); +insert into my_table values (2),(4); +use x; +create table my_table (t int); +insert into my_table values (654),(532); +include/save_master_gtid.inc +# Check replica +connection slave; +include/sync_with_master_gtid.inc +include/diff_tables.inc [master:primary_db1.my_table,slave:replica_db1.my_table] +include/diff_tables.inc [master:x.my_table,slave:y.my_table] +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +primary_db1->replica_db1,x->y +show tables from replica_db1; +Tables_in_replica_db1 +my_table +select * from replica_db1.my_table; +t +2 +4 +show tables from y; +Tables_in_y +my_table +select * from y.my_table; +t +654 +532 +# Set replica sys var replicate_rewrite_db +connection slave; +SET @@GLOBAL.replicate_rewrite_db="test_master->test_replica"; +ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first +include/stop_slave.inc +SET @save_replicate_rewrite_db = @@GLOBAL.replicate_rewrite_db; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +primary_db1->replica_db1,x->y +SET @@GLOBAL.replicate_rewrite_db="test_master->test_replica"; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +test_master->test_replica +SHOW DATABASES like 'test_replica'; +Database (test_replica) +test_replica +include/start_slave.inc +# Ensuring SHOW SLAVE STATUS produces correct value for Replicate_Rewrite_DB... +# ...success +# Create DB and tables on primary +connection master; +create database test_master; +use test_master; +create table my_table (t int); +insert into my_table values (1),(3); +include/save_master_gtid.inc +# Ensure that the replica receives all of the primary's events without +# error +connection slave; +include/sync_with_master_gtid.inc +Last_SQL_Error = +Last_SQL_Errno = 0 +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +test_master->test_replica +SHOW tables from test_replica; +Tables_in_test_replica +my_table +select * from test_replica.my_table; +t +1 +3 +include/diff_tables.inc [master:test_master.my_table,slave:test_replica.my_table] +# Update of values on primary for DB not set in replication_rewrite_db +connection master; +use x; +insert into my_table values (314); +select * from my_table; +t +654 +532 +314 +include/save_master_gtid.inc +connection slave; +include/stop_slave.inc +include/reset_slave.inc +include/start_slave.inc +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +test_master->test_replica +include/sync_with_master_gtid.inc +select * from y.my_table; +t +654 +532 +# Dynamic updates to the replication filter should be lost after server restart +connection slave; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +test_master->test_replica +connection master; +use x; +insert into my_table values (1000); +select * from my_table; +t +654 +532 +314 +1000 +include/save_master_gtid.inc +connection slave; +include/stop_slave.inc +include/reset_slave.inc +include/rpl_restart_server.inc [server_number=2] +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT, MASTER_USER='root'; +connection slave; +include/start_slave.inc +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +primary_db1->replica_db1,x->y +include/sync_with_master_gtid.inc +select * from y.my_table; +t +654 +532 +314 +1000 +# Cleanup +connection master; +drop database test_master; +drop database primary_db1; +drop database x; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +drop database test_replica; +drop database replica_db1; +drop database y; +include/stop_slave.inc +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result index 67251e2ef72b8..4dea26a5aeb17 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result @@ -161,14 +161,14 @@ c1 c3 c4 c5 connection master; --- Test 2 position test -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -184,14 +184,14 @@ ROLLBACK /* added by mysqlbinlog */; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Test 3 First Remote test -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -289,7 +289,7 @@ c1 c3 c4 c5 connection master; --- Test 5 LOAD DATA -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; DELIMITER ; @@ -299,14 +299,14 @@ ROLLBACK /* added by mysqlbinlog */; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Test 6 reading stdin -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; @@ -328,14 +328,14 @@ ROLLBACK /* added by mysqlbinlog */; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; --- Test 7 reading stdin w/position -- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 55a826b321336..645c86b317d1a 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -778,13 +778,13 @@ test mysqltestbug36570_f1 FUNCTION root@localhost t t DEFINER latin1 latin1_swe connection master; flush logs; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; SET TIMESTAMP=t/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/rpl/r/rpl_temporary.result b/mysql-test/suite/rpl/r/rpl_temporary.result index 650fe1db9e034..492e9ac3ac3d5 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary.result +++ b/mysql-test/suite/rpl/r/rpl_temporary.result @@ -34,6 +34,8 @@ connection master; DROP TABLE t1; connection slave; connection master; +create user zedjzlcsjhd@localhost; +GRANT ALL on test.* to zedjzlcsjhd@localhost; connect con1,localhost,root,,; connect con2,localhost,root,,; connect con3,localhost,zedjzlcsjhd,,; @@ -83,6 +85,7 @@ f 5 7 drop table t1, t2; +drop user zedjzlcsjhd@localhost; use test; SET TIMESTAMP=1040323920; create table t1(f int); @@ -174,7 +177,7 @@ FLUSH PRIVILEGES; GRANT USAGE ON *.* TO user43748@127.0.0.1 IDENTIFIED BY 'meow'; GRANT PROCESS ON *.* TO user43748@127.0.0.1; -- try to KILL system-thread as that non-privileged user (on slave). -connect cont43748,127.0.0.1,user43748,meow,test,$SLAVE_MYPORT,; +connect cont43748,127.0.0.1,user43748,meow,"*NO-ONE*",$SLAVE_MYPORT,; connection cont43748; SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1; KILL @id; diff --git a/mysql-test/suite/rpl/r/rpl_timestamp.result b/mysql-test/suite/rpl/r/rpl_timestamp.result index d287bad449253..31ffd1ed37164 100644 --- a/mysql-test/suite/rpl/r/rpl_timestamp.result +++ b/mysql-test/suite/rpl/r/rpl_timestamp.result @@ -21,14 +21,14 @@ connection master; drop table t1; flush binary logs; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; use `test`/*!*/; SET TIMESTAMP=1656940000/*!*/; SET @@session.pseudo_thread_id=999999999/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0, @@session.system_versioning_insert_history=0/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; diff --git a/mysql-test/suite/rpl/t/rpl_bug31076.test b/mysql-test/suite/rpl/t/rpl_bug31076.test index 5ef2b345eaba6..7e5232974f97c 100644 --- a/mysql-test/suite/rpl/t/rpl_bug31076.test +++ b/mysql-test/suite/rpl/t/rpl_bug31076.test @@ -46,7 +46,7 @@ CREATE TABLE `visits_events` ( ) ENGINE=MyISAM AUTO_INCREMENT=33900731 DEFAULT CHARSET=latin1; /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; --delimiter /*!*/; diff --git a/mysql-test/suite/rpl/t/rpl_read_only.test b/mysql-test/suite/rpl/t/rpl_read_only.test index c4781bbbb3bea..15d5f74fb6d8b 100644 --- a/mysql-test/suite/rpl/t/rpl_read_only.test +++ b/mysql-test/suite/rpl/t/rpl_read_only.test @@ -7,6 +7,7 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state # Create a test and replicate it to slave connection master; create user test; +grant all on test.* to test; sync_slave_with_master; # Setting the master readonly : diff --git a/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars-slave.opt b/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars-slave.opt new file mode 100644 index 0000000000000..5a8f8233a634d --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars-slave.opt @@ -0,0 +1,2 @@ +"--replicate-rewrite-db=primary_db1->replica_db1" +"--replicate-rewrite-db=x->y" diff --git a/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test b/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test new file mode 100644 index 0000000000000..b06899bb12e06 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test @@ -0,0 +1,163 @@ +-- source include/have_binlog_format_mixed.inc +-- source include/master-slave.inc + +# Testing rpl option replicate_rewrite_db + +--echo # +--echo # MDEV-15530 Variable replicate_rewrite_db cannot be found +--echo # in "show global variables" +--echo # + +--echo # Create DBs and verify that slave has to be stopped before setting sys var + +connection slave; +--let $rpl_server_id= `select @@session.server_id` +select @@session.server_id; + +# These DBs will be rewrited from opt file +create database replica_db1; +create database y; +# This DB will be rewrited from test case +create database test_replica; +SELECT @@GLOBAL.replicate_rewrite_db; +let $rewrite_db_sss= query_get_value(SHOW SLAVE STATUS, Replicate_Rewrite_DB, 1); +--echo # Ensuring SHOW SLAVE STATUS produces correct value for Replicate_Rewrite_DB... +if (`SELECT strcmp(@@global.replicate_rewrite_db, "$rewrite_db_sss") != 0`) +{ + die SHOW SLAVE STATUS Replicate_Rewrite_DB value $rewrite_db_sss does not match variable @@GLOBAL.replicate_rewrite_db; +} +--echo # ...success + + +--echo # Create DBs and tables on primary +connection master; +--enable_warnings +create database primary_db1; +create database x; +use primary_db1; +create table my_table (t int); +insert into my_table values (2),(4); +use x; +create table my_table (t int); +insert into my_table values (654),(532); +--source include/save_master_gtid.inc + +--echo # Check replica +--connection slave +--source include/sync_with_master_gtid.inc +--let $diff_tables=master:primary_db1.my_table,slave:replica_db1.my_table +--source include/diff_tables.inc +--let $diff_tables=master:x.my_table,slave:y.my_table +--source include/diff_tables.inc +SELECT @@GLOBAL.replicate_rewrite_db; +show tables from replica_db1; +select * from replica_db1.my_table; +show tables from y; +select * from y.my_table; + +--echo # Set replica sys var replicate_rewrite_db +connection slave; +--error ER_SLAVE_MUST_STOP +SET @@GLOBAL.replicate_rewrite_db="test_master->test_replica"; +source include/stop_slave.inc; +SET @save_replicate_rewrite_db = @@GLOBAL.replicate_rewrite_db; +SELECT @@GLOBAL.replicate_rewrite_db; +SET @@GLOBAL.replicate_rewrite_db="test_master->test_replica"; +SELECT @@GLOBAL.replicate_rewrite_db; +SHOW DATABASES like 'test_replica'; +source include/start_slave.inc; +let $rewrite_db_sss= query_get_value(SHOW SLAVE STATUS, Replicate_Rewrite_DB, 1); +--echo # Ensuring SHOW SLAVE STATUS produces correct value for Replicate_Rewrite_DB... +if (`SELECT strcmp(@@global.replicate_rewrite_db, "$rewrite_db_sss") != 0`) +{ + die SHOW SLAVE STATUS Replicate_Rewrite_DB value $rewrite_db_sss does not match variable @@GLOBAL.replicate_rewrite_db; +} +--echo # ...success + +--echo # Create DB and tables on primary +connection master; +--enable_warnings +create database test_master; +use test_master; +create table my_table (t int); +insert into my_table values (1),(3); +--source include/save_master_gtid.inc + +--echo # Ensure that the replica receives all of the primary's events without +--echo # error +--connection slave +--source include/sync_with_master_gtid.inc +let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); +--echo Last_SQL_Error = $error +let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); +--echo Last_SQL_Errno = $errno + +SELECT @@GLOBAL.replicate_rewrite_db; +SHOW tables from test_replica; +select * from test_replica.my_table; + +# Additional check for tables +--let $diff_tables=master:test_master.my_table,slave:test_replica.my_table +--source include/diff_tables.inc + +--echo # Update of values on primary for DB not set in replication_rewrite_db +connection master; +use x; +insert into my_table values (314); +select * from my_table; +--source include/save_master_gtid.inc + +connection slave; +--source include/stop_slave.inc +--source include/reset_slave.inc +--source include/start_slave.inc +SELECT @@GLOBAL.replicate_rewrite_db; +--source include/sync_with_master_gtid.inc +# This shouldn't get the new values from x DB on master +select * from y.my_table; + +--echo # Dynamic updates to the replication filter should be lost after server restart +# Old value +connection slave; +SELECT @@GLOBAL.replicate_rewrite_db; + +connection master; +use x; +insert into my_table values (1000); +select * from my_table; +--source include/save_master_gtid.inc + +connection slave; +--source include/stop_slave.inc +--source include/reset_slave.inc +--let $rpl_server_number= 2 +--source include/rpl_restart_server.inc +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root'; + +# New value +connection slave; +--source include/start_slave.inc +SELECT @@GLOBAL.replicate_rewrite_db; +--source include/sync_with_master_gtid.inc +# This should update values with 314 and 1000 from primary +select * from y.my_table; + +--echo # Cleanup +connection master; +drop database test_master; +drop database primary_db1; +drop database x; +--source include/save_master_gtid.inc + + +--connection slave +--source include/sync_with_master_gtid.inc +drop database test_replica; +drop database replica_db1; +drop database y; +source include/stop_slave.inc; +source include/start_slave.inc; + +--source include/rpl_end.inc +# end of 10.11 tests diff --git a/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt b/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt index 84059110136cc..cb165442c2370 100644 --- a/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_rewrt_db-slave.opt @@ -1 +1,6 @@ -"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1 -> test" "--replicate-rewrite-db=x -> y" "--replicate-rewrite-db=database_master_temp_01->database_slave_temp_01" "--replicate-rewrite-db=database_master_temp_02->database_slave_temp_02" "--replicate-rewrite-db=database_master_temp_03->database_slave_temp_03" +"--replicate-rewrite-db=test->rewrite" +"--replicate-rewrite-db=mysqltest1 -> test" +"--replicate-rewrite-db=x -> y" +"--replicate-rewrite-db=database_master_temp_01->database_slave_temp_01" +"--replicate-rewrite-db=database_master_temp_02->database_slave_temp_02" +"--replicate-rewrite-db=database_master_temp_03->database_slave_temp_03" diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test index 729f275bb0d2f..0ec57715f798e 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temporary.test @@ -99,6 +99,9 @@ sync_slave_with_master; connection master; +create user zedjzlcsjhd@localhost; +GRANT ALL on test.* to zedjzlcsjhd@localhost; + connect (con1,localhost,root,,); connect (con2,localhost,root,,); # We want to connect as an unprivileged user. But if we use user="" then this @@ -182,6 +185,7 @@ select * from t2 ORDER BY f; #show binlog events; drop table t1, t2; +drop user zedjzlcsjhd@localhost; use test; SET TIMESTAMP=1040323920; @@ -339,7 +343,7 @@ GRANT USAGE ON *.* TO user43748@127.0.0.1 IDENTIFIED BY 'meow'; GRANT PROCESS ON *.* TO user43748@127.0.0.1; --echo -- try to KILL system-thread as that non-privileged user (on slave). -connect (cont43748,127.0.0.1,user43748,meow,test,$SLAVE_MYPORT,); +connect (cont43748,127.0.0.1,user43748,meow,"*NO-ONE*",$SLAVE_MYPORT,); connection cont43748; SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1; diff --git a/mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc b/mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc index 4ea7a2aff4664..e097938f3c8f1 100644 --- a/mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc +++ b/mysql-test/suite/sys_vars/inc/secure_timestamp_func.inc @@ -17,7 +17,7 @@ set timestamp=default; --echo ### SUPER create user foo@127.0.0.1; grant super on *.* TO `foo`@`127.0.0.1`; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; disable_abort_on_error; set timestamp=1234567890.101112; enable_abort_on_error; @@ -30,7 +30,7 @@ set timestamp=default; --echo ### BINLOG REPLAY create user foo@127.0.0.1; grant binlog replay on *.* TO `foo`@`127.0.0.1`; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; disable_abort_on_error; set timestamp=1234567890.101112; enable_abort_on_error; @@ -42,7 +42,7 @@ set timestamp=default; --echo ### non-privileged user create user foo@127.0.0.1; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; disable_abort_on_error; set timestamp=1234567890.101112; enable_abort_on_error; diff --git a/mysql-test/suite/sys_vars/r/automatic_sp_privileges_func.result b/mysql-test/suite/sys_vars/r/automatic_sp_privileges_func.result index d4d582b92d5d4..421ea1446785e 100644 --- a/mysql-test/suite/sys_vars/r/automatic_sp_privileges_func.result +++ b/mysql-test/suite/sys_vars/r/automatic_sp_privileges_func.result @@ -3,7 +3,9 @@ SET @global_automatic_sp_privileges = @@GLOBAL.automatic_sp_privileges; CREATE TABLE t1 (a varchar(200)); INSERT INTO t1 VALUES('Procedure Executed.'); CREATE USER 'userTest'@'localhost'; +GRANT CREATE ROUTINE, SELECT ON test.* to 'userTest'@'localhost'; CREATE USER 'userTest1'@'localhost'; +GRANT CREATE ROUTINE, SELECT ON test.* to 'userTest1'@'localhost'; connection default; SET GLOBAL automatic_sp_privileges = TRUE; connect conUser,localhost,userTest,,; diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffer_max_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffer_max_size_basic.result deleted file mode 100644 index 03f11ece3582e..0000000000000 --- a/mysql-test/suite/sys_vars/r/innodb_change_buffer_max_size_basic.result +++ /dev/null @@ -1,77 +0,0 @@ -SET @start_global_value = @@global.innodb_change_buffer_max_size; -SELECT @start_global_value; -@start_global_value -25 -Valid values are between 0 and 50 -select @@global.innodb_change_buffer_max_size between 0 and 50; -@@global.innodb_change_buffer_max_size between 0 and 50 -1 -select @@global.innodb_change_buffer_max_size; -@@global.innodb_change_buffer_max_size -25 -select @@session.innodb_change_buffer_max_size; -ERROR HY000: Variable 'innodb_change_buffer_max_size' is a GLOBAL variable -show global variables like 'innodb_change_buffer_max_size'; -Variable_name Value -innodb_change_buffer_max_size 25 -show session variables like 'innodb_change_buffer_max_size'; -Variable_name Value -innodb_change_buffer_max_size 25 -select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFER_MAX_SIZE 25 -select * from information_schema.session_variables where variable_name='innodb_change_buffer_max_size'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFER_MAX_SIZE 25 -set global innodb_change_buffer_max_size=10; -select @@global.innodb_change_buffer_max_size; -@@global.innodb_change_buffer_max_size -10 -select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFER_MAX_SIZE 10 -select * from information_schema.session_variables where variable_name='innodb_change_buffer_max_size'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFER_MAX_SIZE 10 -set session innodb_change_buffer_max_size=1; -ERROR HY000: Variable 'innodb_change_buffer_max_size' is a GLOBAL variable and should be set with SET GLOBAL -set global innodb_change_buffer_max_size=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_change_buffer_max_size' -set global innodb_change_buffer_max_size=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_change_buffer_max_size' -set global innodb_change_buffer_max_size="foo"; -ERROR 42000: Incorrect argument type to variable 'innodb_change_buffer_max_size' -set global innodb_change_buffer_max_size=-7; -Warnings: -Warning 1292 Truncated incorrect innodb_change_buffer_max_size value: '-7' -select @@global.innodb_change_buffer_max_size; -@@global.innodb_change_buffer_max_size -0 -select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFER_MAX_SIZE 0 -set global innodb_change_buffer_max_size=56; -Warnings: -Warning 1292 Truncated incorrect innodb_change_buffer_max_size value: '56' -select @@global.innodb_change_buffer_max_size; -@@global.innodb_change_buffer_max_size -50 -select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFER_MAX_SIZE 50 -set global innodb_change_buffer_max_size=0; -select @@global.innodb_change_buffer_max_size; -@@global.innodb_change_buffer_max_size -0 -set global innodb_change_buffer_max_size=50; -select @@global.innodb_change_buffer_max_size; -@@global.innodb_change_buffer_max_size -50 -set global innodb_change_buffer_max_size=DEFAULT; -select @@global.innodb_change_buffer_max_size; -@@global.innodb_change_buffer_max_size -25 -SET @@global.innodb_change_buffer_max_size = @start_global_value; -SELECT @@global.innodb_change_buffer_max_size; -@@global.innodb_change_buffer_max_size -25 diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result deleted file mode 100644 index f3b7ac80523a2..0000000000000 --- a/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result +++ /dev/null @@ -1,73 +0,0 @@ -SET @start_global_value = @@global.innodb_change_buffering; -SELECT @start_global_value; -@start_global_value -none -Valid values are 'all', 'deletes', 'changes', 'inserts', 'none', 'purges' -select @@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges'); -@@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges') -1 -select @@global.innodb_change_buffering; -@@global.innodb_change_buffering -none -select @@session.innodb_change_buffering; -ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable -show global variables like 'innodb_change_buffering'; -Variable_name Value -innodb_change_buffering none -show session variables like 'innodb_change_buffering'; -Variable_name Value -innodb_change_buffering none -select * from information_schema.global_variables where variable_name='innodb_change_buffering'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING none -select * from information_schema.session_variables where variable_name='innodb_change_buffering'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING none -set global innodb_change_buffering='none'; -Warnings: -Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release -select @@global.innodb_change_buffering; -@@global.innodb_change_buffering -none -select * from information_schema.global_variables where variable_name='innodb_change_buffering'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING none -select * from information_schema.session_variables where variable_name='innodb_change_buffering'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING none -set @@global.innodb_change_buffering='inserts'; -Warnings: -Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release -select @@global.innodb_change_buffering; -@@global.innodb_change_buffering -inserts -select * from information_schema.global_variables where variable_name='innodb_change_buffering'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING inserts -select * from information_schema.session_variables where variable_name='innodb_change_buffering'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING inserts -set session innodb_change_buffering='some'; -ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable and should be set with SET GLOBAL -set @@session.innodb_change_buffering='some'; -ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable and should be set with SET GLOBAL -set global innodb_change_buffering=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering' -set global innodb_change_buffering=1; -Warnings: -Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release -SELECT @@global.innodb_change_buffering; -@@global.innodb_change_buffering -inserts -set global innodb_change_buffering=-2; -ERROR 42000: Variable 'innodb_change_buffering' can't be set to the value of '-2' -set global innodb_change_buffering=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering' -set global innodb_change_buffering='some'; -ERROR 42000: Variable 'innodb_change_buffering' can't be set to the value of 'some' -SET @@global.innodb_change_buffering = @start_global_value; -Warnings: -Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release -SELECT @@global.innodb_change_buffering; -@@global.innodb_change_buffering -none diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result deleted file mode 100644 index 2cb3fc76e3071..0000000000000 --- a/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result +++ /dev/null @@ -1,67 +0,0 @@ -SET @start_global_value = @@global.innodb_change_buffering_debug; -SELECT @start_global_value; -@start_global_value -0 -select @@global.innodb_change_buffering_debug in (0, 1); -@@global.innodb_change_buffering_debug in (0, 1) -1 -select @@global.innodb_change_buffering_debug; -@@global.innodb_change_buffering_debug -0 -select @@session.innodb_change_buffering_debug; -ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable -show global variables like 'innodb_change_buffering_debug'; -Variable_name Value -innodb_change_buffering_debug 0 -show session variables like 'innodb_change_buffering_debug'; -Variable_name Value -innodb_change_buffering_debug 0 -select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING_DEBUG 0 -select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING_DEBUG 0 -set global innodb_change_buffering_debug=1; -select @@global.innodb_change_buffering_debug; -@@global.innodb_change_buffering_debug -1 -select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING_DEBUG 1 -select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING_DEBUG 1 -set @@global.innodb_change_buffering_debug=0; -select @@global.innodb_change_buffering_debug; -@@global.innodb_change_buffering_debug -0 -select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING_DEBUG 0 -select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING_DEBUG 0 -set session innodb_change_buffering_debug='some'; -ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable and should be set with SET GLOBAL -set @@session.innodb_change_buffering_debug='some'; -ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable and should be set with SET GLOBAL -set global innodb_change_buffering_debug=1.1; -ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug' -set global innodb_change_buffering_debug='foo'; -ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug' -set global innodb_change_buffering_debug=-2; -Warnings: -Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '-2' -set global innodb_change_buffering_debug=1e1; -ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug' -set global innodb_change_buffering_debug=2; -Warnings: -Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '2' -select @@global.innodb_change_buffering_debug; -@@global.innodb_change_buffering_debug -1 -SET @@global.innodb_change_buffering_debug = @start_global_value; -SELECT @@global.innodb_change_buffering_debug; -@@global.innodb_change_buffering_debug -0 diff --git a/mysql-test/suite/sys_vars/r/innodb_file_io_threads_basic.result b/mysql-test/suite/sys_vars/r/innodb_file_io_threads_basic.result index 5ef7e1099e063..0442cee05514b 100644 --- a/mysql-test/suite/sys_vars/r/innodb_file_io_threads_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_file_io_threads_basic.result @@ -8,16 +8,10 @@ COUNT(@@GLOBAL.innodb_write_io_threads) 1 1 Expected '#---------------------BS_STVARS_027_02----------------------#' -SET @@GLOBAL.innodb_read_io_threads=1; -ERROR HY000: Variable 'innodb_read_io_threads' is a read only variable -Expected error 'Read only variable' SELECT COUNT(@@GLOBAL.innodb_read_io_threads); COUNT(@@GLOBAL.innodb_read_io_threads) 1 1 Expected -SET @@GLOBAL.innodb_write_io_threads=1; -ERROR HY000: Variable 'innodb_write_io_threads' is a read only variable -Expected error 'Read only variable' SELECT COUNT(@@GLOBAL.innodb_write_io_threads); COUNT(@@GLOBAL.innodb_write_io_threads) 1 diff --git a/mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result b/mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result index 9780357e69ff1..9d7555335a7e0 100644 --- a/mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result @@ -9,18 +9,26 @@ COUNT(@@GLOBAL.innodb_file_per_table) 1 Expected '#---------------------BS_STVARS_028_02----------------------#' SET @@global.innodb_file_per_table = 0; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SELECT @@global.innodb_file_per_table; @@global.innodb_file_per_table 0 SET @@global.innodb_file_per_table ='On' ; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SELECT @@global.innodb_file_per_table; @@global.innodb_file_per_table 1 SET @@global.innodb_file_per_table ='Off' ; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SELECT @@global.innodb_file_per_table; @@global.innodb_file_per_table 0 SET @@global.innodb_file_per_table = 1; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SELECT @@global.innodb_file_per_table; @@global.innodb_file_per_table 1 @@ -64,6 +72,8 @@ COUNT(@@GLOBAL.innodb_file_per_table) SELECT innodb_file_per_table = @@SESSION.innodb_file_per_table; ERROR 42S22: Unknown column 'innodb_file_per_table' in 'field list' SET @@global.innodb_file_per_table = @start_global_value; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release SELECT @@global.innodb_file_per_table; @@global.innodb_file_per_table 1 diff --git a/mysql-test/suite/sys_vars/r/innodb_read_io_threads_basic.result b/mysql-test/suite/sys_vars/r/innodb_read_io_threads_basic.result index f43fa81c0d052..6ec897cea0212 100644 --- a/mysql-test/suite/sys_vars/r/innodb_read_io_threads_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_read_io_threads_basic.result @@ -15,7 +15,15 @@ INNODB_READ_IO_THREADS 2 select * from information_schema.session_variables where variable_name='innodb_read_io_threads'; VARIABLE_NAME VARIABLE_VALUE INNODB_READ_IO_THREADS 2 -set global innodb_read_io_threads=1; -ERROR HY000: Variable 'innodb_read_io_threads' is a read only variable +select @@innodb_read_io_threads into @n; +set global innodb_read_io_threads = 1; +select @@innodb_read_io_threads; +@@innodb_read_io_threads +1 +set global innodb_read_io_threads=64; +select @@innodb_read_io_threads; +@@innodb_read_io_threads +64 set session innodb_read_io_threads=1; -ERROR HY000: Variable 'innodb_read_io_threads' is a read only variable +ERROR HY000: Variable 'innodb_read_io_threads' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_read_io_threads=@n; diff --git a/mysql-test/suite/sys_vars/r/innodb_write_io_threads_basic.result b/mysql-test/suite/sys_vars/r/innodb_write_io_threads_basic.result index a363f4292ddd9..b9e5e083a9091 100644 --- a/mysql-test/suite/sys_vars/r/innodb_write_io_threads_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_write_io_threads_basic.result @@ -15,7 +15,13 @@ INNODB_WRITE_IO_THREADS 2 select * from information_schema.session_variables where variable_name='innodb_write_io_threads'; VARIABLE_NAME VARIABLE_VALUE INNODB_WRITE_IO_THREADS 2 +select @@innodb_write_io_threads into @n; set global innodb_write_io_threads=1; -ERROR HY000: Variable 'innodb_write_io_threads' is a read only variable -set session innodb_write_io_threads=1; -ERROR HY000: Variable 'innodb_write_io_threads' is a read only variable +select @@innodb_write_io_threads; +@@innodb_write_io_threads +2 +set global innodb_write_io_threads=64; +select @@innodb_write_io_threads; +@@innodb_write_io_threads +64 +set global innodb_write_io_threads=@n; diff --git a/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result index 0bec3eb2b2915..8291800afa3ea 100644 --- a/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result +++ b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result @@ -3,6 +3,7 @@ drop table if exists t1; SET @start_value= @@global.log_bin_trust_function_creators; ## Creating new user tt ## CREATE USER tt@localhost; +GRANT ALL ON test.* TO tt@localhost; ## Setting value of variable to 0 ## SET @@global.log_bin_trust_function_creators = 0; ## Creating new table t2 ## diff --git a/mysql-test/suite/sys_vars/r/log_slow_disabled_statements_basic.result b/mysql-test/suite/sys_vars/r/log_slow_disabled_statements_basic.result deleted file mode 100644 index 7ef4931a288ad..0000000000000 --- a/mysql-test/suite/sys_vars/r/log_slow_disabled_statements_basic.result +++ /dev/null @@ -1,72 +0,0 @@ -SET @start_global_value = @@global.log_slow_disabled_statements; -select @@global.log_slow_disabled_statements; -@@global.log_slow_disabled_statements -sp -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements -sp -show global variables like 'log_slow_disabled_statements'; -Variable_name Value -log_slow_disabled_statements sp -show session variables like 'log_slow_disabled_statements'; -Variable_name Value -log_slow_disabled_statements sp -select * from information_schema.global_variables where variable_name='log_slow_disabled_statements'; -VARIABLE_NAME VARIABLE_VALUE -LOG_SLOW_DISABLED_STATEMENTS sp -select * from information_schema.session_variables where variable_name='log_slow_disabled_statements'; -VARIABLE_NAME VARIABLE_VALUE -LOG_SLOW_DISABLED_STATEMENTS sp -set global log_slow_disabled_statements=1; -select @@global.log_slow_disabled_statements; -@@global.log_slow_disabled_statements -admin -set session log_slow_disabled_statements=1; -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements -admin -set session log_slow_disabled_statements=1; -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements -admin -set session log_slow_disabled_statements=2; -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements -call -set session log_slow_disabled_statements=5; -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements -admin,slave -set session log_slow_disabled_statements='admin'; -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements -admin -set session log_slow_disabled_statements='slave'; -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements -slave -set session log_slow_disabled_statements='call'; -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements -call -set session log_slow_disabled_statements='sp'; -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements -sp -set session log_slow_disabled_statements='admin,sp,call,slave'; -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements -admin,call,slave,sp -set session log_slow_disabled_statements=''; -select @@session.log_slow_disabled_statements; -@@session.log_slow_disabled_statements - -set session log_slow_disabled_statements=1.1; -ERROR 42000: Incorrect argument type to variable 'log_slow_disabled_statements' -set session log_slow_disabled_statements=1e1; -ERROR 42000: Incorrect argument type to variable 'log_slow_disabled_statements' -set session log_slow_disabled_statements="foo"; -ERROR 42000: Variable 'log_slow_disabled_statements' can't be set to the value of 'foo' -set session log_slow_disabled_statements=1024; -ERROR 42000: Variable 'log_slow_disabled_statements' can't be set to the value of '1024' -SET @@global.log_slow_disabled_statements = @start_global_value; diff --git a/mysql-test/suite/sys_vars/r/log_slow_filter_basic.result b/mysql-test/suite/sys_vars/r/log_slow_filter_basic.result deleted file mode 100644 index 93558fb6dd909..0000000000000 --- a/mysql-test/suite/sys_vars/r/log_slow_filter_basic.result +++ /dev/null @@ -1,100 +0,0 @@ -SET @start_global_value = @@global.log_slow_filter; -select @@global.log_slow_filter; -@@global.log_slow_filter -admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk -select @@session.log_slow_filter; -@@session.log_slow_filter -admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk -show global variables like 'log_slow_filter'; -Variable_name Value -log_slow_filter admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk -show session variables like 'log_slow_filter'; -Variable_name Value -log_slow_filter admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk -select * from information_schema.global_variables where variable_name='log_slow_filter'; -VARIABLE_NAME VARIABLE_VALUE -LOG_SLOW_FILTER admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk -select * from information_schema.session_variables where variable_name='log_slow_filter'; -VARIABLE_NAME VARIABLE_VALUE -LOG_SLOW_FILTER admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk -set global log_slow_filter=1; -select @@global.log_slow_filter; -@@global.log_slow_filter -admin -set session log_slow_filter=1; -select @@session.log_slow_filter; -@@session.log_slow_filter -admin -set session log_slow_filter=1; -select @@session.log_slow_filter; -@@session.log_slow_filter -admin -set session log_slow_filter=2; -select @@session.log_slow_filter; -@@session.log_slow_filter -filesort -set session log_slow_filter=5; -select @@session.log_slow_filter; -@@session.log_slow_filter -admin,filesort_on_disk -set session log_slow_filter='admin'; -select @@session.log_slow_filter; -@@session.log_slow_filter -admin -set session log_slow_filter='filesort'; -select @@session.log_slow_filter; -@@session.log_slow_filter -filesort -set session log_slow_filter='filesort_on_disk'; -select @@session.log_slow_filter; -@@session.log_slow_filter -filesort_on_disk -set session log_slow_filter='full_join'; -select @@session.log_slow_filter; -@@session.log_slow_filter -full_join -set session log_slow_filter='full_scan'; -select @@session.log_slow_filter; -@@session.log_slow_filter -full_scan -set session log_slow_filter='not_using_index'; -select @@session.log_slow_filter; -@@session.log_slow_filter -not_using_index -set session log_slow_filter='query_cache'; -select @@session.log_slow_filter; -@@session.log_slow_filter -query_cache -set session log_slow_filter='query_cache_miss'; -select @@session.log_slow_filter; -@@session.log_slow_filter -query_cache_miss -set session log_slow_filter='tmp_table'; -select @@session.log_slow_filter; -@@session.log_slow_filter -tmp_table -set session log_slow_filter='tmp_table_on_disk'; -select @@session.log_slow_filter; -@@session.log_slow_filter -tmp_table_on_disk -set session log_slow_filter='filesort,query_cache'; -select @@session.log_slow_filter; -@@session.log_slow_filter -filesort,query_cache -set session log_slow_filter='admin,not_using_index,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk'; -select @@session.log_slow_filter; -@@session.log_slow_filter -admin,filesort,filesort_on_disk,full_join,full_scan,not_using_index,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk -set session log_slow_filter=''; -select @@session.log_slow_filter; -@@session.log_slow_filter - -set session log_slow_filter=1.1; -ERROR 42000: Incorrect argument type to variable 'log_slow_filter' -set session log_slow_filter=1e1; -ERROR 42000: Incorrect argument type to variable 'log_slow_filter' -set session log_slow_filter="foo"; -ERROR 42000: Variable 'log_slow_filter' can't be set to the value of 'foo' -set session log_slow_filter=16384; -ERROR 42000: Variable 'log_slow_filter' can't be set to the value of '16384' -SET @@global.log_slow_filter = @start_global_value; diff --git a/mysql-test/suite/sys_vars/r/log_slow_queries_basic.result b/mysql-test/suite/sys_vars/r/log_slow_queries_basic.result deleted file mode 100644 index 2c47106ecb351..0000000000000 --- a/mysql-test/suite/sys_vars/r/log_slow_queries_basic.result +++ /dev/null @@ -1,132 +0,0 @@ -SET @start_value = @@global.log_slow_queries; -SELECT @start_value; -@start_value -1 -'#---------------------FN_DYNVARS_004_01-------------------------#' -SET @@global.log_slow_queries = DEFAULT; -Warnings: -Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead -SELECT @@global.log_slow_queries = 0; -@@global.log_slow_queries = 0 -1 -'#--------------------FN_DYNVARS_004_02------------------------#' -SET @@global.log_slow_queries = ON; -Warnings: -Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead -SELECT @@global.log_slow_queries; -@@global.log_slow_queries -1 -SET @@global.log_slow_queries = OFF; -Warnings: -Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead -SELECT @@global.log_slow_queries; -@@global.log_slow_queries -0 -'#--------------------FN_DYNVARS_004_03-------------------------#' -SET @@global.log_slow_queries = 2; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of '2' -SET @@global.log_slow_queries = -1; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of '-1' -SET @@global.log_slow_queries = TRUEF; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of 'TRUEF' -SET @@global.log_slow_queries = TRUE_F; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of 'TRUE_F' -SET @@global.log_slow_queries = FALSE0; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of 'FALSE0' -SET @@global.log_slow_queries = OON; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of 'OON' -SET @@global.log_slow_queries = ONN; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of 'ONN' -SET @@global.log_slow_queries = OOFF; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of 'OOFF' -SET @@global.log_slow_queries = 0FF; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of '0FF' -SET @@global.log_slow_queries = ' '; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of ' ' -SET @@global.log_slow_queries = " "; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of ' ' -SET @@global.log_slow_queries = ''; -ERROR 42000: Variable 'log_slow_queries' can't be set to the value of '' -'#-------------------FN_DYNVARS_004_04----------------------------#' -SET @@session.log_slow_queries = OFF; -ERROR HY000: Variable 'log_slow_queries' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@session.log_slow_queries; -ERROR HY000: Variable 'log_slow_queries' is a GLOBAL variable -'#----------------------FN_DYNVARS_004_05------------------------#' -SELECT IF(@@global.log_slow_queries, "ON", "OFF") = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='log_slow_queries'; -IF(@@global.log_slow_queries, "ON", "OFF") = VARIABLE_VALUE -1 -'#---------------------FN_DYNVARS_004_06----------------------#' -SET @@global.log_slow_queries = 0; -Warnings: -Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead -SELECT @@global.log_slow_queries; -@@global.log_slow_queries -0 -SELECT IF(@@global.log_slow_queries, "ON", "OFF") = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='log_slow_queries'; -IF(@@global.log_slow_queries, "ON", "OFF") = VARIABLE_VALUE -1 -SET @@global.log_slow_queries = 1; -Warnings: -Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead -SELECT @@global.log_slow_queries; -@@global.log_slow_queries -1 -SELECT IF(@@global.log_slow_queries, "ON", "OFF") = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='log_slow_queries'; -IF(@@global.log_slow_queries, "ON", "OFF") = VARIABLE_VALUE -1 -'#---------------------FN_DYNVARS_004_07----------------------#' -SET @@global.log_slow_queries = TRUE; -Warnings: -Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead -SELECT @@global.log_slow_queries; -@@global.log_slow_queries -1 -SELECT IF(@@global.log_slow_queries, "ON", "OFF") = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='log_slow_queries'; -IF(@@global.log_slow_queries, "ON", "OFF") = VARIABLE_VALUE -1 -SET @@global.log_slow_queries = FALSE; -Warnings: -Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead -SELECT @@global.log_slow_queries; -@@global.log_slow_queries -0 -SELECT IF(@@global.log_slow_queries, "ON", "OFF") = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='log_slow_queries'; -IF(@@global.log_slow_queries, "ON", "OFF") = VARIABLE_VALUE -1 -'#---------------------FN_DYNVARS_004_08----------------------#' -SET @@global.log_slow_queries = ON; -Warnings: -Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead -SELECT @@log_slow_queries = @@global.log_slow_queries; -@@log_slow_queries = @@global.log_slow_queries -1 -'#---------------------FN_DYNVARS_004_09----------------------#' -SET log_slow_queries = ON; -ERROR HY000: Variable 'log_slow_queries' is a GLOBAL variable and should be set with SET GLOBAL -SET local.log_slow_queries = OFF; -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 'log_slow_queries = OFF' at line 1 -SELECT local.log_slow_queries; -ERROR 42S02: Unknown table 'local' in field list -SET global.log_slow_queries = ON; -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 'log_slow_queries = ON' at line 1 -SELECT global.log_slow_queries; -ERROR 42S02: Unknown table 'global' in field list -SELECT log_slow_queries = @@session.log_slow_queries; -ERROR 42S22: Unknown column 'log_slow_queries' in 'field list' -SET @@global.log_slow_queries = @start_value; -Warnings: -Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead -SELECT @@global.log_slow_queries; -@@global.log_slow_queries -1 diff --git a/mysql-test/suite/sys_vars/r/log_slow_rate_limit_basic.result b/mysql-test/suite/sys_vars/r/log_slow_rate_limit_basic.result deleted file mode 100644 index 707c4f2a05809..0000000000000 --- a/mysql-test/suite/sys_vars/r/log_slow_rate_limit_basic.result +++ /dev/null @@ -1,47 +0,0 @@ -SET @start_global_value = @@global.log_slow_rate_limit; -select @@global.log_slow_rate_limit; -@@global.log_slow_rate_limit -1 -select @@session.log_slow_rate_limit; -@@session.log_slow_rate_limit -1 -show global variables like 'log_slow_rate_limit'; -Variable_name Value -log_slow_rate_limit 1 -show session variables like 'log_slow_rate_limit'; -Variable_name Value -log_slow_rate_limit 1 -select * from information_schema.global_variables where variable_name='log_slow_rate_limit'; -VARIABLE_NAME VARIABLE_VALUE -LOG_SLOW_RATE_LIMIT 1 -select * from information_schema.session_variables where variable_name='log_slow_rate_limit'; -VARIABLE_NAME VARIABLE_VALUE -LOG_SLOW_RATE_LIMIT 1 -set global log_slow_rate_limit=10; -select @@global.log_slow_rate_limit; -@@global.log_slow_rate_limit -10 -set session log_slow_rate_limit=10; -select @@session.log_slow_rate_limit; -@@session.log_slow_rate_limit -10 -set global log_slow_rate_limit=1.1; -ERROR 42000: Incorrect argument type to variable 'log_slow_rate_limit' -set session log_slow_rate_limit=1e1; -ERROR 42000: Incorrect argument type to variable 'log_slow_rate_limit' -set global log_slow_rate_limit="foo"; -ERROR 42000: Incorrect argument type to variable 'log_slow_rate_limit' -set global log_slow_rate_limit=0; -Warnings: -Warning 1292 Truncated incorrect log_slow_rate_limit value: '0' -select @@global.log_slow_rate_limit; -@@global.log_slow_rate_limit -1 -set session log_slow_rate_limit=cast(-1 as unsigned int); -Warnings: -Note 1105 Cast to unsigned converted negative integer to it's positive complement -Warning 1292 Truncated incorrect log_slow_rate_limit value: '18446744073709551615' -select @@session.log_slow_rate_limit; -@@session.log_slow_rate_limit -4294967295 -SET @@global.log_slow_rate_limit = @start_global_value; diff --git a/mysql-test/suite/sys_vars/r/log_slow_verbosity_basic.result b/mysql-test/suite/sys_vars/r/log_slow_verbosity_basic.result deleted file mode 100644 index 8b5b06ee4b7b5..0000000000000 --- a/mysql-test/suite/sys_vars/r/log_slow_verbosity_basic.result +++ /dev/null @@ -1,86 +0,0 @@ -SET @start_global_value = @@global.log_slow_verbosity; -select @@global.log_slow_verbosity = @@session.log_slow_verbosity; -@@global.log_slow_verbosity = @@session.log_slow_verbosity -1 -SET @@global.log_slow_verbosity="",@@session.log_slow_verbosity=""; -show global variables like 'log_slow_verbosity'; -Variable_name Value -log_slow_verbosity -show session variables like 'log_slow_verbosity'; -Variable_name Value -log_slow_verbosity -select * from information_schema.global_variables where variable_name='log_slow_verbosity'; -VARIABLE_NAME VARIABLE_VALUE -LOG_SLOW_VERBOSITY -select * from information_schema.session_variables where variable_name='log_slow_verbosity'; -VARIABLE_NAME VARIABLE_VALUE -LOG_SLOW_VERBOSITY -set global log_slow_verbosity=1; -select @@global.log_slow_verbosity; -@@global.log_slow_verbosity -innodb -set session log_slow_verbosity=1; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -innodb -set session log_slow_verbosity=1; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -innodb -set session log_slow_verbosity=2; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -query_plan -set session log_slow_verbosity=3; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -innodb,query_plan -set session log_slow_verbosity=4; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -explain -set session log_slow_verbosity=5; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -innodb,explain -set session log_slow_verbosity=6; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -query_plan,explain -set session log_slow_verbosity=7; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -innodb,query_plan,explain -set session log_slow_verbosity='innodb'; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -innodb -set session log_slow_verbosity='query_plan'; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -query_plan -set session log_slow_verbosity='innodb,query_plan'; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -innodb,query_plan -set session log_slow_verbosity='explain'; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -explain -set session log_slow_verbosity='innodb,query_plan,explain'; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity -innodb,query_plan,explain -set session log_slow_verbosity=''; -select @@session.log_slow_verbosity; -@@session.log_slow_verbosity - -set session log_slow_verbosity=1.1; -ERROR 42000: Incorrect argument type to variable 'log_slow_verbosity' -set session log_slow_verbosity=1e1; -ERROR 42000: Incorrect argument type to variable 'log_slow_verbosity' -set session log_slow_verbosity="foo"; -ERROR 42000: Variable 'log_slow_verbosity' can't be set to the value of 'foo' -set session log_slow_verbosity=8; -ERROR 42000: Variable 'log_slow_verbosity' can't be set to the value of '8' -SET @@global.log_slow_verbosity = @start_global_value; diff --git a/mysql-test/suite/sys_vars/r/max_insert_delayed_threads_basic.result b/mysql-test/suite/sys_vars/r/max_insert_delayed_threads_basic.result deleted file mode 100644 index aa79a5a7b9da7..0000000000000 --- a/mysql-test/suite/sys_vars/r/max_insert_delayed_threads_basic.result +++ /dev/null @@ -1,189 +0,0 @@ -SET @start_global_value = @@global.max_insert_delayed_threads; -SELECT @start_global_value; -@start_global_value -20 -SET @start_session_value = @@session.max_insert_delayed_threads; -SELECT @start_session_value; -@start_session_value -20 -'#--------------------FN_DYNVARS_075_01-------------------------#' -SET @@global.max_insert_delayed_threads = 1000; -SET @@global.max_insert_delayed_threads = DEFAULT; -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -20 -SET @@session.max_insert_delayed_threads = 1000; -ERROR 42000: Variable 'max_insert_delayed_threads' can't be set to the value of '1000' -SET @@session.max_insert_delayed_threads = DEFAULT; -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -20 -'#--------------------FN_DYNVARS_075_02-------------------------#' -SET @@global.max_insert_delayed_threads = DEFAULT; -SELECT @@global.max_insert_delayed_threads = 20; -@@global.max_insert_delayed_threads = 20 -1 -SET @@session.max_insert_delayed_threads = DEFAULT; -SELECT @@session.max_insert_delayed_threads = 20; -@@session.max_insert_delayed_threads = 20 -1 -'#--------------------FN_DYNVARS_075_03-------------------------#' -SET @@global.max_insert_delayed_threads = 1; -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -1 -SET @@global.max_insert_delayed_threads = 1025; -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -1025 -SET @@global.max_insert_delayed_threads = 0; -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -0 -SET @@global.max_insert_delayed_threads = 16384; -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -16384 -SET @@global.max_insert_delayed_threads = 16383; -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -16383 -'#--------------------FN_DYNVARS_075_04-------------------------#' -SET @@session.max_insert_delayed_threads = 1; -ERROR 42000: Variable 'max_insert_delayed_threads' can't be set to the value of '1' -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -20 -SET @@session.max_insert_delayed_threads = 1025; -ERROR 42000: Variable 'max_insert_delayed_threads' can't be set to the value of '1025' -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -20 -SET @@session.max_insert_delayed_threads = 0; -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -0 -SET @@session.max_insert_delayed_threads = 16384; -ERROR 42000: Variable 'max_insert_delayed_threads' can't be set to the value of '16384' -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -0 -SET @@session.max_insert_delayed_threads = 16383; -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -16383 -'#------------------FN_DYNVARS_075_05-----------------------#' -SET @@global.max_insert_delayed_threads = -1024; -Warnings: -Warning 1292 Truncated incorrect max_insert_delayed_threads value: '-1024' -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -0 -SET @@global.max_insert_delayed_threads = -1; -Warnings: -Warning 1292 Truncated incorrect max_insert_delayed_threads value: '-1' -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -0 -SET @@global.max_insert_delayed_threads = 16385; -Warnings: -Warning 1292 Truncated incorrect max_insert_delayed_threads value: '16385' -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -16384 -SET @@global.max_insert_delayed_threads = 65530.34; -ERROR 42000: Incorrect argument type to variable 'max_insert_delayed_threads' -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -16384 -SET @@global.max_insert_delayed_threads = test; -ERROR 42000: Incorrect argument type to variable 'max_insert_delayed_threads' -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -16384 -SET @@session.max_insert_delayed_threads = 16385; -Warnings: -Warning 1292 Truncated incorrect max_insert_delayed_threads value: '16385' -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -16384 -SET @@session.max_insert_delayed_threads = -1; -Warnings: -Warning 1292 Truncated incorrect max_insert_delayed_threads value: '-1' -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -0 -SET @@session.max_insert_delayed_threads = -2; -Warnings: -Warning 1292 Truncated incorrect max_insert_delayed_threads value: '-2' -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -0 -SET @@session.max_insert_delayed_threads = 65530.34; -ERROR 42000: Incorrect argument type to variable 'max_insert_delayed_threads' -SET @@session.max_insert_delayed_threads = 10737418241; -Warnings: -Warning 1292 Truncated incorrect max_insert_delayed_threads value: '10737418241' -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -16384 -SET @@session.max_insert_delayed_threads = test; -ERROR 42000: Incorrect argument type to variable 'max_insert_delayed_threads' -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -16384 -'#------------------FN_DYNVARS_075_06-----------------------#' -SELECT @@global.max_insert_delayed_threads = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='max_insert_delayed_threads'; -@@global.max_insert_delayed_threads = VARIABLE_VALUE -1 -'#------------------FN_DYNVARS_075_07-----------------------#' -SELECT @@session.max_insert_delayed_threads = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='max_insert_delayed_threads'; -@@session.max_insert_delayed_threads = VARIABLE_VALUE -1 -'#------------------FN_DYNVARS_075_08-----------------------#' -SET @@global.max_insert_delayed_threads = TRUE; -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -1 -SET @@global.max_insert_delayed_threads = FALSE; -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -0 -'#---------------------FN_DYNVARS_001_09----------------------#' -SET @@global.max_insert_delayed_threads = 2048; -SELECT @@max_insert_delayed_threads = @@global.max_insert_delayed_threads; -@@max_insert_delayed_threads = @@global.max_insert_delayed_threads -0 -'#---------------------FN_DYNVARS_001_10----------------------#' -SET @@max_insert_delayed_threads = 100000; -ERROR 42000: Variable 'max_insert_delayed_threads' can't be set to the value of '100000' -SELECT @@max_insert_delayed_threads = @@local.max_insert_delayed_threads; -@@max_insert_delayed_threads = @@local.max_insert_delayed_threads -1 -SELECT @@local.max_insert_delayed_threads = @@session.max_insert_delayed_threads; -@@local.max_insert_delayed_threads = @@session.max_insert_delayed_threads -1 -'#---------------------FN_DYNVARS_001_11----------------------#' -SET max_insert_delayed_threads = 1024; -ERROR 42000: Variable 'max_insert_delayed_threads' can't be set to the value of '1024' -SELECT @@max_insert_delayed_threads; -@@max_insert_delayed_threads -16384 -SELECT local.max_insert_delayed_threads; -ERROR 42S02: Unknown table 'local' in field list -SELECT session.max_insert_delayed_threads; -ERROR 42S02: Unknown table 'session' in field list -SELECT max_insert_delayed_threads = @@session.max_insert_delayed_threads; -ERROR 42S22: Unknown column 'max_insert_delayed_threads' in 'field list' -SET @@global.max_insert_delayed_threads = @start_global_value; -SELECT @@global.max_insert_delayed_threads; -@@global.max_insert_delayed_threads -20 -SET @@session.max_insert_delayed_threads = @start_session_value; -SELECT @@session.max_insert_delayed_threads; -@@session.max_insert_delayed_threads -20 diff --git a/mysql-test/suite/sys_vars/r/read_only_func.result b/mysql-test/suite/sys_vars/r/read_only_func.result index e93f280dbb578..f9ac41293ab68 100644 --- a/mysql-test/suite/sys_vars/r/read_only_func.result +++ b/mysql-test/suite/sys_vars/r/read_only_func.result @@ -18,9 +18,10 @@ id name '#--------------------FN_DYNVARS_140_02-------------------------#' ** Creating new user with out super privilege** CREATE user sameea; +grant all on test.* to sameea; CONNECT connn,localhost,sameea,,; SET Global read_ONLY=ON; -ERROR 42000: Access denied; you need (at least one of) the SUPER, READ_ONLY ADMIN privilege(s) for this operation +ERROR 42000: Access denied; you need (at least one of) the READ_ONLY ADMIN privilege(s) for this operation CREATE TABLE t2 ( id INT NOT NULL auto_increment, diff --git a/mysql-test/suite/sys_vars/r/read_only_grant.result b/mysql-test/suite/sys_vars/r/read_only_grant.result index 8884546e92d64..455390eb4fce9 100644 --- a/mysql-test/suite/sys_vars/r/read_only_grant.result +++ b/mysql-test/suite/sys_vars/r/read_only_grant.result @@ -1,14 +1,14 @@ # # MDEV-21960 Bind READ_ONLY ADMIN to @@read_only # -# Test that "SET read_only" is not allowed without READ_ONLY ADMIN or SUPER +# Test that "SET read_only" is not allowed without READ_ONLY ADMIN CREATE USER user1@localhost; GRANT ALL PRIVILEGES ON *.* TO user1@localhost; -REVOKE READ_ONLY ADMIN, SUPER ON *.* FROM user1@localhost; +REVOKE READ_ONLY ADMIN ON *.* FROM user1@localhost; connect user1,localhost,user1,,; connection user1; SET GLOBAL read_only=0; -ERROR 42000: Access denied; you need (at least one of) the SUPER, READ_ONLY ADMIN privilege(s) for this operation +ERROR 42000: Access denied; you need (at least one of) the READ_ONLY ADMIN privilege(s) for this operation SET read_only=0; ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL SET SESSION read_only=0; @@ -29,16 +29,12 @@ ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SE disconnect user1; connection default; DROP USER user1@localhost; -# Test that "SET read_only" is allowed with SUPER -CREATE USER user1@localhost; -GRANT SUPER ON *.* TO user1@localhost; -connect user1,localhost,user1,,; -connection user1; -SET GLOBAL read_only=0; -SET read_only=0; -ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL -SET SESSION read_only=0; -ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL -disconnect user1; -connection default; -DROP USER user1@localhost; +# +# MDEV-29632 SUPER users created before 10.11 should retain READ_ONLY ADMIN privilege upon upgrade +# +insert mysql.global_priv values ('bar', 'foo', '{"access":32768,"version_id":101000,"plugin":"mysql_native_password","authentication_string":""}'); +flush privileges; +show grants for foo@bar; +Grants for foo@bar +GRANT SUPER, READ_ONLY ADMIN ON *.* TO `foo`@`bar` +drop user foo@bar; diff --git a/mysql-test/suite/sys_vars/r/replicate_rewrite_db.result b/mysql-test/suite/sys_vars/r/replicate_rewrite_db.result new file mode 100644 index 0000000000000..2dfe3a65133a5 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/replicate_rewrite_db.result @@ -0,0 +1,99 @@ +# +# MDEV-15530: Variable replicate_rewrite_db +# cannot be found in "show global variables" +# +SET @save_replicate_rewrite_db = @@GLOBAL.replicate_rewrite_db; +SELECT @save_replicate_rewrite_db; +@save_replicate_rewrite_db +test->rewrite,mysqltest1->test,a->b +# Test session/Scope (it is global variable) +select @@global.replicate_rewrite_db; +@@global.replicate_rewrite_db +test->rewrite,mysqltest1->test,a->b +SELECT @@SESSION.replicate_rewrite_db; +ERROR HY000: Variable 'replicate_rewrite_db' is a GLOBAL variable +SET @@SESSION.replicate_rewrite_db = ""; +ERROR HY000: Variable 'replicate_rewrite_db' is a GLOBAL variable and should be set with SET GLOBAL +show global variables like 'replicate_rewrite_db'; +Variable_name Value +replicate_rewrite_db test->rewrite,mysqltest1->test,a->b +show session variables like 'replicate_rewrite_db'; +Variable_name Value +replicate_rewrite_db test->rewrite,mysqltest1->test,a->b +select * from information_schema.global_variables where variable_name='replicate_rewrite_db'; +VARIABLE_NAME VARIABLE_VALUE +REPLICATE_REWRITE_DB test->rewrite,mysqltest1->test,a->b +select * from information_schema.session_variables where variable_name='replicate_rewrite_db'; +VARIABLE_NAME VARIABLE_VALUE +REPLICATE_REWRITE_DB test->rewrite,mysqltest1->test,a->b +# Incorrect type +SET @@GLOBAL.replicate_rewrite_db=1; +ERROR 42000: Incorrect argument type to variable 'replicate_rewrite_db' +SET @@GLOBAL.replicate_rewrite_db="->"; +ERROR HY000: Incorrect arguments to SET +SET @@GLOBAL.replicate_rewrite_db=" "; +ERROR HY000: Incorrect arguments to SET +SET @@GLOBAL.replicate_rewrite_db="a->"; +ERROR HY000: Incorrect arguments to SET +SET @@GLOBAL.replicate_rewrite_db="->b"; +ERROR HY000: Incorrect arguments to SET +# Check arguments +set session replicate_rewrite_db=1; +ERROR HY000: Variable 'replicate_rewrite_db' is a GLOBAL variable and should be set with SET GLOBAL +set global replicate_rewrite_db=1; +ERROR 42000: Incorrect argument type to variable 'replicate_rewrite_db' +SET @@SESSION.replicate_do_db = ""; +ERROR HY000: Variable 'replicate_do_db' is a GLOBAL variable and should be set with SET GLOBAL +SET @@GLOBAL.replicate_rewrite_db=""; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db + +SET @@GLOBAL.replicate_rewrite_db=null; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db + +SET @@GLOBAL.replicate_rewrite_db=DEFAULT; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db + +SET @@GLOBAL.replicate_rewrite_db="db1->db3"; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +db1->db3 +SET @@GLOBAL.replicate_rewrite_db="db2 ->db4"; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +db2->db4 +SET @@GLOBAL.replicate_rewrite_db=" db5 ->db7 "; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +db5->db7 +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_rewrite_db'; +VARIABLE_NAME VARIABLE_VALUE +REPLICATE_REWRITE_DB db5->db7 +select * from information_schema.session_variables where variable_name='replicate_rewrite_db'; +VARIABLE_NAME VARIABLE_VALUE +REPLICATE_REWRITE_DB db5->db7 +show global variables like 'replicate_rewrite_db'; +Variable_name Value +replicate_rewrite_db db5->db7 +SET @@GLOBAL.replicate_rewrite_db="db1->db2, db3->db4"; +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +db1->db2,db3->db4 +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_rewrite_db'; +VARIABLE_NAME VARIABLE_VALUE +REPLICATE_REWRITE_DB db1->db2,db3->db4 +# Check restart with appending the value +# restart: --replicate_rewrite_db=X->Y +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +test->rewrite,mysqltest1->test,a->b,X->Y +# Check restart with wrong value on CLI +[ERROR] Bad syntax in replicate-rewrite-db.Expected syntax is FROM->TO. +# restart: +SELECT @@GLOBAL.replicate_rewrite_db; +@@GLOBAL.replicate_rewrite_db +test->rewrite,mysqltest1->test,a->b +# Cleanup. +SET @@GLOBAL.replicate_rewrite_db = @save_replicate_rewrite_db; diff --git a/mysql-test/suite/sys_vars/r/secure_timestamp_no.result b/mysql-test/suite/sys_vars/r/secure_timestamp_no.result index fcf04f944762c..14d16d9fc997a 100644 --- a/mysql-test/suite/sys_vars/r/secure_timestamp_no.result +++ b/mysql-test/suite/sys_vars/r/secure_timestamp_no.result @@ -13,7 +13,7 @@ set timestamp=default; ### SUPER create user foo@127.0.0.1; grant super on *.* TO `foo`@`127.0.0.1`; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'SUPER'; SUPER @@ -25,7 +25,7 @@ set timestamp=default; ### BINLOG REPLAY create user foo@127.0.0.1; grant binlog replay on *.* TO `foo`@`127.0.0.1`; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'BINLOG REPLAY'; BINLOG REPLAY @@ -36,7 +36,7 @@ drop user foo@127.0.0.1; set timestamp=default; ### non-privileged user create user foo@127.0.0.1; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'non-privileged'; non-privileged diff --git a/mysql-test/suite/sys_vars/r/secure_timestamp_rpl.result b/mysql-test/suite/sys_vars/r/secure_timestamp_rpl.result index d4b25257da32c..43c7a402cd550 100644 --- a/mysql-test/suite/sys_vars/r/secure_timestamp_rpl.result +++ b/mysql-test/suite/sys_vars/r/secure_timestamp_rpl.result @@ -13,7 +13,7 @@ set timestamp=default; ### SUPER create user foo@127.0.0.1; grant super on *.* TO `foo`@`127.0.0.1`; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; ERROR 42000: Access denied; you need (at least one of) the BINLOG REPLAY privilege(s) for this operation select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'SUPER'; @@ -26,7 +26,7 @@ set timestamp=default; ### BINLOG REPLAY create user foo@127.0.0.1; grant binlog replay on *.* TO `foo`@`127.0.0.1`; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'BINLOG REPLAY'; BINLOG REPLAY @@ -37,7 +37,7 @@ drop user foo@127.0.0.1; set timestamp=default; ### non-privileged user create user foo@127.0.0.1; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; ERROR 42000: Access denied; you need (at least one of) the BINLOG REPLAY privilege(s) for this operation select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'non-privileged'; diff --git a/mysql-test/suite/sys_vars/r/secure_timestamp_super.result b/mysql-test/suite/sys_vars/r/secure_timestamp_super.result index e005fdabf8ac6..b1aec21fea72d 100644 --- a/mysql-test/suite/sys_vars/r/secure_timestamp_super.result +++ b/mysql-test/suite/sys_vars/r/secure_timestamp_super.result @@ -13,7 +13,7 @@ set timestamp=default; ### SUPER create user foo@127.0.0.1; grant super on *.* TO `foo`@`127.0.0.1`; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'SUPER'; SUPER @@ -25,7 +25,7 @@ set timestamp=default; ### BINLOG REPLAY create user foo@127.0.0.1; grant binlog replay on *.* TO `foo`@`127.0.0.1`; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'BINLOG REPLAY'; BINLOG REPLAY @@ -36,7 +36,7 @@ drop user foo@127.0.0.1; set timestamp=default; ### non-privileged user create user foo@127.0.0.1; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; ERROR 42000: Access denied; you need (at least one of) the SUPER, BINLOG REPLAY privilege(s) for this operation select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'non-privileged'; diff --git a/mysql-test/suite/sys_vars/r/secure_timestamp_yes.result b/mysql-test/suite/sys_vars/r/secure_timestamp_yes.result index 44b310809f6d7..c6c1dea66578e 100644 --- a/mysql-test/suite/sys_vars/r/secure_timestamp_yes.result +++ b/mysql-test/suite/sys_vars/r/secure_timestamp_yes.result @@ -14,7 +14,7 @@ set timestamp=default; ### SUPER create user foo@127.0.0.1; grant super on *.* TO `foo`@`127.0.0.1`; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'SUPER'; @@ -27,7 +27,7 @@ set timestamp=default; ### BINLOG REPLAY create user foo@127.0.0.1; grant binlog replay on *.* TO `foo`@`127.0.0.1`; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'BINLOG REPLAY'; @@ -39,7 +39,7 @@ drop user foo@127.0.0.1; set timestamp=default; ### non-privileged user create user foo@127.0.0.1; -connect con2,127.0.0.1,foo,,test,$SLAVE_MYPORT; +connect con2,127.0.0.1,foo,,"*NO-ONE*",$SLAVE_MYPORT; set timestamp=1234567890.101112; ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement select if(now(6) > 20100101, 'READONLY', 'EDITABLE') as 'non-privileged'; diff --git a/mysql-test/suite/sys_vars/r/slow_launch_time_basic.result b/mysql-test/suite/sys_vars/r/slow_launch_time_basic.result deleted file mode 100644 index 3acd29b0c6210..0000000000000 --- a/mysql-test/suite/sys_vars/r/slow_launch_time_basic.result +++ /dev/null @@ -1,129 +0,0 @@ -SET @start_value = @@global.slow_launch_time; -SELECT @start_value; -@start_value -2 -'#--------------------FN_DYNVARS_150_01------------------------#' -SET @@global.slow_launch_time = 99; -SET @@global.slow_launch_time = DEFAULT; -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -2 -'#---------------------FN_DYNVARS_150_02-------------------------#' -SET @@global.slow_launch_time = @start_value; -SELECT @@global.slow_launch_time = 2; -@@global.slow_launch_time = 2 -1 -'#--------------------FN_DYNVARS_150_03------------------------#' -SET @@global.slow_launch_time = 0; -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -0 -SET @@global.slow_launch_time = 1; -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -1 -SET @@global.slow_launch_time = 31536000; -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -31536000 -SET @@global.slow_launch_time = 31535999; -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -31535999 -SET @@global.slow_launch_time = 65536; -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -65536 -'#--------------------FN_DYNVARS_150_04-------------------------#' -SET @@global.slow_launch_time = -1; -Warnings: -Warning 1292 Truncated incorrect slow_launch_time value: '-1' -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -0 -SET @@global.slow_launch_time = 31536001; -Warnings: -Warning 1292 Truncated incorrect slow_launch_time value: '31536001' -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -31536000 -SET @@global.slow_launch_time = 10240022115; -Warnings: -Warning 1292 Truncated incorrect slow_launch_time value: '10240022115' -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -31536000 -SET @@global.slow_launch_time = 10000.01; -ERROR 42000: Incorrect argument type to variable 'slow_launch_time' -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -31536000 -SET @@global.slow_launch_time = -1024; -Warnings: -Warning 1292 Truncated incorrect slow_launch_time value: '-1024' -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -0 -SET @@global.slow_launch_time = 42949672950; -Warnings: -Warning 1292 Truncated incorrect slow_launch_time value: '42949672950' -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -31536000 -SET @@global.slow_launch_time = ON; -ERROR 42000: Incorrect argument type to variable 'slow_launch_time' -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -31536000 -SET @@global.slow_launch_time = 'test'; -ERROR 42000: Incorrect argument type to variable 'slow_launch_time' -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -31536000 -'#-------------------FN_DYNVARS_150_05----------------------------#' -SET @@session.slow_launch_time = 0; -ERROR HY000: Variable 'slow_launch_time' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@slow_launch_time; -@@slow_launch_time -31536000 -'#----------------------FN_DYNVARS_150_06------------------------#' -SELECT @@global.slow_launch_time = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='slow_launch_time'; -@@global.slow_launch_time = VARIABLE_VALUE -1 -SELECT @@slow_launch_time = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='slow_launch_time'; -@@slow_launch_time = VARIABLE_VALUE -1 -'#---------------------FN_DYNVARS_150_07----------------------#' -SET @@global.slow_launch_time = TRUE; -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -1 -SET @@global.slow_launch_time = FALSE; -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -0 -'#---------------------FN_DYNVARS_150_08----------------------#' -SET @@global.slow_launch_time = 1; -SELECT @@slow_launch_time = @@global.slow_launch_time; -@@slow_launch_time = @@global.slow_launch_time -1 -'#---------------------FN_DYNVARS_150_09----------------------#' -SET slow_launch_time = 1; -ERROR HY000: Variable 'slow_launch_time' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@slow_launch_time; -@@slow_launch_time -1 -SELECT local.slow_launch_time; -ERROR 42S02: Unknown table 'local' in field list -SELECT global.slow_launch_time; -ERROR 42S02: Unknown table 'global' in field list -SELECT slow_launch_time = @@session.slow_launch_time; -ERROR 42S22: Unknown column 'slow_launch_time' in 'field list' -SET @@global.slow_launch_time = @start_value; -SELECT @@global.slow_launch_time; -@@global.slow_launch_time -2 diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_basic.result b/mysql-test/suite/sys_vars/r/slow_query_log_basic.result deleted file mode 100644 index 17dfdeea3f3f9..0000000000000 --- a/mysql-test/suite/sys_vars/r/slow_query_log_basic.result +++ /dev/null @@ -1,96 +0,0 @@ -SET @start_value = @@global.slow_query_log; -SELECT @start_value; -@start_value -1 -'#---------------------FN_DYNVARS_004_01-------------------------#' -SET @@global.slow_query_log = DEFAULT; -SELECT @@global.slow_query_log = 0; -@@global.slow_query_log = 0 -1 -'#--------------------FN_DYNVARS_004_02------------------------#' -SET @@global.slow_query_log = ON; -SELECT @@global.slow_query_log; -@@global.slow_query_log -1 -SET @@global.slow_query_log = OFF; -SELECT @@global.slow_query_log; -@@global.slow_query_log -0 -'#--------------------FN_DYNVARS_004_03-------------------------#' -SET @@global.slow_query_log = 2; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of '2' -SET @@global.slow_query_log = -1; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of '-1' -SET @@global.slow_query_log = TRUEF; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of 'TRUEF' -SET @@global.slow_query_log = TRUE_F; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of 'TRUE_F' -SET @@global.slow_query_log = FALSE0; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of 'FALSE0' -SET @@global.slow_query_log = OON; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of 'OON' -SET @@global.slow_query_log = ONN; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of 'ONN' -SET @@global.slow_query_log = OOFF; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of 'OOFF' -SET @@global.slow_query_log = 0FF; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of '0FF' -SET @@global.slow_query_log = ' '; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of ' ' -SET @@global.slow_query_log = " "; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of ' ' -SET @@global.slow_query_log = ''; -ERROR 42000: Variable 'slow_query_log' can't be set to the value of '' -'#-------------------FN_DYNVARS_004_04----------------------------#' -SET @@global.slow_query_log = ON; -SET @@session.slow_query_log = ON; -SELECT @@session.slow_query_log; -@@session.slow_query_log -1 -SET @@session.slow_query_log = OFF; -SELECT @@session.slow_query_log; -@@session.slow_query_log -0 -SET @@global.slow_query_log = OFF; -SET @@session.slow_query_log = ON; -'#----------------------FN_DYNVARS_004_05------------------------#' -SELECT IF(@@global.slow_query_log, "ON", "OFF") = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='slow_query_log'; -IF(@@global.slow_query_log, "ON", "OFF") = VARIABLE_VALUE -1 -'#---------------------FN_DYNVARS_004_06----------------------#' -SET @@global.slow_query_log = 0; -SELECT @@global.slow_query_log; -@@global.slow_query_log -0 -SET @@global.slow_query_log = 1; -SELECT @@global.slow_query_log; -@@global.slow_query_log -1 -'#---------------------FN_DYNVARS_004_07----------------------#' -SET @@global.slow_query_log = TRUE; -SELECT @@global.slow_query_log; -@@global.slow_query_log -1 -SET @@global.slow_query_log = FALSE; -SELECT @@global.slow_query_log; -@@global.slow_query_log -0 -'#---------------------FN_DYNVARS_004_08----------------------#' -SET @@global.slow_query_log = ON; -SET @@local.slow_query_log = OFF; -SELECT @@slow_query_log = @@global.slow_query_log; -@@slow_query_log = @@global.slow_query_log -0 -'#---------------------FN_DYNVARS_004_09----------------------#' -SELECT local.slow_query_log; -ERROR 42S02: Unknown table 'local' in field list -SELECT global.slow_query_log; -ERROR 42S02: Unknown table 'global' in field list -SELECT slow_query_log = @@session.slow_query_log; -ERROR 42S22: Unknown column 'slow_query_log' in 'field list' -SET @@global.slow_query_log = @start_value; -SELECT @@global.slow_query_log; -@@global.slow_query_log -1 diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result deleted file mode 100644 index 47bc780c96ac3..0000000000000 --- a/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result +++ /dev/null @@ -1,28 +0,0 @@ -SET @start_value = @@global.slow_query_log_file; -'#---------------------FN_DYNVARS_004_01-------------------------#' -SET @@global.slow_query_log_file = DEFAULT; -SELECT length(@@global.slow_query_log_file) > 0; -length(@@global.slow_query_log_file) > 0 -1 -'#--------------------FN_DYNVARS_004_02------------------------#' -SET @@global.slow_query_log_file = mytest.log; -ERROR 42000: Incorrect argument type to variable 'slow_query_log_file' -SET @@global.slow_query_log_file = 12; -ERROR 42000: Incorrect argument type to variable 'slow_query_log_file' -SET @@global.slow_query_log_file = 'my.cnf'; -ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'my.cnf' -SET @@global.slow_query_log_file = '/tmp/my.cnf'; -ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/tmp/my.cnf' -SET @@global.general_log_file = '.my.cnf'; -ERROR 42000: Variable 'general_log_file' can't be set to the value of '.my.cnf' -SET @@global.general_log_file = 'my.cnf\0foo'; -ERROR 42000: Variable 'general_log_file' can't be set to the value of 'my.cnf\0000foo' -SET @@global.general_log_file = 'my.ini'; -ERROR 42000: Variable 'general_log_file' can't be set to the value of 'my.ini' -'#----------------------FN_DYNVARS_004_03------------------------#' -SELECT @@global.slow_query_log_file = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='slow_query_log_file'; -@@global.slow_query_log_file = VARIABLE_VALUE -1 -SET @@global.slow_query_log_file= @start_value; diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_file_func.result b/mysql-test/suite/sys_vars/r/slow_query_log_file_func.result index 201b33c8edb5f..88a5713c65946 100644 --- a/mysql-test/suite/sys_vars/r/slow_query_log_file_func.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_file_func.result @@ -1,3 +1,9 @@ '#--------------------FN_DYNVARS_018_01-------------------------#' ## Checking if my_slow_test.log exists in servers datadir ## ## This case should pass because we have set this filename in opt file ## +set @oldval= @@global.slow_query_log_file; +set global log_slow_query_file='$MYSQLTEST_VARDIR/tmp/slow-7567.log'; +select @@global.log_slow_query_file; +@@global.log_slow_query_file +MYSQLTEST_VARDIR/tmp/slow-7567.log +set @@global.log_slow_query_file=@oldval; diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_func.result b/mysql-test/suite/sys_vars/r/slow_query_log_func.result index cccf10a15eb5e..acda9643f32d7 100644 --- a/mysql-test/suite/sys_vars/r/slow_query_log_func.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_func.result @@ -2,8 +2,8 @@ SET @global_slow_query_log = @@global.slow_query_log; SET @global_log_output = @@global.log_output; SET @@session.long_query_time=1; SET @@global.log_output = 'TABLE'; -'----When global.slow_query_log = OFF----' -SET @@global.slow_query_log = OFF; +'----When global.log_slow_query = OFF----' +SET @@global.log_slow_query = OFF; TRUNCATE mysql.slow_log; SELECT sleep(2); sleep(2) @@ -20,8 +20,8 @@ sleep(2) SELECT count(*) > 0 FROM mysql.slow_log; count(*) > 0 1 -'----When local.slow_query_log = OFF-----' -SET @@local.slow_query_log = OFF; +'----When local.log_slow_query = OFF-----' +SET @@local.log_slow_query = OFF; TRUNCATE mysql.slow_log; SELECT sleep(2); sleep(2) diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 428036958138b..79341b8582259 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -223,54 +223,6 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL -VARIABLE_NAME INNODB_CHANGE_BUFFERING -SESSION_VALUE NULL -DEFAULT_VALUE none -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE ENUM -VARIABLE_COMMENT Buffer changes to secondary indexes. -NUMERIC_MIN_VALUE NULL -NUMERIC_MAX_VALUE NULL -NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST none,inserts,deletes,changes,purges,all -READ_ONLY NO -COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME INNODB_CHANGE_BUFFERING_DEBUG -SESSION_VALUE NULL -DEFAULT_VALUE 0 -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE INT UNSIGNED -VARIABLE_COMMENT Debug flags for InnoDB change buffering (0=none, 1=try to buffer) -NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 1 -NUMERIC_BLOCK_SIZE 0 -ENUM_VALUE_LIST NULL -READ_ONLY NO -COMMAND_LINE_ARGUMENT REQUIRED -VARIABLE_NAME INNODB_CHANGE_BUFFER_DUMP -SESSION_VALUE NULL -DEFAULT_VALUE OFF -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Dump the change buffer at startup. -NUMERIC_MIN_VALUE NULL -NUMERIC_MAX_VALUE NULL -NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST OFF,ON -READ_ONLY YES -COMMAND_LINE_ARGUMENT NONE -VARIABLE_NAME INNODB_CHANGE_BUFFER_MAX_SIZE -SESSION_VALUE NULL -DEFAULT_VALUE 25 -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE INT UNSIGNED -VARIABLE_COMMENT Maximum on-disk size of change buffer in terms of percentage of the buffer pool. -NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 50 -NUMERIC_BLOCK_SIZE 0 -ENUM_VALUE_LIST NULL -READ_ONLY NO -COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_CHECKSUM_ALGORITHM SESSION_VALUE NULL DEFAULT_VALUE full_crc32 @@ -355,6 +307,18 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_DATA_FILE_BUFFERING +SESSION_VALUE NULL +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Whether the file system cache for data files is enabled +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_DATA_FILE_PATH SESSION_VALUE NULL DEFAULT_VALUE ibdata1:12M:autoextend @@ -379,6 +343,18 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_DATA_FILE_WRITE_THROUGH +SESSION_VALUE NULL +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Whether each write to data files writes through +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_DATA_HOME_DIR SESSION_VALUE NULL DEFAULT_VALUE @@ -1015,6 +991,18 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_LOG_FILE_WRITE_THROUGH +SESSION_VALUE NULL +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Whether each write to ib_logfile0 is write through +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_LOG_GROUP_HOME_DIR SESSION_VALUE NULL DEFAULT_VALUE @@ -1349,7 +1337,7 @@ NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 64 NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL -READ_ONLY YES +READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_READ_ONLY SESSION_VALUE NULL @@ -1665,7 +1653,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_UNDO_TABLESPACES SESSION_VALUE NULL -DEFAULT_VALUE 0 +DEFAULT_VALUE 3 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Number of undo tablespaces to use. @@ -1697,5 +1685,5 @@ NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 64 NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL -READ_ONLY YES +READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff index e018489446b48..a632e049c5e9d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff @@ -1,4 +1,6 @@ -@@ -44,7 +44,7 @@ +--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result ++++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +@@ -44,7 +44,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_BLOCK_SIZE VARIABLE_SCOPE GLOBAL @@ -7,7 +9,7 @@ VARIABLE_COMMENT Block size to be used for Aria index pages. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 32768 -@@ -54,7 +54,7 @@ +@@ -54,7 +54,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_CHECKPOINT_INTERVAL VARIABLE_SCOPE GLOBAL @@ -16,7 +18,7 @@ VARIABLE_COMMENT Interval between tries to do an automatic checkpoints. In seconds; 0 means 'no automatic checkpoints' which makes sense only for testing. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -64,7 +64,7 @@ +@@ -64,7 +64,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_CHECKPOINT_LOG_ACTIVITY VARIABLE_SCOPE GLOBAL @@ -25,7 +27,7 @@ VARIABLE_COMMENT Number of bytes that the transaction log has to grow between checkpoints before a new checkpoint is written to the log. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -84,7 +84,7 @@ +@@ -84,7 +84,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ARIA_FORCE_START_AFTER_RECOVERY_FAILURES VARIABLE_SCOPE GLOBAL @@ -34,7 +36,7 @@ VARIABLE_COMMENT Number of consecutive log recovery failures after which logs will be automatically deleted to cure the problem; 0 (the default) disables the feature. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -104,7 +104,7 @@ +@@ -104,7 +104,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_GROUP_COMMIT_INTERVAL VARIABLE_SCOPE GLOBAL @@ -43,7 +45,7 @@ VARIABLE_COMMENT Interval between commits in microseconds (1/1000000 sec). 0 stands for no waiting for other threads to come and do a commit in "hard" mode and no sync()/commit at all in "soft" mode. Option has only an effect if aria_group_commit is used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -114,7 +114,7 @@ +@@ -114,7 +114,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_LOG_FILE_SIZE VARIABLE_SCOPE GLOBAL @@ -52,7 +54,7 @@ VARIABLE_COMMENT Limit for transaction log size NUMERIC_MIN_VALUE 8388608 NUMERIC_MAX_VALUE 4294967295 -@@ -144,10 +144,10 @@ +@@ -144,10 +144,10 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_PAGECACHE_AGE_THRESHOLD VARIABLE_SCOPE GLOBAL @@ -65,7 +67,7 @@ NUMERIC_BLOCK_SIZE 100 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -164,7 +164,7 @@ +@@ -164,7 +164,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_PAGECACHE_DIVISION_LIMIT VARIABLE_SCOPE GLOBAL @@ -74,7 +76,7 @@ VARIABLE_COMMENT The minimum percentage of warm blocks in key cache NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100 -@@ -174,7 +174,7 @@ +@@ -174,7 +174,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_PAGECACHE_FILE_HASH_SIZE VARIABLE_SCOPE GLOBAL @@ -83,7 +85,7 @@ VARIABLE_COMMENT Number of hash buckets for open and changed files. If you have a lot of Aria files open you should increase this for faster flush of changes. A good value is probably 1/10 of number of possible open Aria files. NUMERIC_MIN_VALUE 128 NUMERIC_MAX_VALUE 16384 -@@ -204,7 +204,7 @@ +@@ -204,7 +204,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ARIA_REPAIR_THREADS VARIABLE_SCOPE SESSION @@ -92,7 +94,7 @@ VARIABLE_COMMENT Number of threads to use when repairing Aria tables. The value of 1 disables parallel repair. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 128 -@@ -217,7 +217,7 @@ +@@ -217,7 +217,7 @@ 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 4096 @@ -101,7 +103,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -274,7 +274,7 @@ +@@ -274,7 +274,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME AUTO_INCREMENT_INCREMENT VARIABLE_SCOPE SESSION @@ -110,7 +112,7 @@ VARIABLE_COMMENT Auto-increment columns are incremented by this NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 65535 -@@ -284,7 +284,7 @@ +@@ -284,7 +284,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME AUTO_INCREMENT_OFFSET VARIABLE_SCOPE SESSION @@ -119,7 +121,7 @@ VARIABLE_COMMENT Offset added to Auto-increment columns. Used when auto-increment-increment != 1 NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 65535 -@@ -294,7 +294,7 @@ +@@ -294,7 +294,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME BACK_LOG VARIABLE_SCOPE GLOBAL @@ -128,7 +130,7 @@ VARIABLE_COMMENT The number of outstanding connection requests MariaDB can have. This comes into play when the main MariaDB thread gets very many connection requests in a very short time NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65535 -@@ -347,7 +347,7 @@ +@@ -347,7 +347,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the transactional cache for updates to transactional engines for the binary log. If you often use transactions containing many statements, you can increase this to get more performance NUMERIC_MIN_VALUE 4096 @@ -137,7 +139,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -364,20 +364,20 @@ +@@ -364,20 +364,20 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME BINLOG_COMMIT_WAIT_COUNT VARIABLE_SCOPE GLOBAL @@ -162,7 +164,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -394,7 +394,7 @@ +@@ -394,7 +394,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME BINLOG_EXPIRE_LOGS_SECONDS VARIABLE_SCOPE GLOBAL @@ -171,7 +173,7 @@ VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are linked, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 8553600 -@@ -407,7 +407,7 @@ +@@ -407,7 +407,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of file cache for the binary log NUMERIC_MIN_VALUE 8192 @@ -180,7 +182,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -457,7 +457,7 @@ +@@ -457,7 +457,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the statement cache for updates to non-transactional engines for the binary log. If you often use statements updating a great number of rows, you can increase this to get more performance. NUMERIC_MIN_VALUE 4096 @@ -189,7 +191,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -467,7 +467,7 @@ +@@ -467,7 +467,7 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread! NUMERIC_MIN_VALUE 0 @@ -198,7 +200,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -654,7 +654,7 @@ +@@ -654,7 +654,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME CONNECT_TIMEOUT VARIABLE_SCOPE GLOBAL @@ -207,7 +209,7 @@ VARIABLE_COMMENT The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake' NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 31536000 -@@ -704,7 +704,7 @@ +@@ -704,7 +704,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DEADLOCK_SEARCH_DEPTH_LONG VARIABLE_SCOPE SESSION @@ -216,7 +218,7 @@ VARIABLE_COMMENT Long search depth for the two-step deadlock detection NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 33 -@@ -714,7 +714,7 @@ +@@ -714,7 +714,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DEADLOCK_SEARCH_DEPTH_SHORT VARIABLE_SCOPE SESSION @@ -225,7 +227,7 @@ VARIABLE_COMMENT Short search depth for the two-step deadlock detection NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 32 -@@ -724,7 +724,7 @@ +@@ -724,7 +724,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DEADLOCK_TIMEOUT_LONG VARIABLE_SCOPE SESSION @@ -234,7 +236,7 @@ VARIABLE_COMMENT Long timeout for the two-step deadlock detection (in microseconds) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -734,7 +734,7 @@ +@@ -734,7 +734,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DEADLOCK_TIMEOUT_SHORT VARIABLE_SCOPE SESSION @@ -243,7 +245,7 @@ VARIABLE_COMMENT Short timeout for the two-step deadlock detection (in microseconds) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -784,7 +784,7 @@ +@@ -784,7 +784,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME DEFAULT_WEEK_FORMAT VARIABLE_SCOPE SESSION @@ -252,7 +254,7 @@ VARIABLE_COMMENT The default week format used by WEEK() functions NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 7 -@@ -794,7 +794,7 @@ +@@ -794,7 +794,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DELAYED_INSERT_LIMIT VARIABLE_SCOPE GLOBAL @@ -261,7 +263,7 @@ VARIABLE_COMMENT After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -804,7 +804,7 @@ +@@ -804,7 +804,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DELAYED_INSERT_TIMEOUT VARIABLE_SCOPE GLOBAL @@ -270,7 +272,7 @@ VARIABLE_COMMENT How long a INSERT DELAYED thread should wait for INSERT statements before terminating NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -814,7 +814,7 @@ +@@ -814,7 +814,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DELAYED_QUEUE_SIZE VARIABLE_SCOPE GLOBAL @@ -279,7 +281,7 @@ VARIABLE_COMMENT What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -844,7 +844,7 @@ +@@ -844,7 +844,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME DIV_PRECISION_INCREMENT VARIABLE_SCOPE SESSION @@ -288,7 +290,7 @@ VARIABLE_COMMENT Precision of the result of '/' operator will be increased on that value NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 38 -@@ -954,7 +954,7 @@ +@@ -954,7 +954,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME EXTRA_MAX_CONNECTIONS VARIABLE_SCOPE GLOBAL @@ -297,7 +299,7 @@ VARIABLE_COMMENT The number of connections on extra-port NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100000 -@@ -984,7 +984,7 @@ +@@ -984,7 +984,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME FLUSH_TIME VARIABLE_SCOPE GLOBAL @@ -306,7 +308,7 @@ VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -1014,7 +1014,7 @@ +@@ -1014,7 +1014,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME FT_MAX_WORD_LEN VARIABLE_SCOPE GLOBAL @@ -315,7 +317,7 @@ VARIABLE_COMMENT The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -1024,7 +1024,7 @@ +@@ -1024,7 +1024,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME FT_MIN_WORD_LEN VARIABLE_SCOPE GLOBAL @@ -324,7 +326,7 @@ VARIABLE_COMMENT The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 84 -@@ -1034,7 +1034,7 @@ +@@ -1034,7 +1034,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME FT_QUERY_EXPANSION_LIMIT VARIABLE_SCOPE GLOBAL @@ -333,7 +335,7 @@ VARIABLE_COMMENT Number of best matches to use for query expansion NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1000 -@@ -1204,7 +1204,7 @@ +@@ -1204,7 +1204,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME HISTOGRAM_SIZE VARIABLE_SCOPE SESSION @@ -342,7 +344,7 @@ VARIABLE_COMMENT Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -1234,7 +1234,7 @@ +@@ -1234,7 +1234,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME HOST_CACHE_SIZE VARIABLE_SCOPE GLOBAL @@ -351,7 +353,7 @@ VARIABLE_COMMENT How many host names should be cached to avoid resolving. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65536 -@@ -1344,7 +1344,7 @@ +@@ -1344,7 +1344,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME INTERACTIVE_TIMEOUT VARIABLE_SCOPE SESSION @@ -360,7 +362,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on an interactive connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1377,7 +1377,7 @@ +@@ -1377,7 +1377,7 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer that is used for joins NUMERIC_MIN_VALUE 128 @@ -369,7 +371,7 @@ NUMERIC_BLOCK_SIZE 128 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1394,7 +1394,7 @@ +@@ -1394,7 +1394,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME JOIN_CACHE_LEVEL VARIABLE_SCOPE SESSION @@ -378,7 +380,7 @@ VARIABLE_COMMENT Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 8 -@@ -1417,7 +1417,7 @@ +@@ -1417,7 +1417,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford NUMERIC_MIN_VALUE 0 @@ -387,7 +389,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1574,7 +1574,7 @@ +@@ -1574,7 +1574,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME LOCK_WAIT_TIMEOUT VARIABLE_SCOPE SESSION @@ -396,7 +398,16 @@ VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -1694,7 +1694,7 @@ +@@ -1694,7 +1694,7 @@ READ_ONLY NO + COMMAND_LINE_ARGUMENT REQUIRED + VARIABLE_NAME LOG_SLOW_MIN_EXAMINED_ROW_LIMIT + VARIABLE_SCOPE SESSION +-VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that + NUMERIC_MIN_VALUE 0 + NUMERIC_MAX_VALUE 4294967295 +@@ -1734,7 +1734,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME LOG_SLOW_RATE_LIMIT VARIABLE_SCOPE SESSION @@ -405,7 +416,7 @@ VARIABLE_COMMENT Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or the performance impact of slow logging NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1724,7 +1724,7 @@ +@@ -1764,7 +1764,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME LOG_WARNINGS VARIABLE_SCOPE SESSION @@ -414,7 +425,7 @@ VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -1774,7 +1774,7 @@ +@@ -1814,7 +1814,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME MAX_ALLOWED_PACKET VARIABLE_SCOPE SESSION @@ -423,7 +434,7 @@ VARIABLE_COMMENT Max packet length to send to or receive from the server NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -1787,14 +1787,14 @@ +@@ -1827,14 +1827,14 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the total size of the transactional cache NUMERIC_MIN_VALUE 4096 @@ -440,7 +451,7 @@ VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 1073741824 -@@ -1807,14 +1807,14 @@ +@@ -1847,14 +1847,14 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the total size of the statement cache NUMERIC_MIN_VALUE 4096 @@ -457,7 +468,7 @@ VARIABLE_COMMENT The number of simultaneous clients allowed NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 100000 -@@ -1824,7 +1824,7 @@ +@@ -1864,7 +1864,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_CONNECT_ERRORS VARIABLE_SCOPE GLOBAL @@ -466,7 +477,7 @@ VARIABLE_COMMENT If there is more than this number of interrupted connections from a host this host will be blocked from further connections NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1834,7 +1834,7 @@ +@@ -1874,7 +1874,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_DELAYED_THREADS VARIABLE_SCOPE SESSION @@ -475,7 +486,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -1854,7 +1854,7 @@ +@@ -1894,7 +1894,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_ERROR_COUNT VARIABLE_SCOPE SESSION @@ -484,7 +495,7 @@ VARIABLE_COMMENT Max number of errors/warnings to store for a statement NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65535 -@@ -1867,14 +1867,14 @@ +@@ -1907,14 +1907,14 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't allow creation of heap tables bigger than this NUMERIC_MIN_VALUE 16384 @@ -498,10 +509,10 @@ VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used + VARIABLE_COMMENT Alias for max_delayed_threads. Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -1894,7 +1894,7 @@ +@@ -1934,7 +1934,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_LENGTH_FOR_SORT_DATA VARIABLE_SCOPE SESSION @@ -510,7 +521,7 @@ VARIABLE_COMMENT Max number of bytes in sorted records NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -1924,7 +1924,7 @@ +@@ -1964,7 +1964,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_RECURSIVE_ITERATIONS VARIABLE_SCOPE SESSION @@ -519,7 +530,7 @@ VARIABLE_COMMENT Maximum number of iterations when executing recursive queries NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -1937,14 +1937,14 @@ +@@ -1977,14 +1977,14 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The maximum size of the container of a rowid filter NUMERIC_MIN_VALUE 1024 @@ -536,7 +547,7 @@ VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1964,7 +1964,7 @@ +@@ -2004,7 +2004,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_SORT_LENGTH VARIABLE_SCOPE SESSION @@ -545,7 +556,7 @@ VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored) NUMERIC_MIN_VALUE 64 NUMERIC_MAX_VALUE 8388608 -@@ -1974,7 +1974,7 @@ +@@ -2014,7 +2014,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_SP_RECURSION_DEPTH VARIABLE_SCOPE SESSION @@ -554,7 +565,7 @@ VARIABLE_COMMENT Maximum stored procedure recursion depth NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -1994,7 +1994,7 @@ +@@ -2034,7 +2034,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_TMP_TABLES VARIABLE_SCOPE SESSION @@ -563,7 +574,7 @@ VARIABLE_COMMENT Unused, will be removed. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2014,7 +2014,7 @@ +@@ -2054,7 +2054,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_WRITE_LOCK_COUNT VARIABLE_SCOPE GLOBAL @@ -572,7 +583,7 @@ VARIABLE_COMMENT After this many write locks, allow some read locks to run in between NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2024,7 +2024,7 @@ +@@ -2064,7 +2064,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME METADATA_LOCKS_CACHE_SIZE VARIABLE_SCOPE GLOBAL @@ -581,7 +592,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -2034,7 +2034,7 @@ +@@ -2074,7 +2074,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME METADATA_LOCKS_HASH_INSTANCES VARIABLE_SCOPE GLOBAL @@ -590,16 +601,16 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1024 -@@ -2044,7 +2044,7 @@ +@@ -2084,7 +2084,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MIN_EXAMINED_ROW_LIMIT VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that + VARIABLE_COMMENT Alias for log_slow_min_examined_row_limit. Don't write queries to slow log that examine fewer rows than that NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2054,7 +2054,7 @@ +@@ -2094,7 +2094,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MRR_BUFFER_SIZE VARIABLE_SCOPE SESSION @@ -608,7 +619,7 @@ VARIABLE_COMMENT Size of buffer to use when using MRR with range access NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -2064,7 +2064,7 @@ +@@ -2104,7 +2104,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_BLOCK_SIZE VARIABLE_SCOPE GLOBAL @@ -617,7 +628,7 @@ VARIABLE_COMMENT Block size to be used for MyISAM index pages NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 16384 -@@ -2074,7 +2074,7 @@ +@@ -2114,7 +2114,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_DATA_POINTER_SIZE VARIABLE_SCOPE GLOBAL @@ -626,7 +637,7 @@ VARIABLE_COMMENT Default pointer size to be used for MyISAM tables NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 7 -@@ -2097,7 +2097,7 @@ +@@ -2137,7 +2137,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Restricts the total memory used for memory mapping of MySQL tables NUMERIC_MIN_VALUE 7 @@ -635,7 +646,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -2114,10 +2114,10 @@ +@@ -2154,10 +2154,10 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME MYISAM_REPAIR_THREADS VARIABLE_SCOPE SESSION @@ -648,7 +659,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2127,7 +2127,7 @@ +@@ -2167,7 +2167,7 @@ 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 4096 @@ -657,7 +668,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2164,7 +2164,7 @@ +@@ -2204,7 +2204,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME NET_BUFFER_LENGTH VARIABLE_SCOPE SESSION @@ -666,7 +677,7 @@ VARIABLE_COMMENT Buffer length for TCP/IP and socket communication NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1048576 -@@ -2174,7 +2174,7 @@ +@@ -2214,7 +2214,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME NET_READ_TIMEOUT VARIABLE_SCOPE SESSION @@ -675,7 +686,7 @@ VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2184,7 +2184,7 @@ +@@ -2224,7 +2224,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME NET_RETRY_COUNT VARIABLE_SCOPE SESSION @@ -684,7 +695,7 @@ VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2194,7 +2194,7 @@ +@@ -2234,7 +2234,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME NET_WRITE_TIMEOUT VARIABLE_SCOPE SESSION @@ -693,7 +704,7 @@ VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2244,7 +2244,7 @@ +@@ -2284,7 +2284,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME OPEN_FILES_LIMIT VARIABLE_SCOPE GLOBAL @@ -702,7 +713,7 @@ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 or autoset then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2254,7 +2254,7 @@ +@@ -2294,7 +2294,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_EXTRA_PRUNING_DEPTH VARIABLE_SCOPE SESSION @@ -711,7 +722,7 @@ VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try agressively prune away the search space. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 62 -@@ -2264,17 +2264,17 @@ +@@ -2304,17 +2304,17 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_MAX_SEL_ARG_WEIGHT VARIABLE_SCOPE SESSION @@ -732,7 +743,7 @@ VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search: 1 - prune plans based on cost and number of retrieved rows eq_ref: 2 - prune also if we find an eq_ref chain NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -2284,7 +2284,7 @@ +@@ -2324,7 +2324,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_SEARCH_DEPTH VARIABLE_SCOPE SESSION @@ -741,7 +752,7 @@ VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 62 -@@ -2294,7 +2294,7 @@ +@@ -2334,7 +2334,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_SELECTIVITY_SAMPLING_LIMIT VARIABLE_SCOPE SESSION @@ -750,7 +761,7 @@ VARIABLE_COMMENT Controls number of record samples to check condition selectivity NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 4294967295 -@@ -2324,17 +2324,17 @@ +@@ -2364,17 +2364,17 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_TRACE_MAX_MEM_SIZE VARIABLE_SCOPE SESSION @@ -771,7 +782,7 @@ VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5 -@@ -2354,7 +2354,7 @@ +@@ -2394,7 +2394,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME PERFORMANCE_SCHEMA_ACCOUNTS_SIZE VARIABLE_SCOPE GLOBAL @@ -780,7 +791,7 @@ VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2364,7 +2364,7 @@ +@@ -2404,7 +2404,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_DIGESTS_SIZE VARIABLE_SCOPE GLOBAL @@ -789,7 +800,7 @@ VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2374,7 +2374,7 @@ +@@ -2414,7 +2414,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_LONG_SIZE VARIABLE_SCOPE GLOBAL @@ -798,7 +809,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2384,7 +2384,7 @@ +@@ -2424,7 +2424,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_SIZE VARIABLE_SCOPE GLOBAL @@ -807,7 +818,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2394,7 +2394,7 @@ +@@ -2434,7 +2434,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_LONG_SIZE VARIABLE_SCOPE GLOBAL @@ -816,7 +827,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2404,7 +2404,7 @@ +@@ -2444,7 +2444,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_SIZE VARIABLE_SCOPE GLOBAL @@ -825,7 +836,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2414,7 +2414,7 @@ +@@ -2454,7 +2454,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_TRANSACTIONS_HISTORY_LONG_SIZE VARIABLE_SCOPE GLOBAL @@ -834,7 +845,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_TRANSACTIONS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2424,7 +2424,7 @@ +@@ -2464,7 +2464,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_TRANSACTIONS_HISTORY_SIZE VARIABLE_SCOPE GLOBAL @@ -843,7 +854,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_TRANSACTIONS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2434,7 +2434,7 @@ +@@ -2474,7 +2474,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE VARIABLE_SCOPE GLOBAL @@ -852,7 +863,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2444,7 +2444,7 @@ +@@ -2484,7 +2484,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE VARIABLE_SCOPE GLOBAL @@ -861,7 +872,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2454,7 +2454,7 @@ +@@ -2494,7 +2494,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_HOSTS_SIZE VARIABLE_SCOPE GLOBAL @@ -870,7 +881,7 @@ VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2464,7 +2464,7 @@ +@@ -2504,7 +2504,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_CLASSES VARIABLE_SCOPE GLOBAL @@ -879,7 +890,7 @@ VARIABLE_COMMENT Maximum number of condition instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2474,7 +2474,7 @@ +@@ -2514,7 +2514,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_INSTANCES VARIABLE_SCOPE GLOBAL @@ -888,7 +899,7 @@ VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2484,7 +2484,7 @@ +@@ -2524,7 +2524,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_DIGEST_LENGTH VARIABLE_SCOPE GLOBAL @@ -897,7 +908,7 @@ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2494,7 +2494,7 @@ +@@ -2534,7 +2534,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_CLASSES VARIABLE_SCOPE GLOBAL @@ -906,7 +917,7 @@ VARIABLE_COMMENT Maximum number of file instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2504,7 +2504,7 @@ +@@ -2544,7 +2544,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_HANDLES VARIABLE_SCOPE GLOBAL @@ -915,7 +926,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented files. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2514,7 +2514,7 @@ +@@ -2554,7 +2554,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES VARIABLE_SCOPE GLOBAL @@ -924,7 +935,7 @@ VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2524,7 +2524,7 @@ +@@ -2564,7 +2564,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_INDEX_STAT VARIABLE_SCOPE GLOBAL @@ -933,7 +944,7 @@ VARIABLE_COMMENT Maximum number of index statistics for instrumented tables. Use 0 to disable, -1 for automated scaling. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2534,7 +2534,7 @@ +@@ -2574,7 +2574,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MEMORY_CLASSES VARIABLE_SCOPE GLOBAL @@ -942,7 +953,7 @@ VARIABLE_COMMENT Maximum number of memory pool instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1024 -@@ -2544,7 +2544,7 @@ +@@ -2584,7 +2584,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_METADATA_LOCKS VARIABLE_SCOPE GLOBAL @@ -951,7 +962,7 @@ VARIABLE_COMMENT Maximum number of metadata locks. Use 0 to disable, -1 for automated scaling. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2554,7 +2554,7 @@ +@@ -2594,7 +2594,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES VARIABLE_SCOPE GLOBAL @@ -960,7 +971,7 @@ VARIABLE_COMMENT Maximum number of mutex instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2564,7 +2564,7 @@ +@@ -2604,7 +2604,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES VARIABLE_SCOPE GLOBAL @@ -969,7 +980,7 @@ VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2574,7 +2574,7 @@ +@@ -2614,7 +2614,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_PREPARED_STATEMENTS_INSTANCES VARIABLE_SCOPE GLOBAL @@ -978,7 +989,7 @@ VARIABLE_COMMENT Maximum number of instrumented prepared statements. Use 0 to disable, -1 for automated scaling. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2584,7 +2584,7 @@ +@@ -2624,7 +2624,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_PROGRAM_INSTANCES VARIABLE_SCOPE GLOBAL @@ -987,7 +998,7 @@ VARIABLE_COMMENT Maximum number of instrumented programs. Use 0 to disable, -1 for automated scaling. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2594,7 +2594,7 @@ +@@ -2634,7 +2634,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES VARIABLE_SCOPE GLOBAL @@ -996,7 +1007,7 @@ VARIABLE_COMMENT Maximum number of rwlock instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2604,7 +2604,7 @@ +@@ -2644,7 +2644,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES VARIABLE_SCOPE GLOBAL @@ -1005,7 +1016,7 @@ VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2614,7 +2614,7 @@ +@@ -2654,7 +2654,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_CLASSES VARIABLE_SCOPE GLOBAL @@ -1014,7 +1025,7 @@ VARIABLE_COMMENT Maximum number of socket instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2624,7 +2624,7 @@ +@@ -2664,7 +2664,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_INSTANCES VARIABLE_SCOPE GLOBAL @@ -1023,7 +1034,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2634,7 +2634,7 @@ +@@ -2674,7 +2674,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SQL_TEXT_LENGTH VARIABLE_SCOPE GLOBAL @@ -1032,7 +1043,7 @@ VARIABLE_COMMENT Maximum length of displayed sql text. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2644,7 +2644,7 @@ +@@ -2684,7 +2684,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STAGE_CLASSES VARIABLE_SCOPE GLOBAL @@ -1041,7 +1052,7 @@ VARIABLE_COMMENT Maximum number of stage instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2654,7 +2654,7 @@ +@@ -2694,7 +2694,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES VARIABLE_SCOPE GLOBAL @@ -1050,7 +1061,7 @@ VARIABLE_COMMENT Maximum number of statement instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2664,7 +2664,7 @@ +@@ -2704,7 +2704,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_STACK VARIABLE_SCOPE GLOBAL @@ -1059,7 +1070,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_CURRENT. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 256 -@@ -2674,7 +2674,7 @@ +@@ -2714,7 +2714,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES VARIABLE_SCOPE GLOBAL @@ -1068,7 +1079,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2684,7 +2684,7 @@ +@@ -2724,7 +2724,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_INSTANCES VARIABLE_SCOPE GLOBAL @@ -1077,7 +1088,7 @@ VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2694,7 +2694,7 @@ +@@ -2734,7 +2734,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_LOCK_STAT VARIABLE_SCOPE GLOBAL @@ -1086,7 +1097,7 @@ VARIABLE_COMMENT Maximum number of lock statistics for instrumented tables. Use 0 to disable, -1 for automated scaling. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2704,7 +2704,7 @@ +@@ -2744,7 +2744,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_CLASSES VARIABLE_SCOPE GLOBAL @@ -1095,7 +1106,7 @@ VARIABLE_COMMENT Maximum number of thread instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2714,7 +2714,7 @@ +@@ -2754,7 +2754,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_INSTANCES VARIABLE_SCOPE GLOBAL @@ -1104,7 +1115,7 @@ VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2724,7 +2724,7 @@ +@@ -2764,7 +2764,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_SESSION_CONNECT_ATTRS_SIZE VARIABLE_SCOPE GLOBAL @@ -1113,7 +1124,7 @@ VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2734,7 +2734,7 @@ +@@ -2774,7 +2774,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_ACTORS_SIZE VARIABLE_SCOPE GLOBAL @@ -1122,7 +1133,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2744,7 +2744,7 @@ +@@ -2784,7 +2784,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_OBJECTS_SIZE VARIABLE_SCOPE GLOBAL @@ -1131,7 +1142,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2754,7 +2754,7 @@ +@@ -2794,7 +2794,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_USERS_SIZE VARIABLE_SCOPE GLOBAL @@ -1140,7 +1151,7 @@ VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2804,7 +2804,7 @@ +@@ -2844,7 +2844,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PRELOAD_BUFFER_SIZE VARIABLE_SCOPE SESSION @@ -1149,7 +1160,7 @@ VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -2824,7 +2824,7 @@ +@@ -2864,7 +2864,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME PROFILING_HISTORY_SIZE VARIABLE_SCOPE SESSION @@ -1158,7 +1169,7 @@ VARIABLE_COMMENT Number of statements about which profiling information is maintained. If set to 0, no profiles are stored. See SHOW PROFILES. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -2834,7 +2834,7 @@ +@@ -2874,7 +2874,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PROGRESS_REPORT_TIME VARIABLE_SCOPE SESSION @@ -1167,7 +1178,7 @@ VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2894,7 +2894,7 @@ +@@ -2934,7 +2934,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME QUERY_ALLOC_BLOCK_SIZE VARIABLE_SCOPE SESSION @@ -1176,7 +1187,7 @@ VARIABLE_COMMENT Allocation block size for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -2904,7 +2904,7 @@ +@@ -2944,7 +2944,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME QUERY_CACHE_LIMIT VARIABLE_SCOPE GLOBAL @@ -1185,7 +1196,7 @@ VARIABLE_COMMENT Don't cache results that are bigger than this NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2914,7 +2914,7 @@ +@@ -2954,7 +2954,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME QUERY_CACHE_MIN_RES_UNIT VARIABLE_SCOPE GLOBAL @@ -1194,7 +1205,7 @@ VARIABLE_COMMENT The minimum size for blocks allocated by the query cache NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2927,7 +2927,7 @@ +@@ -2967,7 +2967,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The memory allocated to store results from old queries NUMERIC_MIN_VALUE 0 @@ -1203,7 +1214,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2964,7 +2964,7 @@ +@@ -3004,7 +3004,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME QUERY_PREALLOC_SIZE VARIABLE_SCOPE SESSION @@ -1212,7 +1223,7 @@ VARIABLE_COMMENT Persistent buffer for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -2977,7 +2977,7 @@ +@@ -3017,7 +3017,7 @@ VARIABLE_SCOPE SESSION ONLY VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1221,7 +1232,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2987,14 +2987,14 @@ +@@ -3027,14 +3027,14 @@ VARIABLE_SCOPE SESSION ONLY VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1238,7 +1249,7 @@ VARIABLE_COMMENT Allocation block size for storing ranges during optimization NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 4294967295 -@@ -3004,7 +3004,7 @@ +@@ -3044,7 +3044,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME READ_BUFFER_SIZE VARIABLE_SCOPE SESSION @@ -1247,7 +1258,7 @@ VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -3024,7 +3024,7 @@ +@@ -3064,7 +3064,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME READ_RND_BUFFER_SIZE VARIABLE_SCOPE SESSION @@ -1256,7 +1267,7 @@ VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 2147483647 -@@ -3044,10 +3044,10 @@ +@@ -3084,10 +3084,10 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ROWID_MERGE_BUFF_SIZE VARIABLE_SCOPE SESSION @@ -1269,7 +1280,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3084,7 +3084,7 @@ +@@ -3124,7 +3124,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SERVER_ID VARIABLE_SCOPE SESSION @@ -1278,7 +1289,7 @@ VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -3164,7 +3164,7 @@ +@@ -3204,7 +3204,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME SLAVE_MAX_ALLOWED_PACKET VARIABLE_SCOPE GLOBAL @@ -1287,7 +1298,7 @@ VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3174,7 +3174,7 @@ +@@ -3214,7 +3214,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLOW_LAUNCH_TIME VARIABLE_SCOPE GLOBAL @@ -1296,7 +1307,7 @@ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -3217,7 +3217,7 @@ +@@ -3257,7 +3257,7 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size NUMERIC_MIN_VALUE 1024 @@ -1305,7 +1316,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3434,7 +3434,7 @@ +@@ -3474,7 +3474,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME STORED_PROGRAM_CACHE VARIABLE_SCOPE GLOBAL @@ -1314,8 +1325,8 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -3514,7 +3514,7 @@ - COMMAND_LINE_ARGUMENT NULL +@@ -3564,7 +3564,7 @@ READ_ONLY NO + COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME TABLE_DEFINITION_CACHE VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED @@ -1323,7 +1334,7 @@ VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 NUMERIC_MAX_VALUE 2097152 -@@ -3524,7 +3524,7 @@ +@@ -3574,7 +3574,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME TABLE_OPEN_CACHE VARIABLE_SCOPE GLOBAL @@ -1332,7 +1343,7 @@ VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 1048576 -@@ -3584,7 +3584,7 @@ +@@ -3634,7 +3634,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME THREAD_CACHE_SIZE VARIABLE_SCOPE GLOBAL @@ -1341,7 +1352,7 @@ VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -3667,7 +3667,7 @@ +@@ -3717,7 +3717,7 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Max size for data for an internal temporary on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 1024 @@ -1350,7 +1361,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3677,7 +3677,7 @@ +@@ -3727,7 +3727,7 @@ VARIABLE_SCOPE SESSION 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 @@ -1359,7 +1370,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3687,14 +3687,14 @@ +@@ -3737,14 +3737,14 @@ VARIABLE_SCOPE SESSION 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 @@ -1376,7 +1387,7 @@ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -3704,7 +3704,7 @@ +@@ -3754,7 +3754,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME TRANSACTION_PREALLOC_SIZE VARIABLE_SCOPE SESSION @@ -1385,7 +1396,7 @@ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -3844,7 +3844,7 @@ +@@ -3894,7 +3894,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME WAIT_TIMEOUT VARIABLE_SCOPE SESSION @@ -1394,7 +1405,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -3871,7 +3871,7 @@ +@@ -3921,7 +3921,7 @@ order by variable_name; VARIABLE_NAME LOG_TC_SIZE GLOBAL_VALUE_ORIGIN AUTO VARIABLE_SCOPE GLOBAL 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 6d0d147a9db67..f896421559c43 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -325,7 +325,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME BIND_ADDRESS VARIABLE_SCOPE GLOBAL VARIABLE_TYPE VARCHAR -VARIABLE_COMMENT IP address to bind to. +VARIABLE_COMMENT IP address to bind to. Several addresses may be specified, separated by a comma (,). NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -1692,6 +1692,46 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,not_using_index,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME LOG_SLOW_MIN_EXAMINED_ROW_LIMIT +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 4294967295 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME LOG_SLOW_QUERY +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME LOG_SLOW_QUERY_FILE +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME LOG_SLOW_QUERY_TIME +VARIABLE_SCOPE SESSION +VARIABLE_TYPE DOUBLE +VARIABLE_COMMENT Log all queries that have taken more than log_slow_query_time seconds to execute to the slow query log file. The argument will be treated as a decimal value with microsecond precision +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 31536000 +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME LOG_SLOW_RATE_LIMIT VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED @@ -1735,7 +1775,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME LONG_QUERY_TIME VARIABLE_SCOPE SESSION VARIABLE_TYPE DOUBLE -VARIABLE_COMMENT Log all queries that have taken more than long_query_time seconds to execute to the slow query log file. The argument will be treated as a decimal value with microsecond precision +VARIABLE_COMMENT Alias for log_slow_query_time. Log all queries that have taken more than long_query_time seconds to execute to the slow query log file. The argument will be treated as a decimal value with microsecond precision NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 NUMERIC_BLOCK_SIZE NULL @@ -1875,7 +1915,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_INSERT_DELAYED_THREADS VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used +VARIABLE_COMMENT Alias for max_delayed_threads. Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 NUMERIC_BLOCK_SIZE 1 @@ -2045,7 +2085,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MIN_EXAMINED_ROW_LIMIT VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that +VARIABLE_COMMENT Alias for log_slow_min_examined_row_limit. Don't write queries to slow log that examine fewer rows than that NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 1 @@ -3015,7 +3055,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME READ_ONLY VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege +VARIABLE_COMMENT Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the 'READ ONLY ADMIN' privilege NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -3185,7 +3225,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLOW_QUERY_LOG VARIABLE_SCOPE SESSION VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options. +VARIABLE_COMMENT Alias for log_slow_query. Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -3195,7 +3235,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME SLOW_QUERY_LOG_FILE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE VARCHAR -VARIABLE_COMMENT Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options +VARIABLE_COMMENT Alias for log_slow_query_file. Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -3512,6 +3552,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT NULL +VARIABLE_NAME SYSTEM_VERSIONING_INSERT_HISTORY +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Allows direct inserts into ROW_START and ROW_END columns if secure_timestamp allows changing @@timestamp +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME TABLE_DEFINITION_CACHE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff index 8ba94d3ba7792..38dc9d215b891 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff @@ -1,4 +1,6 @@ -@@ -44,7 +44,7 @@ +--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result ++++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +@@ -44,7 +44,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_BLOCK_SIZE VARIABLE_SCOPE GLOBAL @@ -7,7 +9,7 @@ VARIABLE_COMMENT Block size to be used for Aria index pages. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 32768 -@@ -54,7 +54,7 @@ +@@ -54,7 +54,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_CHECKPOINT_INTERVAL VARIABLE_SCOPE GLOBAL @@ -16,7 +18,7 @@ VARIABLE_COMMENT Interval between tries to do an automatic checkpoints. In seconds; 0 means 'no automatic checkpoints' which makes sense only for testing. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -64,7 +64,7 @@ +@@ -64,7 +64,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_CHECKPOINT_LOG_ACTIVITY VARIABLE_SCOPE GLOBAL @@ -25,7 +27,7 @@ VARIABLE_COMMENT Number of bytes that the transaction log has to grow between checkpoints before a new checkpoint is written to the log. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -84,7 +84,7 @@ +@@ -84,7 +84,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ARIA_FORCE_START_AFTER_RECOVERY_FAILURES VARIABLE_SCOPE GLOBAL @@ -34,7 +36,7 @@ VARIABLE_COMMENT Number of consecutive log recovery failures after which logs will be automatically deleted to cure the problem; 0 (the default) disables the feature. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -104,7 +104,7 @@ +@@ -104,7 +104,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_GROUP_COMMIT_INTERVAL VARIABLE_SCOPE GLOBAL @@ -43,7 +45,7 @@ VARIABLE_COMMENT Interval between commits in microseconds (1/1000000 sec). 0 stands for no waiting for other threads to come and do a commit in "hard" mode and no sync()/commit at all in "soft" mode. Option has only an effect if aria_group_commit is used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -114,7 +114,7 @@ +@@ -114,7 +114,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_LOG_FILE_SIZE VARIABLE_SCOPE GLOBAL @@ -52,7 +54,7 @@ VARIABLE_COMMENT Limit for transaction log size NUMERIC_MIN_VALUE 8388608 NUMERIC_MAX_VALUE 4294967295 -@@ -144,10 +144,10 @@ +@@ -144,10 +144,10 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_PAGECACHE_AGE_THRESHOLD VARIABLE_SCOPE GLOBAL @@ -65,7 +67,7 @@ NUMERIC_BLOCK_SIZE 100 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -164,7 +164,7 @@ +@@ -164,7 +164,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_PAGECACHE_DIVISION_LIMIT VARIABLE_SCOPE GLOBAL @@ -74,7 +76,7 @@ VARIABLE_COMMENT The minimum percentage of warm blocks in key cache NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100 -@@ -174,7 +174,7 @@ +@@ -174,7 +174,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_PAGECACHE_FILE_HASH_SIZE VARIABLE_SCOPE GLOBAL @@ -83,7 +85,7 @@ VARIABLE_COMMENT Number of hash buckets for open and changed files. If you have a lot of Aria files open you should increase this for faster flush of changes. A good value is probably 1/10 of number of possible open Aria files. NUMERIC_MIN_VALUE 128 NUMERIC_MAX_VALUE 16384 -@@ -204,7 +204,7 @@ +@@ -204,7 +204,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ARIA_REPAIR_THREADS VARIABLE_SCOPE SESSION @@ -92,7 +94,7 @@ VARIABLE_COMMENT Number of threads to use when repairing Aria tables. The value of 1 disables parallel repair. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 128 -@@ -217,7 +217,7 @@ +@@ -217,7 +217,7 @@ 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 4096 @@ -101,7 +103,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -274,7 +274,7 @@ +@@ -274,7 +274,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME AUTO_INCREMENT_INCREMENT VARIABLE_SCOPE SESSION @@ -110,7 +112,7 @@ VARIABLE_COMMENT Auto-increment columns are incremented by this NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 65535 -@@ -284,7 +284,7 @@ +@@ -284,7 +284,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME AUTO_INCREMENT_OFFSET VARIABLE_SCOPE SESSION @@ -119,7 +121,7 @@ VARIABLE_COMMENT Offset added to Auto-increment columns. Used when auto-increment-increment != 1 NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 65535 -@@ -294,7 +294,7 @@ +@@ -294,7 +294,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME BACK_LOG VARIABLE_SCOPE GLOBAL @@ -128,7 +130,7 @@ VARIABLE_COMMENT The number of outstanding connection requests MariaDB can have. This comes into play when the main MariaDB thread gets very many connection requests in a very short time NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65535 -@@ -357,7 +357,7 @@ +@@ -357,7 +357,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the transactional cache for updates to transactional engines for the binary log. If you often use transactions containing many statements, you can increase this to get more performance NUMERIC_MIN_VALUE 4096 @@ -137,7 +139,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -374,20 +374,20 @@ +@@ -374,20 +374,20 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME BINLOG_COMMIT_WAIT_COUNT VARIABLE_SCOPE GLOBAL @@ -162,7 +164,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -404,7 +404,7 @@ +@@ -404,7 +404,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME BINLOG_EXPIRE_LOGS_SECONDS VARIABLE_SCOPE GLOBAL @@ -171,7 +173,7 @@ VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are linked, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 8553600 -@@ -417,7 +417,7 @@ +@@ -417,7 +417,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of file cache for the binary log NUMERIC_MIN_VALUE 8192 @@ -180,7 +182,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -467,7 +467,7 @@ +@@ -467,7 +467,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the statement cache for updates to non-transactional engines for the binary log. If you often use statements updating a great number of rows, you can increase this to get more performance. NUMERIC_MIN_VALUE 4096 @@ -189,7 +191,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -477,7 +477,7 @@ +@@ -477,7 +477,7 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread! NUMERIC_MIN_VALUE 0 @@ -198,7 +200,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -664,7 +664,7 @@ +@@ -664,7 +664,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME CONNECT_TIMEOUT VARIABLE_SCOPE GLOBAL @@ -207,7 +209,7 @@ VARIABLE_COMMENT The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake' NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 31536000 -@@ -714,7 +714,7 @@ +@@ -714,7 +714,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DEADLOCK_SEARCH_DEPTH_LONG VARIABLE_SCOPE SESSION @@ -216,7 +218,7 @@ VARIABLE_COMMENT Long search depth for the two-step deadlock detection NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 33 -@@ -724,7 +724,7 @@ +@@ -724,7 +724,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DEADLOCK_SEARCH_DEPTH_SHORT VARIABLE_SCOPE SESSION @@ -225,7 +227,7 @@ VARIABLE_COMMENT Short search depth for the two-step deadlock detection NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 32 -@@ -734,7 +734,7 @@ +@@ -734,7 +734,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DEADLOCK_TIMEOUT_LONG VARIABLE_SCOPE SESSION @@ -234,7 +236,7 @@ VARIABLE_COMMENT Long timeout for the two-step deadlock detection (in microseconds) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -744,7 +744,7 @@ +@@ -744,7 +744,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DEADLOCK_TIMEOUT_SHORT VARIABLE_SCOPE SESSION @@ -243,7 +245,7 @@ VARIABLE_COMMENT Short timeout for the two-step deadlock detection (in microseconds) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -804,7 +804,7 @@ +@@ -804,7 +804,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME DEFAULT_WEEK_FORMAT VARIABLE_SCOPE SESSION @@ -252,7 +254,7 @@ VARIABLE_COMMENT The default week format used by WEEK() functions NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 7 -@@ -814,7 +814,7 @@ +@@ -814,7 +814,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DELAYED_INSERT_LIMIT VARIABLE_SCOPE GLOBAL @@ -261,7 +263,7 @@ VARIABLE_COMMENT After inserting delayed_insert_limit rows, the INSERT DELAYED handler will check if there are any SELECT statements pending. If so, it allows these to execute before continuing. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -824,7 +824,7 @@ +@@ -824,7 +824,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DELAYED_INSERT_TIMEOUT VARIABLE_SCOPE GLOBAL @@ -270,7 +272,7 @@ VARIABLE_COMMENT How long a INSERT DELAYED thread should wait for INSERT statements before terminating NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -834,7 +834,7 @@ +@@ -834,7 +834,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME DELAYED_QUEUE_SIZE VARIABLE_SCOPE GLOBAL @@ -279,7 +281,7 @@ VARIABLE_COMMENT What size queue (in rows) should be allocated for handling INSERT DELAYED. If the queue becomes full, any client that does INSERT DELAYED will wait until there is room in the queue again NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -864,7 +864,7 @@ +@@ -864,7 +864,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME DIV_PRECISION_INCREMENT VARIABLE_SCOPE SESSION @@ -288,7 +290,7 @@ VARIABLE_COMMENT Precision of the result of '/' operator will be increased on that value NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 38 -@@ -984,7 +984,7 @@ +@@ -984,7 +984,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME EXTRA_MAX_CONNECTIONS VARIABLE_SCOPE GLOBAL @@ -297,7 +299,7 @@ VARIABLE_COMMENT The number of connections on extra-port NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100000 -@@ -1014,7 +1014,7 @@ +@@ -1014,7 +1014,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME FLUSH_TIME VARIABLE_SCOPE GLOBAL @@ -306,7 +308,7 @@ VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -1044,7 +1044,7 @@ +@@ -1044,7 +1044,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME FT_MAX_WORD_LEN VARIABLE_SCOPE GLOBAL @@ -315,7 +317,7 @@ VARIABLE_COMMENT The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -1054,7 +1054,7 @@ +@@ -1054,7 +1054,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME FT_MIN_WORD_LEN VARIABLE_SCOPE GLOBAL @@ -324,7 +326,7 @@ VARIABLE_COMMENT The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 84 -@@ -1064,7 +1064,7 @@ +@@ -1064,7 +1064,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME FT_QUERY_EXPANSION_LIMIT VARIABLE_SCOPE GLOBAL @@ -333,7 +335,7 @@ VARIABLE_COMMENT Number of best matches to use for query expansion NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1000 -@@ -1314,7 +1314,7 @@ +@@ -1314,7 +1314,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME HISTOGRAM_SIZE VARIABLE_SCOPE SESSION @@ -342,7 +344,7 @@ VARIABLE_COMMENT Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -1344,7 +1344,7 @@ +@@ -1344,7 +1344,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME HOST_CACHE_SIZE VARIABLE_SCOPE GLOBAL @@ -351,7 +353,7 @@ VARIABLE_COMMENT How many host names should be cached to avoid resolving. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65536 -@@ -1454,7 +1454,7 @@ +@@ -1454,7 +1454,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME INTERACTIVE_TIMEOUT VARIABLE_SCOPE SESSION @@ -360,7 +362,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on an interactive connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1487,7 +1487,7 @@ +@@ -1487,7 +1487,7 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer that is used for joins NUMERIC_MIN_VALUE 128 @@ -369,7 +371,7 @@ NUMERIC_BLOCK_SIZE 128 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1504,7 +1504,7 @@ +@@ -1504,7 +1504,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME JOIN_CACHE_LEVEL VARIABLE_SCOPE SESSION @@ -378,7 +380,7 @@ VARIABLE_COMMENT Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 8 -@@ -1527,7 +1527,7 @@ +@@ -1527,7 +1527,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford NUMERIC_MIN_VALUE 0 @@ -387,7 +389,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1694,7 +1694,7 @@ +@@ -1694,7 +1694,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME LOCK_WAIT_TIMEOUT VARIABLE_SCOPE SESSION @@ -396,7 +398,16 @@ VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -1844,7 +1844,7 @@ +@@ -1844,7 +1844,7 @@ READ_ONLY NO + COMMAND_LINE_ARGUMENT REQUIRED + VARIABLE_NAME LOG_SLOW_MIN_EXAMINED_ROW_LIMIT + VARIABLE_SCOPE SESSION +-VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that + NUMERIC_MIN_VALUE 0 + NUMERIC_MAX_VALUE 4294967295 +@@ -1884,7 +1884,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME LOG_SLOW_RATE_LIMIT VARIABLE_SCOPE SESSION @@ -405,7 +416,7 @@ VARIABLE_COMMENT Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or the performance impact of slow logging NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1874,7 +1874,7 @@ +@@ -1914,7 +1914,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME LOG_WARNINGS VARIABLE_SCOPE SESSION @@ -414,7 +425,7 @@ VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -1934,7 +1934,7 @@ +@@ -1974,7 +1974,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME MAX_ALLOWED_PACKET VARIABLE_SCOPE SESSION @@ -423,7 +434,7 @@ VARIABLE_COMMENT Max packet length to send to or receive from the server NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -1947,14 +1947,14 @@ +@@ -1987,14 +1987,14 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the total size of the transactional cache NUMERIC_MIN_VALUE 4096 @@ -440,7 +451,7 @@ VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 1073741824 -@@ -1967,14 +1967,14 @@ +@@ -2007,14 +2007,14 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the total size of the statement cache NUMERIC_MIN_VALUE 4096 @@ -457,7 +468,7 @@ VARIABLE_COMMENT The number of simultaneous clients allowed NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 100000 -@@ -1984,7 +1984,7 @@ +@@ -2024,7 +2024,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_CONNECT_ERRORS VARIABLE_SCOPE GLOBAL @@ -466,7 +477,7 @@ VARIABLE_COMMENT If there is more than this number of interrupted connections from a host this host will be blocked from further connections NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1994,7 +1994,7 @@ +@@ -2034,7 +2034,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_DELAYED_THREADS VARIABLE_SCOPE SESSION @@ -475,7 +486,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -2014,7 +2014,7 @@ +@@ -2054,7 +2054,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_ERROR_COUNT VARIABLE_SCOPE SESSION @@ -484,7 +495,7 @@ VARIABLE_COMMENT Max number of errors/warnings to store for a statement NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65535 -@@ -2027,14 +2027,14 @@ +@@ -2067,14 +2067,14 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't allow creation of heap tables bigger than this NUMERIC_MIN_VALUE 16384 @@ -498,10 +509,10 @@ VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used + VARIABLE_COMMENT Alias for max_delayed_threads. Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -2054,7 +2054,7 @@ +@@ -2094,7 +2094,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_LENGTH_FOR_SORT_DATA VARIABLE_SCOPE SESSION @@ -510,7 +521,7 @@ VARIABLE_COMMENT Max number of bytes in sorted records NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -2084,7 +2084,7 @@ +@@ -2124,7 +2124,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_RECURSIVE_ITERATIONS VARIABLE_SCOPE SESSION @@ -519,7 +530,7 @@ VARIABLE_COMMENT Maximum number of iterations when executing recursive queries NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2107,14 +2107,14 @@ +@@ -2147,14 +2147,14 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The maximum size of the container of a rowid filter NUMERIC_MIN_VALUE 1024 @@ -536,7 +547,7 @@ VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2134,7 +2134,7 @@ +@@ -2174,7 +2174,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_SORT_LENGTH VARIABLE_SCOPE SESSION @@ -545,7 +556,7 @@ VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored) NUMERIC_MIN_VALUE 64 NUMERIC_MAX_VALUE 8388608 -@@ -2144,7 +2144,7 @@ +@@ -2184,7 +2184,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_SP_RECURSION_DEPTH VARIABLE_SCOPE SESSION @@ -554,7 +565,7 @@ VARIABLE_COMMENT Maximum stored procedure recursion depth NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -2164,7 +2164,7 @@ +@@ -2204,7 +2204,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_TMP_TABLES VARIABLE_SCOPE SESSION @@ -563,7 +574,7 @@ VARIABLE_COMMENT Unused, will be removed. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2184,7 +2184,7 @@ +@@ -2224,7 +2224,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_WRITE_LOCK_COUNT VARIABLE_SCOPE GLOBAL @@ -572,7 +583,7 @@ VARIABLE_COMMENT After this many write locks, allow some read locks to run in between NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2194,7 +2194,7 @@ +@@ -2234,7 +2234,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME METADATA_LOCKS_CACHE_SIZE VARIABLE_SCOPE GLOBAL @@ -581,7 +592,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -2204,7 +2204,7 @@ +@@ -2244,7 +2244,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME METADATA_LOCKS_HASH_INSTANCES VARIABLE_SCOPE GLOBAL @@ -590,16 +601,16 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1024 -@@ -2214,7 +2214,7 @@ +@@ -2254,7 +2254,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MIN_EXAMINED_ROW_LIMIT VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that + VARIABLE_COMMENT Alias for log_slow_min_examined_row_limit. Don't write queries to slow log that examine fewer rows than that NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2224,7 +2224,7 @@ +@@ -2264,7 +2264,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MRR_BUFFER_SIZE VARIABLE_SCOPE SESSION @@ -608,7 +619,7 @@ VARIABLE_COMMENT Size of buffer to use when using MRR with range access NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -2234,7 +2234,7 @@ +@@ -2274,7 +2274,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_BLOCK_SIZE VARIABLE_SCOPE GLOBAL @@ -617,7 +628,7 @@ VARIABLE_COMMENT Block size to be used for MyISAM index pages NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 16384 -@@ -2244,7 +2244,7 @@ +@@ -2284,7 +2284,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_DATA_POINTER_SIZE VARIABLE_SCOPE GLOBAL @@ -626,7 +637,7 @@ VARIABLE_COMMENT Default pointer size to be used for MyISAM tables NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 7 -@@ -2267,7 +2267,7 @@ +@@ -2307,7 +2307,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Restricts the total memory used for memory mapping of MySQL tables NUMERIC_MIN_VALUE 7 @@ -635,7 +646,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -2284,10 +2284,10 @@ +@@ -2324,10 +2324,10 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME MYISAM_REPAIR_THREADS VARIABLE_SCOPE SESSION @@ -648,7 +659,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2297,7 +2297,7 @@ +@@ -2337,7 +2337,7 @@ 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 4096 @@ -657,7 +668,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2334,7 +2334,7 @@ +@@ -2374,7 +2374,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME NET_BUFFER_LENGTH VARIABLE_SCOPE SESSION @@ -666,7 +677,7 @@ VARIABLE_COMMENT Buffer length for TCP/IP and socket communication NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1048576 -@@ -2344,7 +2344,7 @@ +@@ -2384,7 +2384,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME NET_READ_TIMEOUT VARIABLE_SCOPE SESSION @@ -675,7 +686,7 @@ VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2354,7 +2354,7 @@ +@@ -2394,7 +2394,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME NET_RETRY_COUNT VARIABLE_SCOPE SESSION @@ -684,7 +695,7 @@ VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2364,7 +2364,7 @@ +@@ -2404,7 +2404,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME NET_WRITE_TIMEOUT VARIABLE_SCOPE SESSION @@ -693,7 +704,7 @@ VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2414,7 +2414,7 @@ +@@ -2454,7 +2454,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME OPEN_FILES_LIMIT VARIABLE_SCOPE GLOBAL @@ -702,7 +713,7 @@ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 or autoset then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2424,7 +2424,7 @@ +@@ -2464,7 +2464,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_EXTRA_PRUNING_DEPTH VARIABLE_SCOPE SESSION @@ -711,7 +722,7 @@ VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try agressively prune away the search space. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 62 -@@ -2434,17 +2434,17 @@ +@@ -2474,17 +2474,17 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_MAX_SEL_ARG_WEIGHT VARIABLE_SCOPE SESSION @@ -732,7 +743,7 @@ VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search: 1 - prune plans based on cost and number of retrieved rows eq_ref: 2 - prune also if we find an eq_ref chain NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -2454,7 +2454,7 @@ +@@ -2494,7 +2494,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_SEARCH_DEPTH VARIABLE_SCOPE SESSION @@ -741,7 +752,7 @@ VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 62 -@@ -2464,7 +2464,7 @@ +@@ -2504,7 +2504,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_SELECTIVITY_SAMPLING_LIMIT VARIABLE_SCOPE SESSION @@ -750,7 +761,7 @@ VARIABLE_COMMENT Controls number of record samples to check condition selectivity NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 4294967295 -@@ -2494,17 +2494,17 @@ +@@ -2534,17 +2534,17 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_TRACE_MAX_MEM_SIZE VARIABLE_SCOPE SESSION @@ -771,7 +782,7 @@ VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5 -@@ -2524,7 +2524,7 @@ +@@ -2564,7 +2564,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME PERFORMANCE_SCHEMA_ACCOUNTS_SIZE VARIABLE_SCOPE GLOBAL @@ -780,7 +791,7 @@ VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2534,7 +2534,7 @@ +@@ -2574,7 +2574,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_DIGESTS_SIZE VARIABLE_SCOPE GLOBAL @@ -789,7 +800,7 @@ VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2544,7 +2544,7 @@ +@@ -2584,7 +2584,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_LONG_SIZE VARIABLE_SCOPE GLOBAL @@ -798,7 +809,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2554,7 +2554,7 @@ +@@ -2594,7 +2594,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STAGES_HISTORY_SIZE VARIABLE_SCOPE GLOBAL @@ -807,7 +818,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2564,7 +2564,7 @@ +@@ -2604,7 +2604,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_LONG_SIZE VARIABLE_SCOPE GLOBAL @@ -816,7 +827,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2574,7 +2574,7 @@ +@@ -2614,7 +2614,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_STATEMENTS_HISTORY_SIZE VARIABLE_SCOPE GLOBAL @@ -825,7 +836,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2584,7 +2584,7 @@ +@@ -2624,7 +2624,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_TRANSACTIONS_HISTORY_LONG_SIZE VARIABLE_SCOPE GLOBAL @@ -834,7 +845,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_TRANSACTIONS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2594,7 +2594,7 @@ +@@ -2634,7 +2634,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_TRANSACTIONS_HISTORY_SIZE VARIABLE_SCOPE GLOBAL @@ -843,7 +854,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_TRANSACTIONS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2604,7 +2604,7 @@ +@@ -2644,7 +2644,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_LONG_SIZE VARIABLE_SCOPE GLOBAL @@ -852,7 +863,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2614,7 +2614,7 @@ +@@ -2654,7 +2654,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_EVENTS_WAITS_HISTORY_SIZE VARIABLE_SCOPE GLOBAL @@ -861,7 +872,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2624,7 +2624,7 @@ +@@ -2664,7 +2664,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_HOSTS_SIZE VARIABLE_SCOPE GLOBAL @@ -870,7 +881,7 @@ VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2634,7 +2634,7 @@ +@@ -2674,7 +2674,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_CLASSES VARIABLE_SCOPE GLOBAL @@ -879,7 +890,7 @@ VARIABLE_COMMENT Maximum number of condition instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2644,7 +2644,7 @@ +@@ -2684,7 +2684,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_COND_INSTANCES VARIABLE_SCOPE GLOBAL @@ -888,7 +899,7 @@ VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2654,7 +2654,7 @@ +@@ -2694,7 +2694,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_DIGEST_LENGTH VARIABLE_SCOPE GLOBAL @@ -897,7 +908,7 @@ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2664,7 +2664,7 @@ +@@ -2704,7 +2704,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_CLASSES VARIABLE_SCOPE GLOBAL @@ -906,7 +917,7 @@ VARIABLE_COMMENT Maximum number of file instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2674,7 +2674,7 @@ +@@ -2714,7 +2714,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_HANDLES VARIABLE_SCOPE GLOBAL @@ -915,7 +926,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented files. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2684,7 +2684,7 @@ +@@ -2724,7 +2724,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_FILE_INSTANCES VARIABLE_SCOPE GLOBAL @@ -924,7 +935,7 @@ VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2694,7 +2694,7 @@ +@@ -2734,7 +2734,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_INDEX_STAT VARIABLE_SCOPE GLOBAL @@ -933,7 +944,7 @@ VARIABLE_COMMENT Maximum number of index statistics for instrumented tables. Use 0 to disable, -1 for automated scaling. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2704,7 +2704,7 @@ +@@ -2744,7 +2744,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MEMORY_CLASSES VARIABLE_SCOPE GLOBAL @@ -942,7 +953,7 @@ VARIABLE_COMMENT Maximum number of memory pool instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1024 -@@ -2714,7 +2714,7 @@ +@@ -2754,7 +2754,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_METADATA_LOCKS VARIABLE_SCOPE GLOBAL @@ -951,7 +962,7 @@ VARIABLE_COMMENT Maximum number of metadata locks. Use 0 to disable, -1 for automated scaling. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2724,7 +2724,7 @@ +@@ -2764,7 +2764,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_CLASSES VARIABLE_SCOPE GLOBAL @@ -960,7 +971,7 @@ VARIABLE_COMMENT Maximum number of mutex instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2734,7 +2734,7 @@ +@@ -2774,7 +2774,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_MUTEX_INSTANCES VARIABLE_SCOPE GLOBAL @@ -969,7 +980,7 @@ VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2744,7 +2744,7 @@ +@@ -2784,7 +2784,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_PREPARED_STATEMENTS_INSTANCES VARIABLE_SCOPE GLOBAL @@ -978,7 +989,7 @@ VARIABLE_COMMENT Maximum number of instrumented prepared statements. Use 0 to disable, -1 for automated scaling. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2754,7 +2754,7 @@ +@@ -2794,7 +2794,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_PROGRAM_INSTANCES VARIABLE_SCOPE GLOBAL @@ -987,7 +998,7 @@ VARIABLE_COMMENT Maximum number of instrumented programs. Use 0 to disable, -1 for automated scaling. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2764,7 +2764,7 @@ +@@ -2804,7 +2804,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_CLASSES VARIABLE_SCOPE GLOBAL @@ -996,7 +1007,7 @@ VARIABLE_COMMENT Maximum number of rwlock instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2774,7 +2774,7 @@ +@@ -2814,7 +2814,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_RWLOCK_INSTANCES VARIABLE_SCOPE GLOBAL @@ -1005,7 +1016,7 @@ VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2784,7 +2784,7 @@ +@@ -2824,7 +2824,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_CLASSES VARIABLE_SCOPE GLOBAL @@ -1014,7 +1025,7 @@ VARIABLE_COMMENT Maximum number of socket instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2794,7 +2794,7 @@ +@@ -2834,7 +2834,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SOCKET_INSTANCES VARIABLE_SCOPE GLOBAL @@ -1023,7 +1034,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2804,7 +2804,7 @@ +@@ -2844,7 +2844,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_SQL_TEXT_LENGTH VARIABLE_SCOPE GLOBAL @@ -1032,7 +1043,7 @@ VARIABLE_COMMENT Maximum length of displayed sql text. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2814,7 +2814,7 @@ +@@ -2854,7 +2854,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STAGE_CLASSES VARIABLE_SCOPE GLOBAL @@ -1041,7 +1052,7 @@ VARIABLE_COMMENT Maximum number of stage instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2824,7 +2824,7 @@ +@@ -2864,7 +2864,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES VARIABLE_SCOPE GLOBAL @@ -1050,7 +1061,7 @@ VARIABLE_COMMENT Maximum number of statement instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2834,7 +2834,7 @@ +@@ -2874,7 +2874,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_STACK VARIABLE_SCOPE GLOBAL @@ -1059,7 +1070,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_CURRENT. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 256 -@@ -2844,7 +2844,7 @@ +@@ -2884,7 +2884,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_HANDLES VARIABLE_SCOPE GLOBAL @@ -1068,7 +1079,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2854,7 +2854,7 @@ +@@ -2894,7 +2894,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_INSTANCES VARIABLE_SCOPE GLOBAL @@ -1077,7 +1088,7 @@ VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2864,7 +2864,7 @@ +@@ -2904,7 +2904,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_TABLE_LOCK_STAT VARIABLE_SCOPE GLOBAL @@ -1086,7 +1097,7 @@ VARIABLE_COMMENT Maximum number of lock statistics for instrumented tables. Use 0 to disable, -1 for automated scaling. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2874,7 +2874,7 @@ +@@ -2914,7 +2914,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_CLASSES VARIABLE_SCOPE GLOBAL @@ -1095,7 +1106,7 @@ VARIABLE_COMMENT Maximum number of thread instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2884,7 +2884,7 @@ +@@ -2924,7 +2924,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_THREAD_INSTANCES VARIABLE_SCOPE GLOBAL @@ -1104,7 +1115,7 @@ VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2894,7 +2894,7 @@ +@@ -2934,7 +2934,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_SESSION_CONNECT_ATTRS_SIZE VARIABLE_SCOPE GLOBAL @@ -1113,7 +1124,7 @@ VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2904,7 +2904,7 @@ +@@ -2944,7 +2944,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_ACTORS_SIZE VARIABLE_SCOPE GLOBAL @@ -1122,7 +1133,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2914,7 +2914,7 @@ +@@ -2954,7 +2954,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_SETUP_OBJECTS_SIZE VARIABLE_SCOPE GLOBAL @@ -1131,7 +1142,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2924,7 +2924,7 @@ +@@ -2964,7 +2964,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PERFORMANCE_SCHEMA_USERS_SIZE VARIABLE_SCOPE GLOBAL @@ -1140,7 +1151,7 @@ VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2974,7 +2974,7 @@ +@@ -3014,7 +3014,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PRELOAD_BUFFER_SIZE VARIABLE_SCOPE SESSION @@ -1149,7 +1160,7 @@ VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -2994,7 +2994,7 @@ +@@ -3034,7 +3034,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME PROFILING_HISTORY_SIZE VARIABLE_SCOPE SESSION @@ -1158,7 +1169,7 @@ VARIABLE_COMMENT Number of statements about which profiling information is maintained. If set to 0, no profiles are stored. See SHOW PROFILES. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -3004,7 +3004,7 @@ +@@ -3044,7 +3044,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME PROGRESS_REPORT_TIME VARIABLE_SCOPE SESSION @@ -1167,7 +1178,7 @@ VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3064,7 +3064,7 @@ +@@ -3104,7 +3104,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME QUERY_ALLOC_BLOCK_SIZE VARIABLE_SCOPE SESSION @@ -1176,7 +1187,7 @@ VARIABLE_COMMENT Allocation block size for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3074,7 +3074,7 @@ +@@ -3114,7 +3114,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME QUERY_CACHE_LIMIT VARIABLE_SCOPE GLOBAL @@ -1185,7 +1196,7 @@ VARIABLE_COMMENT Don't cache results that are bigger than this NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3084,7 +3084,7 @@ +@@ -3124,7 +3124,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME QUERY_CACHE_MIN_RES_UNIT VARIABLE_SCOPE GLOBAL @@ -1194,7 +1205,7 @@ VARIABLE_COMMENT The minimum size for blocks allocated by the query cache NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3097,7 +3097,7 @@ +@@ -3137,7 +3137,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The memory allocated to store results from old queries NUMERIC_MIN_VALUE 0 @@ -1203,7 +1214,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3134,7 +3134,7 @@ +@@ -3174,7 +3174,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME QUERY_PREALLOC_SIZE VARIABLE_SCOPE SESSION @@ -1212,7 +1223,7 @@ VARIABLE_COMMENT Persistent buffer for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3147,7 +3147,7 @@ +@@ -3187,7 +3187,7 @@ VARIABLE_SCOPE SESSION ONLY VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1221,7 +1232,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3157,14 +3157,14 @@ +@@ -3197,14 +3197,14 @@ VARIABLE_SCOPE SESSION ONLY VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1238,7 +1249,7 @@ VARIABLE_COMMENT Allocation block size for storing ranges during optimization NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 4294967295 -@@ -3177,14 +3177,14 @@ +@@ -3217,14 +3217,14 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Maximum speed(KB/s) to read binlog from master (0 = no limit) NUMERIC_MIN_VALUE 0 @@ -1255,7 +1266,7 @@ VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -3204,7 +3204,7 @@ +@@ -3244,7 +3244,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME READ_RND_BUFFER_SIZE VARIABLE_SCOPE SESSION @@ -1264,7 +1275,7 @@ VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 2147483647 -@@ -3414,10 +3414,10 @@ +@@ -3464,10 +3464,10 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ROWID_MERGE_BUFF_SIZE VARIABLE_SCOPE SESSION @@ -1277,7 +1288,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3434,20 +3434,20 @@ +@@ -3484,20 +3484,20 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME RPL_SEMI_SYNC_MASTER_TIMEOUT VARIABLE_SCOPE GLOBAL @@ -1302,7 +1313,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3504,10 +3504,10 @@ +@@ -3554,10 +3554,10 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME RPL_SEMI_SYNC_SLAVE_TRACE_LEVEL VARIABLE_SCOPE GLOBAL @@ -1315,7 +1326,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3544,7 +3544,7 @@ +@@ -3594,7 +3594,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SERVER_ID VARIABLE_SCOPE SESSION @@ -1324,7 +1335,7 @@ VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -3684,7 +3684,7 @@ +@@ -3734,7 +3734,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLAVE_DOMAIN_PARALLEL_THREADS VARIABLE_SCOPE GLOBAL @@ -1333,7 +1344,7 @@ VARIABLE_COMMENT Maximum number of parallel threads to use on slave for events in a single replication domain. When using multiple domains, this can be used to limit a single domain from grabbing all threads and thus stalling other domains. The default of 0 means to allow a domain to grab as many threads as it wants, up to the value of slave_parallel_threads. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -3714,7 +3714,7 @@ +@@ -3764,7 +3764,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLAVE_MAX_ALLOWED_PACKET VARIABLE_SCOPE GLOBAL @@ -1342,7 +1353,7 @@ VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3734,7 +3734,7 @@ +@@ -3794,7 +3794,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLAVE_PARALLEL_MAX_QUEUED VARIABLE_SCOPE GLOBAL @@ -1351,7 +1362,7 @@ VARIABLE_COMMENT Limit on how much memory SQL threads should use per parallel replication thread when reading ahead in the relay log looking for opportunities for parallel replication. Only used when --slave-parallel-threads > 0. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2147483647 -@@ -3754,7 +3754,7 @@ +@@ -3814,7 +3814,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME SLAVE_PARALLEL_THREADS VARIABLE_SCOPE GLOBAL @@ -1360,7 +1371,7 @@ VARIABLE_COMMENT If non-zero, number of threads to spawn to apply in parallel events on the slave that were group-committed on the master or were logged with GTID in different replication domains. Note that these threads are in addition to the IO and SQL threads, which are always created by a replication slave NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -3764,7 +3764,7 @@ +@@ -3824,7 +3824,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLAVE_PARALLEL_WORKERS VARIABLE_SCOPE GLOBAL @@ -1369,7 +1380,7 @@ VARIABLE_COMMENT Alias for slave_parallel_threads NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -3804,7 +3804,7 @@ +@@ -3864,7 +3864,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME SLAVE_TRANSACTION_RETRIES VARIABLE_SCOPE GLOBAL @@ -1378,7 +1389,7 @@ VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3824,7 +3824,7 @@ +@@ -3884,7 +3884,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLAVE_TRANSACTION_RETRY_INTERVAL VARIABLE_SCOPE GLOBAL @@ -1387,7 +1398,7 @@ VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 3600 -@@ -3844,7 +3844,7 @@ +@@ -3904,7 +3904,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLOW_LAUNCH_TIME VARIABLE_SCOPE GLOBAL @@ -1396,7 +1407,7 @@ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -3887,7 +3887,7 @@ +@@ -3947,7 +3947,7 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size NUMERIC_MIN_VALUE 1024 @@ -1405,7 +1416,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4114,7 +4114,7 @@ +@@ -4174,7 +4174,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME STORED_PROGRAM_CACHE VARIABLE_SCOPE GLOBAL @@ -1414,8 +1425,8 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -4214,7 +4214,7 @@ - COMMAND_LINE_ARGUMENT NULL +@@ -4284,7 +4284,7 @@ READ_ONLY NO + COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME TABLE_DEFINITION_CACHE VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED @@ -1423,7 +1434,7 @@ VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 NUMERIC_MAX_VALUE 2097152 -@@ -4224,7 +4224,7 @@ +@@ -4294,7 +4294,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME TABLE_OPEN_CACHE VARIABLE_SCOPE GLOBAL @@ -1432,7 +1443,7 @@ VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 1048576 -@@ -4284,7 +4284,7 @@ +@@ -4354,7 +4354,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME THREAD_CACHE_SIZE VARIABLE_SCOPE GLOBAL @@ -1441,7 +1452,7 @@ VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -4457,7 +4457,7 @@ +@@ -4527,7 +4527,7 @@ VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Max size for data for an internal temporary on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 1024 @@ -1450,7 +1461,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4467,7 +4467,7 @@ +@@ -4537,7 +4537,7 @@ VARIABLE_SCOPE SESSION 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 @@ -1459,7 +1470,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4477,14 +4477,14 @@ +@@ -4547,14 +4547,14 @@ VARIABLE_SCOPE SESSION 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 @@ -1476,7 +1487,7 @@ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4494,7 +4494,7 @@ +@@ -4564,7 +4564,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME TRANSACTION_PREALLOC_SIZE VARIABLE_SCOPE SESSION @@ -1485,7 +1496,7 @@ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4634,7 +4634,7 @@ +@@ -4704,7 +4704,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME WAIT_TIMEOUT VARIABLE_SCOPE SESSION @@ -1494,7 +1505,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -4661,7 +4661,7 @@ +@@ -4731,7 +4731,7 @@ order by variable_name; VARIABLE_NAME LOG_TC_SIZE GLOBAL_VALUE_ORIGIN AUTO VARIABLE_SCOPE GLOBAL 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 1b4e49f55be96..23942418b07db 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -325,7 +325,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME BIND_ADDRESS VARIABLE_SCOPE GLOBAL VARIABLE_TYPE VARCHAR -VARIABLE_COMMENT IP address to bind to. +VARIABLE_COMMENT IP address to bind to. Several addresses may be specified, separated by a comma (,). NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -1842,6 +1842,46 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,not_using_index,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME LOG_SLOW_MIN_EXAMINED_ROW_LIMIT +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 4294967295 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME LOG_SLOW_QUERY +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME LOG_SLOW_QUERY_FILE +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME LOG_SLOW_QUERY_TIME +VARIABLE_SCOPE SESSION +VARIABLE_TYPE DOUBLE +VARIABLE_COMMENT Log all queries that have taken more than log_slow_query_time seconds to execute to the slow query log file. The argument will be treated as a decimal value with microsecond precision +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 31536000 +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME LOG_SLOW_RATE_LIMIT VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED @@ -1885,7 +1925,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME LONG_QUERY_TIME VARIABLE_SCOPE SESSION VARIABLE_TYPE DOUBLE -VARIABLE_COMMENT Log all queries that have taken more than long_query_time seconds to execute to the slow query log file. The argument will be treated as a decimal value with microsecond precision +VARIABLE_COMMENT Alias for log_slow_query_time. Log all queries that have taken more than long_query_time seconds to execute to the slow query log file. The argument will be treated as a decimal value with microsecond precision NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 NUMERIC_BLOCK_SIZE NULL @@ -2035,7 +2075,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_INSERT_DELAYED_THREADS VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used +VARIABLE_COMMENT Alias for max_delayed_threads. Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 NUMERIC_BLOCK_SIZE 1 @@ -2215,7 +2255,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MIN_EXAMINED_ROW_LIMIT VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that +VARIABLE_COMMENT Alias for log_slow_min_examined_row_limit. Don't write queries to slow log that examine fewer rows than that NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 1 @@ -3195,7 +3235,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME READ_ONLY VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege +VARIABLE_COMMENT Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the 'READ ONLY ADMIN' privilege NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -3342,6 +3382,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT NULL +VARIABLE_NAME REPLICATE_REWRITE_DB +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT Tells the slave to replicate binlog events into a different database than their original target on the master.Example: replicate-rewrite-db=master_db_name->slave_db_name. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME REPLICATE_WILD_DO_TABLE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE VARCHAR @@ -3865,7 +3915,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SLOW_QUERY_LOG VARIABLE_SCOPE SESSION VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options. +VARIABLE_COMMENT Alias for log_slow_query. Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -3875,7 +3925,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME SLOW_QUERY_LOG_FILE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE VARCHAR -VARIABLE_COMMENT Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options +VARIABLE_COMMENT Alias for log_slow_query_file. Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -4222,6 +4272,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT NULL +VARIABLE_NAME SYSTEM_VERSIONING_INSERT_HISTORY +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Allows direct inserts into ROW_START and ROW_END columns if secure_timestamp allows changing @@timestamp +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME TABLE_DEFINITION_CACHE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED diff --git a/mysql-test/suite/sys_vars/r/sysvars_star.result b/mysql-test/suite/sys_vars/r/sysvars_star.result index b80515db23dc5..b3357fda3afab 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_star.result +++ b/mysql-test/suite/sys_vars/r/sysvars_star.result @@ -60,7 +60,7 @@ VARIABLE_NAME PLUGIN_MATURITY SESSION_VALUE NULL GLOBAL_VALUE alpha GLOBAL_VALUE_ORIGIN CONFIG -DEFAULT_VALUE gamma +DEFAULT_VALUE beta VARIABLE_SCOPE GLOBAL VARIABLE_TYPE ENUM VARIABLE_COMMENT The lowest desirable plugin maturity. Plugins less mature than that will not be installed or loaded diff --git a/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test index fd2dbefe7f608..25fda7d664a9a 100644 --- a/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test +++ b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test @@ -38,7 +38,9 @@ INSERT INTO t1 VALUES('Procedure Executed.'); # CREATE USER 'userTest'@'localhost'; +GRANT CREATE ROUTINE, SELECT ON test.* to 'userTest'@'localhost'; CREATE USER 'userTest1'@'localhost'; +GRANT CREATE ROUTINE, SELECT ON test.* to 'userTest1'@'localhost'; # # Value TRUE diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffer_max_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffer_max_size_basic.test deleted file mode 100644 index 2094ef3dc0bb4..0000000000000 --- a/mysql-test/suite/sys_vars/t/innodb_change_buffer_max_size_basic.test +++ /dev/null @@ -1,71 +0,0 @@ - - -# 2011-02-09 - Added -# - ---source include/have_innodb.inc - -SET @start_global_value = @@global.innodb_change_buffer_max_size; -SELECT @start_global_value; - -# -# exists as global only -# ---echo Valid values are between 0 and 50 -select @@global.innodb_change_buffer_max_size between 0 and 50; -select @@global.innodb_change_buffer_max_size; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.innodb_change_buffer_max_size; -show global variables like 'innodb_change_buffer_max_size'; -show session variables like 'innodb_change_buffer_max_size'; ---disable_warnings -select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size'; -select * from information_schema.session_variables where variable_name='innodb_change_buffer_max_size'; ---enable_warnings - -# -# show that it's writable -# -set global innodb_change_buffer_max_size=10; -select @@global.innodb_change_buffer_max_size; ---disable_warnings -select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size'; -select * from information_schema.session_variables where variable_name='innodb_change_buffer_max_size'; ---enable_warnings ---error ER_GLOBAL_VARIABLE -set session innodb_change_buffer_max_size=1; - -# -# incorrect types -# ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_change_buffer_max_size=1.1; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_change_buffer_max_size=1e1; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_change_buffer_max_size="foo"; - -set global innodb_change_buffer_max_size=-7; -select @@global.innodb_change_buffer_max_size; ---disable_warnings -select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size'; ---enable_warnings -set global innodb_change_buffer_max_size=56; -select @@global.innodb_change_buffer_max_size; ---disable_warnings -select * from information_schema.global_variables where variable_name='innodb_change_buffer_max_size'; ---enable_warnings - -# -# min/max/DEFAULT values -# -set global innodb_change_buffer_max_size=0; -select @@global.innodb_change_buffer_max_size; -set global innodb_change_buffer_max_size=50; -select @@global.innodb_change_buffer_max_size; -set global innodb_change_buffer_max_size=DEFAULT; -select @@global.innodb_change_buffer_max_size; - - -SET @@global.innodb_change_buffer_max_size = @start_global_value; -SELECT @@global.innodb_change_buffer_max_size; diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test deleted file mode 100644 index 19f0890feff4d..0000000000000 --- a/mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test +++ /dev/null @@ -1,65 +0,0 @@ - - -# 2010-01-25 - Added -# - ---source include/have_innodb.inc - -SET @start_global_value = @@global.innodb_change_buffering; -SELECT @start_global_value; - -# -# exists as global only -# ---echo Valid values are 'all', 'deletes', 'changes', 'inserts', 'none', 'purges' -select @@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges'); -select @@global.innodb_change_buffering; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.innodb_change_buffering; -show global variables like 'innodb_change_buffering'; -show session variables like 'innodb_change_buffering'; ---disable_warnings -select * from information_schema.global_variables where variable_name='innodb_change_buffering'; -select * from information_schema.session_variables where variable_name='innodb_change_buffering'; ---enable_warnings - -# -# show that it's writable -# -set global innodb_change_buffering='none'; -select @@global.innodb_change_buffering; ---disable_warnings -select * from information_schema.global_variables where variable_name='innodb_change_buffering'; -select * from information_schema.session_variables where variable_name='innodb_change_buffering'; ---enable_warnings -set @@global.innodb_change_buffering='inserts'; -select @@global.innodb_change_buffering; ---disable_warnings -select * from information_schema.global_variables where variable_name='innodb_change_buffering'; -select * from information_schema.session_variables where variable_name='innodb_change_buffering'; ---enable_warnings ---error ER_GLOBAL_VARIABLE -set session innodb_change_buffering='some'; ---error ER_GLOBAL_VARIABLE -set @@session.innodb_change_buffering='some'; - -# -# incorrect types -# ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_change_buffering=1.1; -set global innodb_change_buffering=1; -SELECT @@global.innodb_change_buffering; ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_change_buffering=-2; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_change_buffering=1e1; ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_change_buffering='some'; - -# -# Cleanup -# - -SET @@global.innodb_change_buffering = @start_global_value; -SELECT @@global.innodb_change_buffering; diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test deleted file mode 100644 index 70f8bee152356..0000000000000 --- a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test +++ /dev/null @@ -1,59 +0,0 @@ ---source include/have_innodb.inc ---source include/have_debug.inc - -SET @start_global_value = @@global.innodb_change_buffering_debug; -SELECT @start_global_value; - -# -# exists as global only -# -select @@global.innodb_change_buffering_debug in (0, 1); -select @@global.innodb_change_buffering_debug; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.innodb_change_buffering_debug; -show global variables like 'innodb_change_buffering_debug'; -show session variables like 'innodb_change_buffering_debug'; ---disable_warnings -select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; -select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; ---enable_warnings - -# -# show that it's writable -# -set global innodb_change_buffering_debug=1; -select @@global.innodb_change_buffering_debug; ---disable_warnings -select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; -select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; ---enable_warnings -set @@global.innodb_change_buffering_debug=0; -select @@global.innodb_change_buffering_debug; ---disable_warnings -select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug'; -select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug'; ---enable_warnings ---error ER_GLOBAL_VARIABLE -set session innodb_change_buffering_debug='some'; ---error ER_GLOBAL_VARIABLE -set @@session.innodb_change_buffering_debug='some'; - -# -# incorrect types -# ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_change_buffering_debug=1.1; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_change_buffering_debug='foo'; -set global innodb_change_buffering_debug=-2; ---error ER_WRONG_TYPE_FOR_VAR -set global innodb_change_buffering_debug=1e1; -set global innodb_change_buffering_debug=2; -select @@global.innodb_change_buffering_debug; - -# -# Cleanup -# - -SET @@global.innodb_change_buffering_debug = @start_global_value; -SELECT @@global.innodb_change_buffering_debug; diff --git a/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test index c701c2ee171c8..802d7e836e777 100644 --- a/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test @@ -39,17 +39,10 @@ SELECT COUNT(@@GLOBAL.innodb_write_io_threads); # Check if Value can set # #################################################################### ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SET @@GLOBAL.innodb_read_io_threads=1; ---echo Expected error 'Read only variable' SELECT COUNT(@@GLOBAL.innodb_read_io_threads); --echo 1 Expected ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SET @@GLOBAL.innodb_write_io_threads=1; ---echo Expected error 'Read only variable' - SELECT COUNT(@@GLOBAL.innodb_write_io_threads); --echo 1 Expected diff --git a/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test index c4c49d5bb2036..148871478a7f3 100644 --- a/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test @@ -19,10 +19,18 @@ select * from information_schema.session_variables where variable_name='innodb_r --enable_warnings # -# show that it's read-only +# show that it's not read-only # ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -set global innodb_read_io_threads=1; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@innodb_read_io_threads into @n; +--disable_warnings +set global innodb_read_io_threads = 1; +--enable_warnings +select @@innodb_read_io_threads; +--disable_warnings +set global innodb_read_io_threads=64; +--enable_warnings +select @@innodb_read_io_threads; +--error ER_GLOBAL_VARIABLE set session innodb_read_io_threads=1; +set global innodb_read_io_threads=@n; diff --git a/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test index d9556af37d16b..9ee9f5ba619f6 100644 --- a/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test @@ -19,10 +19,18 @@ select * from information_schema.session_variables where variable_name='innodb_w --enable_warnings # -# show that it's read-only +# show that it's not read-only # ---error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@innodb_write_io_threads into @n; +--disable_warnings set global innodb_write_io_threads=1; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -set session innodb_write_io_threads=1; +--enable_warnings +select @@innodb_write_io_threads; +--disable_warnings +set global innodb_write_io_threads=64; +--enable_warnings +select @@innodb_write_io_threads; +--disable_warnings +set global innodb_write_io_threads=@n; +--enable_warnings diff --git a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test index 41911d82ac50c..958ae5d6c7a6b 100644 --- a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test +++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test @@ -36,6 +36,7 @@ SET @start_value= @@global.log_bin_trust_function_creators; --echo ## Creating new user tt ## CREATE USER tt@localhost; +GRANT ALL ON test.* TO tt@localhost; --echo ## Setting value of variable to 0 ## SET @@global.log_bin_trust_function_creators = 0; diff --git a/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_basic.test b/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_basic.test deleted file mode 100644 index 77391df6b3c63..0000000000000 --- a/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_basic.test +++ /dev/null @@ -1,57 +0,0 @@ -# set session - -SET @start_global_value = @@global.log_slow_disabled_statements; - -# -# exists as global only -# -select @@global.log_slow_disabled_statements; -select @@session.log_slow_disabled_statements; -show global variables like 'log_slow_disabled_statements'; -show session variables like 'log_slow_disabled_statements'; -select * from information_schema.global_variables where variable_name='log_slow_disabled_statements'; -select * from information_schema.session_variables where variable_name='log_slow_disabled_statements'; - -# -# show that it's writable -# -set global log_slow_disabled_statements=1; -select @@global.log_slow_disabled_statements; -set session log_slow_disabled_statements=1; -select @@session.log_slow_disabled_statements; - -# -# all valid values -# -set session log_slow_disabled_statements=1; -select @@session.log_slow_disabled_statements; -set session log_slow_disabled_statements=2; -select @@session.log_slow_disabled_statements; -set session log_slow_disabled_statements=5; -select @@session.log_slow_disabled_statements; -set session log_slow_disabled_statements='admin'; -select @@session.log_slow_disabled_statements; -set session log_slow_disabled_statements='slave'; -select @@session.log_slow_disabled_statements; -set session log_slow_disabled_statements='call'; -select @@session.log_slow_disabled_statements; -set session log_slow_disabled_statements='sp'; -select @@session.log_slow_disabled_statements; -set session log_slow_disabled_statements='admin,sp,call,slave'; -select @@session.log_slow_disabled_statements; -set session log_slow_disabled_statements=''; -select @@session.log_slow_disabled_statements; - -# -# incorrect types/values -# ---error ER_WRONG_TYPE_FOR_VAR -set session log_slow_disabled_statements=1.1; ---error ER_WRONG_TYPE_FOR_VAR -set session log_slow_disabled_statements=1e1; ---error ER_WRONG_VALUE_FOR_VAR -set session log_slow_disabled_statements="foo"; ---error ER_WRONG_VALUE_FOR_VAR -set session log_slow_disabled_statements=1024; - -SET @@global.log_slow_disabled_statements = @start_global_value; diff --git a/mysql-test/suite/sys_vars/t/log_slow_filter_basic.test b/mysql-test/suite/sys_vars/t/log_slow_filter_basic.test deleted file mode 100644 index 5309456b3ef21..0000000000000 --- a/mysql-test/suite/sys_vars/t/log_slow_filter_basic.test +++ /dev/null @@ -1,71 +0,0 @@ -# set session - -SET @start_global_value = @@global.log_slow_filter; - -# -# exists as global only -# -select @@global.log_slow_filter; -select @@session.log_slow_filter; -show global variables like 'log_slow_filter'; -show session variables like 'log_slow_filter'; -select * from information_schema.global_variables where variable_name='log_slow_filter'; -select * from information_schema.session_variables where variable_name='log_slow_filter'; - -# -# show that it's writable -# -set global log_slow_filter=1; -select @@global.log_slow_filter; -set session log_slow_filter=1; -select @@session.log_slow_filter; - -# -# all valid values -# -set session log_slow_filter=1; -select @@session.log_slow_filter; -set session log_slow_filter=2; -select @@session.log_slow_filter; -set session log_slow_filter=5; -select @@session.log_slow_filter; -set session log_slow_filter='admin'; -select @@session.log_slow_filter; -set session log_slow_filter='filesort'; -select @@session.log_slow_filter; -set session log_slow_filter='filesort_on_disk'; -select @@session.log_slow_filter; -set session log_slow_filter='full_join'; -select @@session.log_slow_filter; -set session log_slow_filter='full_scan'; -select @@session.log_slow_filter; -set session log_slow_filter='not_using_index'; -select @@session.log_slow_filter; -set session log_slow_filter='query_cache'; -select @@session.log_slow_filter; -set session log_slow_filter='query_cache_miss'; -select @@session.log_slow_filter; -set session log_slow_filter='tmp_table'; -select @@session.log_slow_filter; -set session log_slow_filter='tmp_table_on_disk'; -select @@session.log_slow_filter; -set session log_slow_filter='filesort,query_cache'; -select @@session.log_slow_filter; -set session log_slow_filter='admin,not_using_index,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk'; -select @@session.log_slow_filter; -set session log_slow_filter=''; -select @@session.log_slow_filter; - -# -# incorrect types/values -# ---error ER_WRONG_TYPE_FOR_VAR -set session log_slow_filter=1.1; ---error ER_WRONG_TYPE_FOR_VAR -set session log_slow_filter=1e1; ---error ER_WRONG_VALUE_FOR_VAR -set session log_slow_filter="foo"; ---error ER_WRONG_VALUE_FOR_VAR -set session log_slow_filter=16384; - -SET @@global.log_slow_filter = @start_global_value; diff --git a/mysql-test/suite/sys_vars/t/log_slow_rate_limit_basic.test b/mysql-test/suite/sys_vars/t/log_slow_rate_limit_basic.test deleted file mode 100644 index bb90b29e5f425..0000000000000 --- a/mysql-test/suite/sys_vars/t/log_slow_rate_limit_basic.test +++ /dev/null @@ -1,42 +0,0 @@ -# ulong session - -SET @start_global_value = @@global.log_slow_rate_limit; - -# -# exists as global only -# -select @@global.log_slow_rate_limit; -select @@session.log_slow_rate_limit; -show global variables like 'log_slow_rate_limit'; -show session variables like 'log_slow_rate_limit'; -select * from information_schema.global_variables where variable_name='log_slow_rate_limit'; -select * from information_schema.session_variables where variable_name='log_slow_rate_limit'; - -# -# show that it's writable -# -set global log_slow_rate_limit=10; -select @@global.log_slow_rate_limit; -set session log_slow_rate_limit=10; -select @@session.log_slow_rate_limit; - -# -# incorrect types -# ---error ER_WRONG_TYPE_FOR_VAR -set global log_slow_rate_limit=1.1; ---error ER_WRONG_TYPE_FOR_VAR -set session log_slow_rate_limit=1e1; ---error ER_WRONG_TYPE_FOR_VAR -set global log_slow_rate_limit="foo"; - -# -# min/max values, block size -# -set global log_slow_rate_limit=0; -select @@global.log_slow_rate_limit; -set session log_slow_rate_limit=cast(-1 as unsigned int); -select @@session.log_slow_rate_limit; - -SET @@global.log_slow_rate_limit = @start_global_value; - diff --git a/mysql-test/suite/sys_vars/t/log_slow_verbosity_basic.test b/mysql-test/suite/sys_vars/t/log_slow_verbosity_basic.test deleted file mode 100644 index 9f1cf6351a0d0..0000000000000 --- a/mysql-test/suite/sys_vars/t/log_slow_verbosity_basic.test +++ /dev/null @@ -1,67 +0,0 @@ -# set session - -SET @start_global_value = @@global.log_slow_verbosity; -select @@global.log_slow_verbosity = @@session.log_slow_verbosity; -SET @@global.log_slow_verbosity="",@@session.log_slow_verbosity=""; - -# -# exists as global only -# -show global variables like 'log_slow_verbosity'; -show session variables like 'log_slow_verbosity'; -select * from information_schema.global_variables where variable_name='log_slow_verbosity'; -select * from information_schema.session_variables where variable_name='log_slow_verbosity'; - -# -# show that it's writable -# -set global log_slow_verbosity=1; -select @@global.log_slow_verbosity; -set session log_slow_verbosity=1; -select @@session.log_slow_verbosity; - -# -# all valid values -# -set session log_slow_verbosity=1; -select @@session.log_slow_verbosity; -set session log_slow_verbosity=2; -select @@session.log_slow_verbosity; -set session log_slow_verbosity=3; -select @@session.log_slow_verbosity; -set session log_slow_verbosity=4; -select @@session.log_slow_verbosity; -set session log_slow_verbosity=5; -select @@session.log_slow_verbosity; -set session log_slow_verbosity=6; -select @@session.log_slow_verbosity; -set session log_slow_verbosity=7; -select @@session.log_slow_verbosity; - - -set session log_slow_verbosity='innodb'; -select @@session.log_slow_verbosity; -set session log_slow_verbosity='query_plan'; -select @@session.log_slow_verbosity; -set session log_slow_verbosity='innodb,query_plan'; -select @@session.log_slow_verbosity; -set session log_slow_verbosity='explain'; -select @@session.log_slow_verbosity; -set session log_slow_verbosity='innodb,query_plan,explain'; -select @@session.log_slow_verbosity; -set session log_slow_verbosity=''; -select @@session.log_slow_verbosity; - -# -# incorrect types/values -# ---error ER_WRONG_TYPE_FOR_VAR -set session log_slow_verbosity=1.1; ---error ER_WRONG_TYPE_FOR_VAR -set session log_slow_verbosity=1e1; ---error ER_WRONG_VALUE_FOR_VAR -set session log_slow_verbosity="foo"; ---error ER_WRONG_VALUE_FOR_VAR -set session log_slow_verbosity=8; - -SET @@global.log_slow_verbosity = @start_global_value; diff --git a/mysql-test/suite/sys_vars/t/max_insert_delayed_threads_basic.test b/mysql-test/suite/sys_vars/t/max_insert_delayed_threads_basic.test deleted file mode 100644 index 3646743a9aef1..0000000000000 --- a/mysql-test/suite/sys_vars/t/max_insert_delayed_threads_basic.test +++ /dev/null @@ -1,222 +0,0 @@ -############## mysql-test\t\max_insert_delayed_threads_basic.test ############### -# # -# Variable Name: max_insert_delayed_threads # -# Scope: GLOBAL | SESSION # -# Access Type: Dynamic # -# Data Type: numeric # -# Default Value: 20 # -# Range: 0-16384 # -# # -# # -# Creation Date: 2008-02-07 # -# Author: Salman # -# # -# Description: Test Cases of Dynamic System Variable max_insert_delayed_threads # -# that checks the behavior of this variable in the following ways# -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -############################################################################### - ---source include/load_sysvars.inc - -################################################################## -# START OF max_insert_delayed_threads TESTS # -################################################################## - - -############################################################# -# Save initial value # -############################################################# - -SET @start_global_value = @@global.max_insert_delayed_threads; -SELECT @start_global_value; -SET @start_session_value = @@session.max_insert_delayed_threads; -SELECT @start_session_value; - - ---echo '#--------------------FN_DYNVARS_075_01-------------------------#' -################################################################## -# Display the DEFAULT value of max_insert_delayed_threads # -################################################################## - -SET @@global.max_insert_delayed_threads = 1000; -SET @@global.max_insert_delayed_threads = DEFAULT; -SELECT @@global.max_insert_delayed_threads; - ---Error ER_WRONG_VALUE_FOR_VAR -SET @@session.max_insert_delayed_threads = 1000; -SET @@session.max_insert_delayed_threads = DEFAULT; -SELECT @@session.max_insert_delayed_threads; - - ---echo '#--------------------FN_DYNVARS_075_02-------------------------#' -################################################################## -# Check the DEFAULT value of max_insert_delayed_threads # -################################################################## - -SET @@global.max_insert_delayed_threads = DEFAULT; -SELECT @@global.max_insert_delayed_threads = 20; - -SET @@session.max_insert_delayed_threads = DEFAULT; -SELECT @@session.max_insert_delayed_threads = 20; - - ---echo '#--------------------FN_DYNVARS_075_03-------------------------#' -############################################################################ -# Change the value of max_insert_delayed_threads to a valid value for GLOBAL Scope # -############################################################################ - -SET @@global.max_insert_delayed_threads = 1; -SELECT @@global.max_insert_delayed_threads; -SET @@global.max_insert_delayed_threads = 1025; -SELECT @@global.max_insert_delayed_threads; -SET @@global.max_insert_delayed_threads = 0; -SELECT @@global.max_insert_delayed_threads; -SET @@global.max_insert_delayed_threads = 16384; -SELECT @@global.max_insert_delayed_threads; -SET @@global.max_insert_delayed_threads = 16383; -SELECT @@global.max_insert_delayed_threads; - ---echo '#--------------------FN_DYNVARS_075_04-------------------------#' -############################################################################# -# Change the value of max_insert_delayed_threads to a valid value for SESSION Scope # -############################################################################# - ---Error ER_WRONG_VALUE_FOR_VAR -SET @@session.max_insert_delayed_threads = 1; -SELECT @@session.max_insert_delayed_threads; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@session.max_insert_delayed_threads = 1025; -SELECT @@session.max_insert_delayed_threads; - -SET @@session.max_insert_delayed_threads = 0; -SELECT @@session.max_insert_delayed_threads; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@session.max_insert_delayed_threads = 16384; -SELECT @@session.max_insert_delayed_threads; - -SET @@session.max_insert_delayed_threads = 16383; -SELECT @@session.max_insert_delayed_threads; - - ---echo '#------------------FN_DYNVARS_075_05-----------------------#' -############################################################## -# Change the value of max_insert_delayed_threads to an invalid value # -############################################################## - -SET @@global.max_insert_delayed_threads = -1024; -SELECT @@global.max_insert_delayed_threads; -SET @@global.max_insert_delayed_threads = -1; -SELECT @@global.max_insert_delayed_threads; -SET @@global.max_insert_delayed_threads = 16385; -SELECT @@global.max_insert_delayed_threads; ---Error ER_WRONG_TYPE_FOR_VAR -SET @@global.max_insert_delayed_threads = 65530.34; -SELECT @@global.max_insert_delayed_threads; ---Error ER_WRONG_TYPE_FOR_VAR -SET @@global.max_insert_delayed_threads = test; -SELECT @@global.max_insert_delayed_threads; -SET @@session.max_insert_delayed_threads = 16385; -SELECT @@session.max_insert_delayed_threads; -SET @@session.max_insert_delayed_threads = -1; -SELECT @@session.max_insert_delayed_threads; -SET @@session.max_insert_delayed_threads = -2; -SELECT @@session.max_insert_delayed_threads; ---Error ER_WRONG_TYPE_FOR_VAR -SET @@session.max_insert_delayed_threads = 65530.34; -SET @@session.max_insert_delayed_threads = 10737418241; -SELECT @@session.max_insert_delayed_threads; - - ---Error ER_WRONG_TYPE_FOR_VAR -SET @@session.max_insert_delayed_threads = test; -SELECT @@session.max_insert_delayed_threads; - - ---echo '#------------------FN_DYNVARS_075_06-----------------------#' -#################################################################### -# Check if the value in GLOBAL Table matches value in variable # -#################################################################### - - -SELECT @@global.max_insert_delayed_threads = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='max_insert_delayed_threads'; - ---echo '#------------------FN_DYNVARS_075_07-----------------------#' -#################################################################### -# Check if the value in SESSION Table matches value in variable # -#################################################################### - -SELECT @@session.max_insert_delayed_threads = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='max_insert_delayed_threads'; - - ---echo '#------------------FN_DYNVARS_075_08-----------------------#' -#################################################################### -# Check if TRUE and FALSE values can be used on variable # -#################################################################### - -SET @@global.max_insert_delayed_threads = TRUE; -SELECT @@global.max_insert_delayed_threads; -SET @@global.max_insert_delayed_threads = FALSE; -SELECT @@global.max_insert_delayed_threads; - - ---echo '#---------------------FN_DYNVARS_001_09----------------------#' -################################################################################# -# Check if accessing variable with and without GLOBAL point to same variable # -################################################################################# - -SET @@global.max_insert_delayed_threads = 2048; -SELECT @@max_insert_delayed_threads = @@global.max_insert_delayed_threads; - - ---echo '#---------------------FN_DYNVARS_001_10----------------------#' -######################################################################################################## -# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # -######################################################################################################## - ---Error ER_WRONG_VALUE_FOR_VAR -SET @@max_insert_delayed_threads = 100000; -SELECT @@max_insert_delayed_threads = @@local.max_insert_delayed_threads; -SELECT @@local.max_insert_delayed_threads = @@session.max_insert_delayed_threads; - - ---echo '#---------------------FN_DYNVARS_001_11----------------------#' -############################################################################# -# Check if max_insert_delayed_threads can be accessed with and without @@ sign # -############################################################################# - ---Error ER_WRONG_VALUE_FOR_VAR -SET max_insert_delayed_threads = 1024; -SELECT @@max_insert_delayed_threads; ---Error ER_UNKNOWN_TABLE -SELECT local.max_insert_delayed_threads; ---Error ER_UNKNOWN_TABLE -SELECT session.max_insert_delayed_threads; ---Error ER_BAD_FIELD_ERROR -SELECT max_insert_delayed_threads = @@session.max_insert_delayed_threads; - - -#################################### -# Restore initial value # -#################################### - -SET @@global.max_insert_delayed_threads = @start_global_value; -SELECT @@global.max_insert_delayed_threads; -SET @@session.max_insert_delayed_threads = @start_session_value; -SELECT @@session.max_insert_delayed_threads; - - -####################################################### -# END OF max_insert_delayed_threads TESTS # -####################################################### - diff --git a/mysql-test/suite/sys_vars/t/read_only_func.test b/mysql-test/suite/sys_vars/t/read_only_func.test index bc3991aee7c13..64141e3f91d0d 100644 --- a/mysql-test/suite/sys_vars/t/read_only_func.test +++ b/mysql-test/suite/sys_vars/t/read_only_func.test @@ -81,6 +81,7 @@ select * from t1 where id=1; --echo ** Creating new user with out super privilege** CREATE user sameea; +grant all on test.* to sameea; CONNECT (connn,localhost,sameea,,); --Error ER_SPECIFIC_ACCESS_DENIED_ERROR diff --git a/mysql-test/suite/sys_vars/t/read_only_grant.test b/mysql-test/suite/sys_vars/t/read_only_grant.test index d6abef93aed50..9e82f30c9259c 100644 --- a/mysql-test/suite/sys_vars/t/read_only_grant.test +++ b/mysql-test/suite/sys_vars/t/read_only_grant.test @@ -4,11 +4,11 @@ --echo # MDEV-21960 Bind READ_ONLY ADMIN to @@read_only --echo # ---echo # Test that "SET read_only" is not allowed without READ_ONLY ADMIN or SUPER +--echo # Test that "SET read_only" is not allowed without READ_ONLY ADMIN CREATE USER user1@localhost; GRANT ALL PRIVILEGES ON *.* TO user1@localhost; -REVOKE READ_ONLY ADMIN, SUPER ON *.* FROM user1@localhost; +REVOKE READ_ONLY ADMIN ON *.* FROM user1@localhost; --connect(user1,localhost,user1,,) --connection user1 --error ER_SPECIFIC_ACCESS_DENIED_ERROR @@ -36,17 +36,10 @@ SET SESSION read_only=0; --connection default DROP USER user1@localhost; ---echo # Test that "SET read_only" is allowed with SUPER - -CREATE USER user1@localhost; -GRANT SUPER ON *.* TO user1@localhost; ---connect(user1,localhost,user1,,) ---connection user1 -SET GLOBAL read_only=0; ---error ER_GLOBAL_VARIABLE -SET read_only=0; ---error ER_GLOBAL_VARIABLE -SET SESSION read_only=0; ---disconnect user1 ---connection default -DROP USER user1@localhost; +--echo # +--echo # MDEV-29632 SUPER users created before 10.11 should retain READ_ONLY ADMIN privilege upon upgrade +--echo # +insert mysql.global_priv values ('bar', 'foo', '{"access":32768,"version_id":101000,"plugin":"mysql_native_password","authentication_string":""}'); +flush privileges; +show grants for foo@bar; +drop user foo@bar; diff --git a/mysql-test/suite/sys_vars/t/replicate_rewrite_db.opt b/mysql-test/suite/sys_vars/t/replicate_rewrite_db.opt new file mode 100644 index 0000000000000..27468051e624c --- /dev/null +++ b/mysql-test/suite/sys_vars/t/replicate_rewrite_db.opt @@ -0,0 +1,3 @@ +"--replicate-rewrite-db=test->rewrite" +"--replicate-rewrite-db= mysqltest1 -> test" +"--replicate-rewrite-db=a -> b" diff --git a/mysql-test/suite/sys_vars/t/replicate_rewrite_db.test b/mysql-test/suite/sys_vars/t/replicate_rewrite_db.test new file mode 100644 index 0000000000000..7fbaab1f2609f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/replicate_rewrite_db.test @@ -0,0 +1,84 @@ +--source include/not_embedded.inc + +--echo # +--echo # MDEV-15530: Variable replicate_rewrite_db +--echo # cannot be found in "show global variables" +--echo # + +SET @save_replicate_rewrite_db = @@GLOBAL.replicate_rewrite_db; +SELECT @save_replicate_rewrite_db; + +--echo # Test session/Scope (it is global variable) + +select @@global.replicate_rewrite_db; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@SESSION.replicate_rewrite_db; +--error ER_GLOBAL_VARIABLE +SET @@SESSION.replicate_rewrite_db = ""; +show global variables like 'replicate_rewrite_db'; +show session variables like 'replicate_rewrite_db'; +select * from information_schema.global_variables where variable_name='replicate_rewrite_db'; +select * from information_schema.session_variables where variable_name='replicate_rewrite_db'; + +--echo # Incorrect type + +--error ER_WRONG_TYPE_FOR_VAR +SET @@GLOBAL.replicate_rewrite_db=1; +--error ER_WRONG_ARGUMENTS +SET @@GLOBAL.replicate_rewrite_db="->"; +--error ER_WRONG_ARGUMENTS +SET @@GLOBAL.replicate_rewrite_db=" "; +--error ER_WRONG_ARGUMENTS +SET @@GLOBAL.replicate_rewrite_db="a->"; +--error ER_WRONG_ARGUMENTS +SET @@GLOBAL.replicate_rewrite_db="->b"; + +--echo # Check arguments + +--error ER_GLOBAL_VARIABLE +set session replicate_rewrite_db=1; +--error ER_WRONG_TYPE_FOR_VAR +set global replicate_rewrite_db=1; +--error ER_GLOBAL_VARIABLE +SET @@SESSION.replicate_do_db = ""; +# This should work +SET @@GLOBAL.replicate_rewrite_db=""; +SELECT @@GLOBAL.replicate_rewrite_db; +SET @@GLOBAL.replicate_rewrite_db=null; +SELECT @@GLOBAL.replicate_rewrite_db; +SET @@GLOBAL.replicate_rewrite_db=DEFAULT; +SELECT @@GLOBAL.replicate_rewrite_db; +SET @@GLOBAL.replicate_rewrite_db="db1->db3"; +SELECT @@GLOBAL.replicate_rewrite_db; +SET @@GLOBAL.replicate_rewrite_db="db2 ->db4"; +SELECT @@GLOBAL.replicate_rewrite_db; +SET @@GLOBAL.replicate_rewrite_db=" db5 ->db7 "; +SELECT @@GLOBAL.replicate_rewrite_db; +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_rewrite_db'; +select * from information_schema.session_variables where variable_name='replicate_rewrite_db'; +show global variables like 'replicate_rewrite_db'; + +SET @@GLOBAL.replicate_rewrite_db="db1->db2, db3->db4"; +SELECT @@GLOBAL.replicate_rewrite_db; +SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_rewrite_db'; + +--echo # Check restart with appending the value +--let $restart_parameters = "--replicate_rewrite_db='X->Y'" +--source include/restart_mysqld.inc +SELECT @@GLOBAL.replicate_rewrite_db; + +--echo # Check restart with wrong value on CLI +--source include/shutdown_mysqld.inc +# Expect the server to fail to come up with these options +--let $args="--replicate_rewrite_db=x-" --log-warnings=1 --silent-startup --help --verbose +--error 1 +--exec $MYSQLD_CMD $args > $MYSQL_TMP_DIR/mysqld--replicate.txt 2> $MYSQL_TMP_DIR/mysqld--replicate.err +--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // +--cat_file $MYSQL_TMP_DIR/mysqld--replicate.err +# Restart the server with the default options +--let $restart_parameters = "" +--source include/start_mysqld.inc +SELECT @@GLOBAL.replicate_rewrite_db; + +--echo # Cleanup. +SET @@GLOBAL.replicate_rewrite_db = @save_replicate_rewrite_db; diff --git a/mysql-test/suite/sys_vars/t/slow_launch_time_basic.test b/mysql-test/suite/sys_vars/t/slow_launch_time_basic.test deleted file mode 100644 index 71b251855498f..0000000000000 --- a/mysql-test/suite/sys_vars/t/slow_launch_time_basic.test +++ /dev/null @@ -1,172 +0,0 @@ -############## mysql-test\t\slow_launch_time_basic.test ############### -# # -# Variable Name: slow_launch_time # -# Scope: GLOBAL # -# Access Type: Dynamic # -# Data Type: numeric # -# Default Value: 2 # -# Range: - # -# # -# # -# Creation Date: 2008-02-07 # -# Author: Salman # -# # -# Description: Test Cases of Dynamic System Variable slow_launch_time # -# that checks the behavior of this variable in the following ways# -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -############################################################################### - ---source include/load_sysvars.inc -######################################################################## -# START OF slow_launch_time TESTS # -######################################################################## - - -######################################################################## -# Saving initial value of slow_launch_time in a temporary variable # -######################################################################## - -SET @start_value = @@global.slow_launch_time; -SELECT @start_value; - - ---echo '#--------------------FN_DYNVARS_150_01------------------------#' -######################################################################## -# Display the DEFAULT value of slow_launch_time # -######################################################################## - -SET @@global.slow_launch_time = 99; -SET @@global.slow_launch_time = DEFAULT; -SELECT @@global.slow_launch_time; - - ---echo '#---------------------FN_DYNVARS_150_02-------------------------#' -############################################### -# Verify default value of variable # -############################################### - -SET @@global.slow_launch_time = @start_value; -SELECT @@global.slow_launch_time = 2; - - ---echo '#--------------------FN_DYNVARS_150_03------------------------#' -######################################################################## -# Change the value of slow_launch_time to a valid value # -######################################################################## - -SET @@global.slow_launch_time = 0; -SELECT @@global.slow_launch_time; -SET @@global.slow_launch_time = 1; -SELECT @@global.slow_launch_time; -SET @@global.slow_launch_time = 31536000; -SELECT @@global.slow_launch_time; -SET @@global.slow_launch_time = 31535999; -SELECT @@global.slow_launch_time; -SET @@global.slow_launch_time = 65536; -SELECT @@global.slow_launch_time; - ---echo '#--------------------FN_DYNVARS_150_04-------------------------#' -########################################################################### -# Change the value of slow_launch_time to invalid value # -########################################################################### - -SET @@global.slow_launch_time = -1; -SELECT @@global.slow_launch_time; -SET @@global.slow_launch_time = 31536001; -SELECT @@global.slow_launch_time; -SET @@global.slow_launch_time = 10240022115; -SELECT @@global.slow_launch_time; ---Error ER_WRONG_TYPE_FOR_VAR -SET @@global.slow_launch_time = 10000.01; -SELECT @@global.slow_launch_time; -SET @@global.slow_launch_time = -1024; -SELECT @@global.slow_launch_time; -SET @@global.slow_launch_time = 42949672950; -SELECT @@global.slow_launch_time; - ---Error ER_WRONG_TYPE_FOR_VAR -SET @@global.slow_launch_time = ON; -SELECT @@global.slow_launch_time; ---Error ER_WRONG_TYPE_FOR_VAR -SET @@global.slow_launch_time = 'test'; -SELECT @@global.slow_launch_time; - - ---echo '#-------------------FN_DYNVARS_150_05----------------------------#' -########################################################################### -# Test if accessing session slow_launch_time gives error # -########################################################################### - ---Error ER_GLOBAL_VARIABLE -SET @@session.slow_launch_time = 0; -SELECT @@slow_launch_time; - - ---echo '#----------------------FN_DYNVARS_150_06------------------------#' -############################################################################## -# Check if the value in GLOBAL & SESSION Tables matches values in variable # -############################################################################## - -SELECT @@global.slow_launch_time = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='slow_launch_time'; - -SELECT @@slow_launch_time = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='slow_launch_time'; - - ---echo '#---------------------FN_DYNVARS_150_07----------------------#' -################################################################### -# Check if TRUE and FALSE values can be used on variable # -################################################################### - -SET @@global.slow_launch_time = TRUE; -SELECT @@global.slow_launch_time; -SET @@global.slow_launch_time = FALSE; -SELECT @@global.slow_launch_time; - - ---echo '#---------------------FN_DYNVARS_150_08----------------------#' -######################################################################################################## -# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # -######################################################################################################## - -SET @@global.slow_launch_time = 1; -SELECT @@slow_launch_time = @@global.slow_launch_time; - - ---echo '#---------------------FN_DYNVARS_150_09----------------------#' -########################################################################## -# Check if slow_launch_time can be accessed with and without @@ sign # -########################################################################## - ---Error ER_GLOBAL_VARIABLE -SET slow_launch_time = 1; -SELECT @@slow_launch_time; ---Error ER_UNKNOWN_TABLE -SELECT local.slow_launch_time; ---Error ER_UNKNOWN_TABLE -SELECT global.slow_launch_time; ---Error ER_BAD_FIELD_ERROR -SELECT slow_launch_time = @@session.slow_launch_time; - - -############################## -# Restore initial value # -############################## - -SET @@global.slow_launch_time = @start_value; -SELECT @@global.slow_launch_time; - - -######################################################################## -# END OF slow_launch_time TESTS # -######################################################################## diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_basic.test deleted file mode 100644 index 3d58902ab8d03..0000000000000 --- a/mysql-test/suite/sys_vars/t/slow_query_log_basic.test +++ /dev/null @@ -1,167 +0,0 @@ -##################### mysql-test\t\slow_query_log_basic.test ################### -# # -# Variable Name: slow_query_log # -# Scope: GLOBAL # -# Access Type: Dynamic # -# Data Type: BOOLEAN # -# Default Value: OFF # -# Valid Values: ON, OFF # -# # -# # -# Creation Date: 2008-03-16 # -# Author: Salman Rawala # -# # -# Description: Test Cases of Dynamic System Variable "slow_query_log" # -# that checks behavior of this variable in the following ways # -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-options.html#option_mysqld_event-scheduler # -# # -################################################################################ - ---source include/load_sysvars.inc - -########################################################### -# START OF slow_query_log TESTS # -########################################################### - - -###################################################################### -# Saving initial value of slow_query_log in a temporary variable # -###################################################################### - -SET @start_value = @@global.slow_query_log; -SELECT @start_value; - - ---echo '#---------------------FN_DYNVARS_004_01-------------------------#' -############################################### -# Verify default value of variable # -############################################### - -SET @@global.slow_query_log = DEFAULT; -SELECT @@global.slow_query_log = 0; - - ---echo '#--------------------FN_DYNVARS_004_02------------------------#' -###################################################################### -# Change the value of slow_query_log to a valid value # -###################################################################### - -SET @@global.slow_query_log = ON; -SELECT @@global.slow_query_log; -SET @@global.slow_query_log = OFF; -SELECT @@global.slow_query_log; - ---echo '#--------------------FN_DYNVARS_004_03-------------------------#' -###################################################################### -# Change the value of slow_query_log to invalid value # -###################################################################### - ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = 2; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = -1; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = TRUEF; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = TRUE_F; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = FALSE0; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = OON; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = ONN; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = OOFF; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = 0FF; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = ' '; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = " "; ---Error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log = ''; - - ---echo '#-------------------FN_DYNVARS_004_04----------------------------#' -################################################################## -# Test that accessing session slow_query_log dows not give # -################################################################## - -SET @@global.slow_query_log = ON; -SET @@session.slow_query_log = ON; -SELECT @@session.slow_query_log; -SET @@session.slow_query_log = OFF; -SELECT @@session.slow_query_log; -SET @@global.slow_query_log = OFF; -SET @@session.slow_query_log = ON; - ---echo '#----------------------FN_DYNVARS_004_05------------------------#' -############################################################################## -# Check if the value in GLOBAL Tables matches values in variable # -############################################################################## - -SELECT IF(@@global.slow_query_log, "ON", "OFF") = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='slow_query_log'; - - ---echo '#---------------------FN_DYNVARS_004_06----------------------#' -################################################################ -# Check if 0 and 1 values can be used on variable # -################################################################ - -SET @@global.slow_query_log = 0; -SELECT @@global.slow_query_log; -SET @@global.slow_query_log = 1; -SELECT @@global.slow_query_log; - ---echo '#---------------------FN_DYNVARS_004_07----------------------#' -################################################################### -# Check if TRUE and FALSE values can be used on variable # -################################################################### - -SET @@global.slow_query_log = TRUE; -SELECT @@global.slow_query_log; -SET @@global.slow_query_log = FALSE; -SELECT @@global.slow_query_log; - ---echo '#---------------------FN_DYNVARS_004_08----------------------#' -############################################################################## -# Check if accessing variable with SESSION,LOCAL and without SCOPE points # -# to same session variable (doesn't) # -############################################################################## - -SET @@global.slow_query_log = ON; -SET @@local.slow_query_log = OFF; -SELECT @@slow_query_log = @@global.slow_query_log; - ---echo '#---------------------FN_DYNVARS_004_09----------------------#' -###################################################################### -# Check if slow_query_log can be accessed with and without @@ sign # -###################################################################### ---Error ER_UNKNOWN_TABLE -SELECT local.slow_query_log; ---Error ER_UNKNOWN_TABLE -SELECT global.slow_query_log; ---Error ER_BAD_FIELD_ERROR -SELECT slow_query_log = @@session.slow_query_log; - - - -############################## -# Restore initial value # -############################## - -SET @@global.slow_query_log = @start_value; -SELECT @@global.slow_query_log; - - -#################################################### -# END OF slow_query_log TESTS # -#################################################### diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic-master.opt b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic-master.opt deleted file mode 100644 index 2b6ac309d6c60..0000000000000 --- a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic-master.opt +++ /dev/null @@ -1 +0,0 @@ ---slow-query-log --slow-query-log-file=slowtest.log diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test deleted file mode 100644 index 87a3e671b951c..0000000000000 --- a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test +++ /dev/null @@ -1,86 +0,0 @@ -################### mysql-test\t\slow_query_log_file_basic.test ################ -# # -# Variable Name: slow_query_log_file # -# Scope: GLOBAL # -# Access Type: Dynamic # -# Data Type: Filename # -# Default Value: host_name-slow.log # -# Valid Values: # -# # -# # -# Creation Date: 2008-03-16 # -# Author: Salman Rawala # -# Modified: HHunger 2008-09-11 set system var back to start value # -# # -# Description: Test Cases of Dynamic System Variable "slow_query_log_file" # -# that checks behavior of this variable in the following ways # -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: # -# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html -# # -################################################################################ - ---source include/load_sysvars.inc - -########################################################### -# START OF slow_query_log_file TESTS # -########################################################### - - -########################################################################### -# Saving initial value of slow_query_log_file in a temporary variable # -########################################################################### - -SET @start_value = @@global.slow_query_log_file; - ---echo '#---------------------FN_DYNVARS_004_01-------------------------#' -############################################### -# Verify default value of variable # -############################################### - -SET @@global.slow_query_log_file = DEFAULT; -SELECT length(@@global.slow_query_log_file) > 0; - - ---echo '#--------------------FN_DYNVARS_004_02------------------------#' -####################################################################### -# Change the value of slow_query_log_file to a invalid value # -####################################################################### - ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.slow_query_log_file = mytest.log; ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.slow_query_log_file = 12; - -# -# MDEV-10465 -# ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log_file = 'my.cnf'; ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.slow_query_log_file = '/tmp/my.cnf'; ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.general_log_file = '.my.cnf'; ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.general_log_file = 'my.cnf\0foo'; ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.general_log_file = 'my.ini'; - ---echo '#----------------------FN_DYNVARS_004_03------------------------#' -############################################################################## -# Check if the value in GLOBAL Tables matches values in variable # -############################################################################## - -SELECT @@global.slow_query_log_file = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='slow_query_log_file'; - -SET @@global.slow_query_log_file= @start_value; -##################################################### -# END OF slow_query_log_file TESTS # -##################################################### - diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test index 32420fc294a07..c83c7f186cf2b 100644 --- a/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test @@ -31,3 +31,10 @@ let $MYSQLD_DATADIR= `select @@datadir`; --file_exists $MYSQLD_DATADIR/my_slow_test.log --echo ## This case should pass because we have set this filename in opt file ## + +set @oldval= @@global.slow_query_log_file; +evalp set global log_slow_query_file='$MYSQLTEST_VARDIR/tmp/slow-7567.log'; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +select @@global.log_slow_query_file; +--file_exists $MYSQLTEST_VARDIR/tmp/slow-7567.log +set @@global.log_slow_query_file=@oldval; diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_func.test index 0c77dbff22676..8dcc0279e7295 100644 --- a/mysql-test/suite/sys_vars/t/slow_query_log_func.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test @@ -10,10 +10,10 @@ SET @@session.long_query_time=1; SET @@global.log_output = 'TABLE'; #========================================= ---echo '----When global.slow_query_log = OFF----' +--echo '----When global.log_slow_query = OFF----' #========================================= -SET @@global.slow_query_log = OFF; +SET @@global.log_slow_query = OFF; TRUNCATE mysql.slow_log; # The sleep is the slow query SELECT sleep(2); @@ -32,10 +32,10 @@ SELECT sleep(2); SELECT count(*) > 0 FROM mysql.slow_log; #========================================= ---echo '----When local.slow_query_log = OFF-----' +--echo '----When local.log_slow_query = OFF-----' #========================================= -SET @@local.slow_query_log = OFF; +SET @@local.log_slow_query = OFF; TRUNCATE mysql.slow_log; # The sleep is the slow query SELECT sleep(2); diff --git a/mysql-test/suite/versioning/r/binlog.result b/mysql-test/suite/versioning/r/binlog.result new file mode 100644 index 0000000000000..fffd76298875e --- /dev/null +++ b/mysql-test/suite/versioning/r/binlog.result @@ -0,0 +1,57 @@ +# +# MDEV-29741 SHOW BINLOG EVENTS shows garbage with system_versioning_insert_history=on +# MDEV-29732 mysqlbinlog produces syntactically incorrect output with system_versioning_insert_history +# +reset master; +set timestamp=1000000000; +create table t (a int) with system versioning; +set system_versioning_insert_history= on; +insert into t (a) values (1); +set system_versioning_insert_history= off; +drop table t; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create table t (a int) with system versioning +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; set @@system_versioning_insert_history=1; insert into t (a) values (1) +master-bin.000001 # Query # # set @@system_versioning_insert_history=1; COMMIT +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t` /* generated by server */ +flush binary logs; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; +/*!40019 SET @@session.max_delayed_threads=0*/; +/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; +DELIMITER /*!*/; +ROLLBACK/*!*/; +use `test`/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/; +SET @@session.sql_mode=1411383296/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +create table t (a int) with system versioning +/*!*/; +START TRANSACTION +/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.system_versioning_insert_history=1/*!*/; +insert into t (a) values (1) +/*!*/; +SET TIMESTAMP=1000000000/*!*/; +COMMIT +/*!*/; +SET TIMESTAMP=1000000000/*!*/; +SET @@session.system_versioning_insert_history=0/*!*/; +DROP TABLE `t` /* generated by server */ +/*!*/; +DELIMITER ; +# End of log file +ROLLBACK /* added by mysqlbinlog */; +/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; +/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/; +set timestamp=default; diff --git a/mysql-test/suite/versioning/r/create.result b/mysql-test/suite/versioning/r/create.result index 5e68d4df2e82e..c9d68f15e575a 100644 --- a/mysql-test/suite/versioning/r/create.result +++ b/mysql-test/suite/versioning/r/create.result @@ -1,4 +1,3 @@ -drop table if exists t1; create table t1 ( x1 int unsigned, Sys_start SYS_DATATYPE as row start invisible comment 'start', @@ -266,8 +265,8 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `y` int(11) DEFAULT NULL, - `st` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `en` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' + `st` timestamp(6) NOT NULL, + `en` timestamp(6) NOT NULL ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ## For versioned table insert into t1 values (1); @@ -296,8 +295,8 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `y` int(11) DEFAULT NULL, - `st` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `en` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' + `st` timestamp(6) NOT NULL, + `en` timestamp(6) NOT NULL ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING select * from t3 where y > 2; y st en @@ -385,8 +384,8 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `x25` int(11) DEFAULT NULL, - `row_start` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `row_end` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' + `row_start` timestamp(6) NOT NULL, + `row_end` timestamp(6) NOT NULL ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t2 with system versioning as select x25, row_start rs, row_end re from t1; @@ -394,8 +393,8 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `x25` int(11) DEFAULT NULL, - `rs` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `re` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' + `rs` timestamp(6) NOT NULL, + `re` timestamp(6) NOT NULL ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 ( x26 int, @@ -409,8 +408,8 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `x26` int(11) DEFAULT NULL, - `st` bigint(20) unsigned NOT NULL DEFAULT 0, - `en` bigint(20) unsigned NOT NULL DEFAULT 0 + `st` bigint(20) unsigned NOT NULL, + `en` bigint(20) unsigned NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING create or replace table t1 (x27 int, id int) with system versioning engine NON_DEFAULT_ENGINE; create or replace table t2 (b int, id int); @@ -421,8 +420,8 @@ Table Create Table t3 CREATE TABLE `t3` ( `b` int(11) DEFAULT NULL, `x27` int(11) DEFAULT NULL, - `rs` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `re` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' + `rs` timestamp(6) NOT NULL, + `re` timestamp(6) NOT NULL ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING ## Errors create or replace temporary table t (x28 int) with system versioning; @@ -458,10 +457,10 @@ Table Create Table t3 CREATE TABLE `t3` ( `x30` int(11) DEFAULT NULL, `y` int(11) DEFAULT NULL, - `row_start` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `row_end` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `st` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `en` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' + `row_start` timestamp(6) NOT NULL, + `row_end` timestamp(6) NOT NULL, + `st` timestamp(6) NOT NULL, + `en` timestamp(6) NOT NULL ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci create or replace table t3 ( y int, @@ -475,8 +474,8 @@ Table Create Table t3 CREATE TABLE `t3` ( `x30` int(11) DEFAULT NULL, `y` int(11) DEFAULT NULL, - `row_start` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', - `row_end` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + `row_start` timestamp(6) NOT NULL, + `row_end` timestamp(6) NOT NULL, `st` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, `en` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME (`st`, `en`) diff --git a/mysql-test/suite/versioning/r/data.result b/mysql-test/suite/versioning/r/data.result index 7fea6c3d06e64..c7fe141c19ecc 100644 --- a/mysql-test/suite/versioning/r/data.result +++ b/mysql-test/suite/versioning/r/data.result @@ -57,3 +57,152 @@ INSERT INTO `t1` VALUES #MYSQL_DUMP --compact --as-of="1990-08-04 00:00' where 'abc" test 2>&1 mariadb-dump: Incorrect DATETIME value: '1990-08-04 00:00' where 'abc' drop tables t1; +# +# MDEV-16029 mysqldump: dump and restore historical data +# +create or replace table t1 (x int) with system versioning; +set timestamp=unix_timestamp('2010-10-10 10:10:10.101010'); +insert into t1 values (1), (2); +set timestamp=unix_timestamp('2011-11-11 11:11:11.111111'); +delete from t1 where x = 1; +set timestamp=default; +select row_start, row_end into @s1, @e1 from t1 for system_time all where x = 1; +select row_start, row_end into @s2, @e2 from t1 for system_time all where x = 2; +create or replace table t2 ( +x int, +row_start timestamp(6) as row start invisible, +row_end timestamp(6) as row end invisible, +period for system_time (row_start, row_end)) +with system versioning; +create or replace function check_fields(x int, row_start timestamp(6), row_end timestamp(6)) +returns char(50) deterministic +return if (x = 1, +if (row_start = @s1 and row_end = @e1, '[CORRECT]', '[WRONG]'), +if (x = 2 and row_start = @s2 and row_end = @e2, '[CORRECT]', '[WRONG]')); +set @@system_versioning_insert_history= 1; +insert into t2 (x, row_start, row_end) select x, row_start, row_end from t1 for system_time all; +set @@system_versioning_insert_history= 0; +# t2 has the same data as t1 +select x, check_fields(x, row_start, row_end) from t2 for system_time all order by x; +x check_fields(x, row_start, row_end) +1 [CORRECT] +2 [CORRECT] +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */; +INSERT INTO `t1` (`x`, row_start, row_end) VALUES (1,'2010-10-10 10:10:10.101010','2011-11-11 11:11:11.111111'), +(2,'2010-10-10 10:10:10.101010','2038-01-19 03:14:07.999999'); +/*!101100 SET system_versioning_insert_history=@old_system_versioning_insert_history */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `x` int(11) DEFAULT NULL, + `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, + `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, + PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */; +INSERT INTO `t2` (`x`, `row_start`, `row_end`) VALUES (1,'2010-10-10 10:10:10.101010','2011-11-11 11:11:11.111111'), +(2,'2010-10-10 10:10:10.101010','2038-01-19 03:14:07.999999'); +/*!101100 SET system_versioning_insert_history=@old_system_versioning_insert_history */; +mariadb-dump: --dump-history can't be used with --as-of. +mariadb-dump: --dump-history can't be used with --replace. +mariadb-dump: --xml can't be used with --dump-history. +# SQL dump with/without history +## With history +drop tables t1, t2; +select x, check_fields(x, row_start, row_end) from t1 for system_time all order by x; +x check_fields(x, row_start, row_end) +1 [CORRECT] +2 [CORRECT] +select x, check_fields(x, row_start, row_end) from t2 for system_time all order by x; +x check_fields(x, row_start, row_end) +1 [CORRECT] +2 [CORRECT] +## Without history +drop tables t1, t2; +select x, check_row_ts(row_start, row_end) from t1 for system_time all order by x; +x check_row_ts(row_start, row_end) +2 CURRENT ROW +select x, check_row_ts(row_start, row_end) from t2 for system_time all order by x; +x check_row_ts(row_start, row_end) +2 CURRENT ROW +## History and --no-create-info --skip-comments +create or replace table t1 (x int) with system versioning; +delete from t2; +delete history from t2; +select x, check_fields(x, row_start, row_end) from t1 for system_time all order by x; +x check_fields(x, row_start, row_end) +1 [CORRECT] +2 [CORRECT] +select x, check_fields(x, row_start, row_end) from t2 for system_time all order by x; +x check_fields(x, row_start, row_end) +1 [CORRECT] +2 [CORRECT] +## compact +select x, check_fields(x, row_start, row_end) from t1 for system_time all order by x; +x check_fields(x, row_start, row_end) +1 [CORRECT] +2 [CORRECT] +select x, check_fields(x, row_start, row_end) from t2 for system_time all order by x; +x check_fields(x, row_start, row_end) +1 [CORRECT] +2 [CORRECT] +create or replace table t1 (x int) with system versioning; +# --tab with history +drop tables t1, t2; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `x` int(11) DEFAULT NULL, + `row_start` timestamp(6) GENERATED ALWAYS AS ROW START INVISIBLE, + `row_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE, + PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +set @@system_versioning_insert_history= 1; +load data infile 'tmp/t1.txt' into table t1 (x, row_start, row_end); +load data infile 'tmp/t2.txt' into table t2 (x, row_start, row_end); +set @@system_versioning_insert_history= 0; +select *, check_row_ts(row_start, row_end) from t1 for system_time all; +x check_row_ts(row_start, row_end) +1 HISTORICAL ROW +2 CURRENT ROW +select *, check_row_ts(row_start, row_end) from t2 for system_time all; +x check_row_ts(row_start, row_end) +1 HISTORICAL ROW +2 CURRENT ROW +drop tables t1, t2; +drop function check_fields; +# +# MDEV-29730 mysqldump --dump-history creates broken dump if there are precision-versioned tables +# +create table t1 (x int, +rs BIGINT unsigned as row start, re BiGiNt unsigned as row end, +period for system_time (rs,re)) with system versioning engine=innodb; +insert t1 (x) values (1); +insert t1 (x) values (2); +delete from t1 where x=1; +mariadb-dump: Cannot use --dump-history for table `t1` with transaction-precise history +mariadb-dump: Cannot use --dump-history for table `t1` with transaction-precise history +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL, + `rs` bigint(20) unsigned GENERATED ALWAYS AS ROW START, + `re` bigint(20) unsigned GENERATED ALWAYS AS ROW END, + PERIOD FOR SYSTEM_TIME (`rs`, `re`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t1` VALUES +(2,XXX,18446744073709551615); +drop table t1; diff --git a/mysql-test/suite/versioning/r/insert.result b/mysql-test/suite/versioning/r/insert.result index 2645d0184e8dc..442d71c6a9167 100644 --- a/mysql-test/suite/versioning/r/insert.result +++ b/mysql-test/suite/versioning/r/insert.result @@ -112,3 +112,210 @@ x y 9 9001 drop table t1; drop table t2; +# +# MDEV-16546 System versioning setting to allow history modification +# +set @@session.time_zone='+00:00'; +create table t1(x int primary key) with system versioning; +create table t2(y int primary key, +row_start timestamp(6) as row start invisible, +row_end timestamp(6) as row end invisible, +period for system_time (row_start, row_end)) +with system versioning; +create table t3(z int primary key, +row_start timestamp(6) as row start, +row_end timestamp(6) as row end, +period for system_time (row_start, row_end)) +with system versioning; +insert into t1(x, row_start, row_end) values (2, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR 42S22: Unknown column 'row_start' in 'field list' +insert into t2(y, row_start, row_end) values (2, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR HY000: The value specified for generated column 'row_start' in table 't2' has been ignored +set @@system_versioning_insert_history= 1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) NOT NULL, + PRIMARY KEY (`x`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +insert into t1(x, row_start, row_end) values (3, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +insert into t2(y, row_start, row_end) values (4, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +insert into t3 values (5, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +insert into t3 values (5, '1980-01-02 00:00:00', '1980-01-01 00:00:01'); +ERROR HY000: Incorrect row_start value: '1980-01-02 00:00:00.000000' +select x, row_start, row_end from t1 for system_time all; +x row_start row_end +3 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000 +select y, row_start, row_end from t2 for system_time all; +y row_start row_end +4 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000 +select z, row_start, row_end from t3 for system_time all; +z row_start row_end +5 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000 +insert into t1(x) values (1); +insert into t2(y) values (1); +update t1 set x= x + 1; +update t1 set row_start= '1971-01-01 00:00:00'; +ERROR 42S22: Unknown column 'row_start' in 'field list' +update t2 set row_start= '1971-01-01 00:00:00'; +ERROR HY000: The value specified for generated column 'row_start' in table 't2' has been ignored +insert t1 (x) values (2) on duplicate key update x= 3, row_end= '1970-01-01 00:00:00'; +ERROR 42S22: Unknown column 'row_end' in 'field list' +insert t2 (y) values (1) on duplicate key update y= 3, row_end= '1970-01-01 00:00:00'; +ERROR HY000: The value specified for generated column 'row_end' in table 't2' has been ignored +insert t2 (y,row_end) values (1, '1970-01-01 00:00:00') on duplicate key update y= 3; +ERROR HY000: The value specified for generated column 'row_end' in table 't2' has been ignored +insert into t1 values (4); +insert into t1 set x= 5, row_start= '1980-01-01 00:00:00', row_end= '1980-01-01 00:00:01'; +insert into t1(x, row_start, row_end) values (6, '1980-01-01 00:00:01', '1980-01-01 00:00:00'); +ERROR HY000: Incorrect row_start value: '1980-01-01 00:00:01.000000' +insert into t1(x, row_start, row_end) values (7, '1980-01-01 00:00:11', '1980-01-01 00:00:11'); +ERROR HY000: Incorrect row_start value: '1980-01-01 00:00:11.000000' +insert into t1(x, row_start) values (8, '1980-01-01 00:00:22'); +insert into t1(x, row_end) values (9, '1980-01-01 00:00:33'); +ERROR HY000: Incorrect row_start value: 'now' +insert into t1(x, row_end) values (10, TIMESTAMP'2038-01-19 03:14:07.999999'); +select x, check_row_ts(row_start, row_end) from t1 for system_time all order by x; +x check_row_ts(row_start, row_end) +1 HISTORICAL ROW +2 CURRENT ROW +3 HISTORICAL ROW +4 CURRENT ROW +5 HISTORICAL ROW +8 CURRENT ROW +10 CURRENT ROW +select x, row_start, row_end from t1 for system_time all +where x > 1 and row_end < TIMESTAMP'2038-01-19 03:14:07.999999' order by x, row_start, row_end; +x row_start row_end +3 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000 +5 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000 +# Direct insert is not possible for TRX_ID versioning +create or replace table t2(y int primary key, +row_start bigint unsigned as row start, +row_end bigint unsigned as row end, +period for system_time (row_start, row_end)) +with system versioning engine innodb; +insert into t2(y, row_start, row_end) values (0, 1, 2); +ERROR HY000: The value specified for generated column 'row_start' in table 't2' has been ignored +set @@system_versioning_insert_history= 0; +## INSERT..SELECT +create or replace table t2 like t1; +set @@system_versioning_insert_history= 1; +insert into t2 (x, row_start, row_end) select x, row_start, row_end from t1 for system_time all; +select x, check_row_ts(row_start, row_end) from t2 for system_time all order by x; +x check_row_ts(row_start, row_end) +1 HISTORICAL ROW +2 CURRENT ROW +3 HISTORICAL ROW +4 CURRENT ROW +5 HISTORICAL ROW +8 CURRENT ROW +10 CURRENT ROW +select x, row_start, row_end from t2 for system_time all +where x > 1 and row_end < TIMESTAMP'2038-01-19 03:14:07.999999' order by x, row_start, row_end; +x row_start row_end +3 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000 +5 1980-01-01 00:00:00.000000 1980-01-01 00:00:01.000000 +set @@system_versioning_insert_history= 0; +# REPLACE / REPLACE .. SELECT +create or replace table t2(a int primary key, +row_start timestamp(6) as row start invisible, +row_end timestamp(6) as row end invisible, +period for system_time (row_start, row_end)) +with system versioning; +replace into t2 (a, row_start, row_end) values (1, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR HY000: The value specified for generated column 'row_start' in table 't2' has been ignored +replace into t2 (a, row_start, row_end) select x, row_start, row_end from t1; +ERROR HY000: The value specified for generated column 'row_start' in table 't2' has been ignored +create or replace table t2 (a int primary key) with system versioning; +replace into t2 (a, row_start, row_end) values (1, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR 42S22: Unknown column 'row_start' in 'field list' +replace into t2 (a, row_start, row_end) select x, row_start, row_end from t1; +ERROR 42S22: Unknown column 'row_start' in 'field list' +set @@system_versioning_insert_history= 1; +# REPLACE ignores system_versioning_insert_history +replace into t2 (a, row_end) values (0, '1980-01-01 00:00:00'); +ERROR 42S22: Unknown column 'row_end' in 'field list' +replace into t3 (z, row_start) values (0, '1980-01-01 00:00:00'); +ERROR HY000: The value specified for generated column 'row_start' in table 't3' has been ignored +replace into t3 values (0, '1980-01-01 00:00:00', '1981-01-01 00:00:00'); +ERROR HY000: The value specified for generated column 'row_start' in table 't3' has been ignored +# LOAD DATA +select x, row_start, row_end into outfile 'DATAFILE' from t1 for system_time all; +create or replace table t2 like t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `x` int(11) NOT NULL, + PRIMARY KEY (`x`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +set @@system_versioning_insert_history= 1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `x` int(11) NOT NULL, + PRIMARY KEY (`x`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +load data infile 'DATAFILE' into table t2 (x, row_start, row_end); +select x, check_row_ts(row_start, row_end) from t2 for system_time all order by x; +x check_row_ts(row_start, row_end) +1 HISTORICAL ROW +2 CURRENT ROW +3 HISTORICAL ROW +4 CURRENT ROW +5 HISTORICAL ROW +8 CURRENT ROW +10 CURRENT ROW +select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t2 for system_time all where x = 3; +row_start = '1980-01-01 00:00:00' row_end = '1980-01-01 00:00:01' +1 1 +# Honor secure_timestamp option +# restart: --secure-timestamp=YES +set @@system_versioning_insert_history= 1; +insert into t3(z, row_start, row_end) values (8, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement +insert into t3 values (8, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR HY000: The MariaDB server is running with the --secure-timestamp=YES option so it cannot execute this statement +# restart: --secure-timestamp=REPLICATION +create user nobody; +grant all privileges on test.* to nobody; +set @@system_versioning_insert_history= 1; +insert into test.t3(z, row_start, row_end) values (9, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR 42000: Access denied; you need (at least one of) the BINLOG REPLAY privilege(s) for this operation +insert into test.t3 values (9, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR 42000: Access denied; you need (at least one of) the BINLOG REPLAY privilege(s) for this operation +# restart: --secure-timestamp=SUPER +set @@system_versioning_insert_history= 1; +insert into test.t3(z, row_start, row_end) values (10, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +set @@system_versioning_insert_history= 1; +insert into test.t3(z, row_start, row_end) values (7, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR 42000: Access denied; you need (at least one of) the SUPER, BINLOG REPLAY privilege(s) for this operation +insert into test.t3 values (7, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR 42000: Access denied; you need (at least one of) the SUPER, BINLOG REPLAY privilege(s) for this operation +use test; +# restart: --secure-timestamp=NO +drop tables t1, t2, t3; +# +# MDEV-29813 REPLACE/IGNORE does not work with historical records in InnoDB +# +set sql_mode='STRICT_ALL_TABLES'; +create or replace table t1 (a int) with system versioning; +set system_versioning_insert_history= on; +insert into t1 (a,row_start,row_end) values (1,'2022-01-01','2023-01-01'),(1,'2022-01-01','2023-01-01'); +select a,row_start,row_end into outfile 'mdev29813.txt' from t1 for system_time all; +create or replace table t1 (a int primary key) with system versioning; +load data infile 'mdev29813.txt' ignore into table t1 (a,row_start,row_end); +Warnings: +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +select a,row_start,row_end from t1 for system_time all; +a row_start row_end +1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000 +create or replace table t1 (a int primary key) with system versioning; +insert ignore into t1 (a,row_start,row_end) values (1,'2022-01-01','2023-01-01'),(1,'2022-01-01','2023-01-01'); +Warnings: +Warning 1062 Duplicate entry '1' for key 'PRIMARY' +select a,row_start,row_end from t1 for system_time all; +a row_start row_end +1 2022-01-01 00:00:00.000000 2023-01-01 00:00:00.000000 +drop table t1; +set sql_mode=default; diff --git a/mysql-test/suite/versioning/r/misc.result b/mysql-test/suite/versioning/r/misc.result index 398e3b8be701a..fadc896d18508 100644 --- a/mysql-test/suite/versioning/r/misc.result +++ b/mysql-test/suite/versioning/r/misc.result @@ -25,3 +25,38 @@ set sql_mode=default, timestamp=default; # # End of 10.3 tests # +set time_zone='+00:00'; +# +# MDEV-29721 Inconsistency upon inserting history with visible system versioning columns +# +create table t1 (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; +set system_versioning_insert_history=on; +set timestamp=unix_timestamp('2010-10-10 10:10:10'); +insert t1 (a,s,e) values (1,'2020-01-01',default), (2,'2020-02-02',ignore),(3,default,'2020-03-03'), (4,ignore,'2020-04-04'); +set timestamp=unix_timestamp('2010-11-11 11:11:11'); +insert t1 values (5,'2020-01-01',default), (6,'2020-02-02',ignore),(7,default,'2020-03-03'), (8,ignore,'2020-04-04'); +set timestamp=default; +select * from t1 for system_time all; +a s e +1 2020-01-01 00:00:00.000000 2038-01-19 03:14:07.999999 +2 2020-02-02 00:00:00.000000 2038-01-19 03:14:07.999999 +3 2010-10-10 10:10:10.000000 2020-03-03 00:00:00.000000 +4 2010-10-10 10:10:10.000000 2020-04-04 00:00:00.000000 +5 2020-01-01 00:00:00.000000 2038-01-19 03:14:07.999999 +6 2020-02-02 00:00:00.000000 2038-01-19 03:14:07.999999 +7 2010-11-11 11:11:11.000000 2020-03-03 00:00:00.000000 +8 2010-11-11 11:11:11.000000 2020-04-04 00:00:00.000000 +drop table t1; +# +# MDEV-29830 Assertion `table->versioned()' in THD::vers_insert_history_fast +# +create table t1 (a int) with system versioning; +insert into t1 values (1),(2); +create table t2 (a timestamp); +insert into t2 (a) values (now()),(now()); +select * from t2 where a in (select row_start from t1); +a +drop table t1, t2; +# +# End of 10.11 tests +# diff --git a/mysql-test/suite/versioning/r/not_embedded.result b/mysql-test/suite/versioning/r/not_embedded.result index 23574f34da9dd..5d8380e096962 100644 --- a/mysql-test/suite/versioning/r/not_embedded.result +++ b/mysql-test/suite/versioning/r/not_embedded.result @@ -38,7 +38,7 @@ connect root,localhost,root,,test; connection root; create database mysqltest; create user mysqltest_1@localhost; -connect user1,localhost,mysqltest_1,,test; +connect user1,localhost,mysqltest_1,,"*NO-ONE*"; connection user1; connection root; create table mysqltest.t (a int) with system versioning; diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 4a3f846ae49c2..febb19bf48ec7 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -3378,6 +3378,7 @@ delete from t partition (px); ERROR HY000: Unknown partition 'px' in table 't' unlock tables; drop table t; +set timestamp= default; # # MDEV-28978 Assertion failure in THD::binlog_query or unexpected # ER_ERROR_ON_WRITE with auto-partitioning @@ -3387,4 +3388,24 @@ insert into t () values (),(),(),(),(),(); update t set a = 1; update t set a = 2 limit 0; drop table t; +# +# MDEV-16546 System versioning setting to allow history modification +# +create table t1 (a varchar(100)) with system versioning +partition by system_time interval 1 day +starts '2021-09-30 00:00:00' partitions 3; +set system_versioning_insert_history=1; +insert into t1 (a,row_start,row_end) values +('p0', '2021-09-30', '2021-09-30 10:00:00'), +('p1', '2021-09-30', '2021-10-01 10:00:00'), +('overflows, so also p1','2021-09-30', '2021-10-10 10:00:00'), +('pn, current', '2021-09-30', '2038-01-19 03:14:07.999999'); +select table_name,partition_name,partition_ordinal_position,partition_method,partition_description,table_rows +from information_schema.partitions where table_schema='test'; +table_name partition_name partition_ordinal_position partition_method partition_description table_rows +t1 p0 1 SYSTEM_TIME 2021-10-01 00:00:00 1 +t1 p1 2 SYSTEM_TIME 2021-10-02 00:00:00 2 +t1 pn 3 SYSTEM_TIME CURRENT 1 +drop table t1; +set system_versioning_insert_history=0; set global innodb_stats_persistent= @save_persistent; diff --git a/mysql-test/suite/versioning/r/rpl.result b/mysql-test/suite/versioning/r/rpl.result index 3e0bc85cea770..a6ac9aad3ca1f 100644 --- a/mysql-test/suite/versioning/r/rpl.result +++ b/mysql-test/suite/versioning/r/rpl.result @@ -1,6 +1,7 @@ include/master-slave.inc [connection master] connection slave; +set @@session.time_zone='+00:00'; connection master; CREATE TABLE t1 (x int) with system versioning; insert into t1 values (1); @@ -384,4 +385,74 @@ connection slave; connection master; drop tables t, t2; set timestamp= default; +# +# MDEV-16546 System versioning setting to allow history modification +# +create table t1(x int) with system versioning; +insert into t1(x) values (1); +insert into t1(x, row_start, row_end) values (2, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +ERROR 42S22: Unknown column 'row_start' in 'field list' +set @@system_versioning_insert_history= 1; +insert into t1(x, row_start, row_end) values (3, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +update t1 set x= x + 1; +connection slave; +set @@session.time_zone='+00:00'; +select x, check_row_ts(row_start, row_end) from t1 for system_time all order by x; +x check_row_ts(row_start, row_end) +1 HISTORICAL ROW +2 CURRENT ROW +3 HISTORICAL ROW +select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t1 for system_time all where x = 3; +row_start = '1980-01-01 00:00:00' row_end = '1980-01-01 00:00:01' +1 1 +## INSERT..SELECT +connection master; +create or replace table t2 like t1; +set @@system_versioning_insert_history= 1; +insert into t2 (x, row_start, row_end) select x, row_start, row_end from t1 for system_time all; +connection slave; +select x, check_row_ts(row_start, row_end) from t2 for system_time all order by x; +x check_row_ts(row_start, row_end) +1 HISTORICAL ROW +2 CURRENT ROW +3 HISTORICAL ROW +select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t2 for system_time all where x = 3; +row_start = '1980-01-01 00:00:00' row_end = '1980-01-01 00:00:01' +1 1 +# LOAD DATA +connection master; +select x, row_start, row_end into outfile 'DATAFILE' from t1 for system_time all; +create or replace table t3 like t1; +set @@system_versioning_insert_history= 1; +load data infile 'DATAFILE' into table t3 (x, row_start, row_end); +connection slave; +select x, check_row_ts(row_start, row_end) from t3 for system_time all order by x; +x check_row_ts(row_start, row_end) +1 HISTORICAL ROW +2 CURRENT ROW +3 HISTORICAL ROW +select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t3 for system_time all where x = 3; +row_start = '1980-01-01 00:00:00' row_end = '1980-01-01 00:00:01' +1 1 +# why a slave cannot have system_versioning_insert_history always on +connection master; +set @@system_versioning_insert_history= 0; +set sql_mode=''; +create or replace table t1 (a int, +rs timestamp(6) as row start, re timestamp(6) as row end, +period for system_time (rs,re)) with system versioning; +insert t1 values (1, '2000-01-01 02:03:04', '2001-01-01 02:03.04'); +Warnings: +Warning 1906 The value specified for generated column 'rs' in table 't1' has been ignored +Warning 1906 The value specified for generated column 're' in table 't1' has been ignored +select a,check_row_ts(rs,re) from t1 for system_time all; +a check_row_ts(rs,re) +1 CURRENT ROW +connection slave; +select a,check_row_ts(rs,re) from t1 for system_time all; +a check_row_ts(rs,re) +1 CURRENT ROW +set sql_mode=default; +connection master; +drop tables t1, t2, t3; include/rpl_end.inc diff --git a/mysql-test/suite/versioning/t/binlog.test b/mysql-test/suite/versioning/t/binlog.test new file mode 100644 index 0000000000000..8b6de96d1b406 --- /dev/null +++ b/mysql-test/suite/versioning/t/binlog.test @@ -0,0 +1,18 @@ +--source include/have_log_bin.inc + +--echo # +--echo # MDEV-29741 SHOW BINLOG EVENTS shows garbage with system_versioning_insert_history=on +--echo # MDEV-29732 mysqlbinlog produces syntactically incorrect output with system_versioning_insert_history +--echo # +reset master; +set timestamp=1000000000; +create table t (a int) with system versioning; +set system_versioning_insert_history= on; +insert into t (a) values (1); +set system_versioning_insert_history= off; +drop table t; +source include/show_binlog_events.inc; +flush binary logs; +--let $datadir=`select @@datadir` +--exec $MYSQL_BINLOG -s $datadir/master-bin.000001 +set timestamp=default; diff --git a/mysql-test/suite/versioning/t/create.test b/mysql-test/suite/versioning/t/create.test index 6f5153b4ec179..46ed8fad4cbf5 100644 --- a/mysql-test/suite/versioning/t/create.test +++ b/mysql-test/suite/versioning/t/create.test @@ -1,10 +1,6 @@ --source suite/versioning/engines.inc --source suite/versioning/common.inc ---disable_warnings -drop table if exists t1; ---enable_warnings - --enable_prepare_warnings --replace_result $default_engine DEFAULT_ENGINE $sys_datatype_expl SYS_DATATYPE NULL '' diff --git a/mysql-test/suite/versioning/t/data.test b/mysql-test/suite/versioning/t/data.test index ddae66333379f..fb9962581243a 100644 --- a/mysql-test/suite/versioning/t/data.test +++ b/mysql-test/suite/versioning/t/data.test @@ -29,4 +29,141 @@ set timestamp=default; drop tables t1; +--echo # +--echo # MDEV-16029 mysqldump: dump and restore historical data +--echo # +create or replace table t1 (x int) with system versioning; +set timestamp=unix_timestamp('2010-10-10 10:10:10.101010'); +insert into t1 values (1), (2); +set timestamp=unix_timestamp('2011-11-11 11:11:11.111111'); +delete from t1 where x = 1; +set timestamp=default; +select row_start, row_end into @s1, @e1 from t1 for system_time all where x = 1; +select row_start, row_end into @s2, @e2 from t1 for system_time all where x = 2; + +create or replace table t2 ( + x int, + row_start timestamp(6) as row start invisible, + row_end timestamp(6) as row end invisible, + period for system_time (row_start, row_end)) +with system versioning; + +eval +create or replace function check_fields(x int, row_start timestamp(6), row_end timestamp(6)) + returns char(50) deterministic + return if (x = 1, + if (row_start = @s1 and row_end = @e1, '[CORRECT]', '[WRONG]'), + if (x = 2 and row_start = @s2 and row_end = @e2, '[CORRECT]', '[WRONG]')); + +set @@system_versioning_insert_history= 1; +insert into t2 (x, row_start, row_end) select x, row_start, row_end from t1 for system_time all; +set @@system_versioning_insert_history= 0; +--echo # t2 has the same data as t1 +select x, check_fields(x, row_start, row_end) from t2 for system_time all order by x; + +--let TMP= $MYSQLTEST_VARDIR/tmp + +--exec $MYSQL_DUMP --dump-history --databases test > $TMP/dump_history.sql +--exec $MYSQL_DUMP --databases test > $TMP/dump_no_history.sql +--exec $MYSQL_DUMP --dump-history --no-create-info --skip-comments --databases test > $TMP/dump_only_data.sql +--exec $MYSQL_DUMP --dump-history --compact test 2>&1 > $TMP/dump_history_compact.sql +--cat_file $TMP/dump_history_compact.sql +--replace_result mariadb-dump.exe mariadb-dump +--error 1 +--exec $MYSQL_DUMP --dump-history --as-of="1990-01-02 00:00" test 2>&1 +--replace_result mariadb-dump.exe mariadb-dump +--error 1 +--exec $MYSQL_DUMP --dump-history --replace test 2>&1 +--replace_result mariadb-dump.exe mariadb-dump +--error 1 +--exec $MYSQL_DUMP --dump-history --xml test 2>&1 + +--exec $MYSQL_DUMP --dump-history --tab=$TMP test + +--echo # SQL dump with/without history +--echo ## With history +drop tables t1, t2; +--exec $MYSQL test < $TMP/dump_history.sql +select x, check_fields(x, row_start, row_end) from t1 for system_time all order by x; +select x, check_fields(x, row_start, row_end) from t2 for system_time all order by x; +--echo ## Without history +drop tables t1, t2; +--exec $MYSQL test < $TMP/dump_no_history.sql +select x, check_row_ts(row_start, row_end) from t1 for system_time all order by x; +select x, check_row_ts(row_start, row_end) from t2 for system_time all order by x; + +--echo ## History and --no-create-info --skip-comments +create or replace table t1 (x int) with system versioning; +delete from t2; delete history from t2; +--exec $MYSQL test < $TMP/dump_only_data.sql +select x, check_fields(x, row_start, row_end) from t1 for system_time all order by x; +select x, check_fields(x, row_start, row_end) from t2 for system_time all order by x; + +--echo ## compact +--exec $MYSQL test < $TMP/dump_history.sql +select x, check_fields(x, row_start, row_end) from t1 for system_time all order by x; +select x, check_fields(x, row_start, row_end) from t2 for system_time all order by x; + +create or replace table t1 (x int) with system versioning; + +# TODO: MDEV-16766 mysqldump: dump history in XML +if (0) +{ +--echo # XML with history +drop table t1; +create or replace table t1 (x int) with system versioning; +delete from t2; +delete history from t2; +set @@system_versioning_insert_history= 1; +--replace_result $TMP TMP +eval load xml infile '$TMP/dump_history.xml' into table t1; +--exec cp $TMP/dump_history.xml /tmp +set @@system_versioning_insert_history= 0; +--echo ## History is now loaded as current data (TODO) +select *, check_row_ts(row_start, row_end) from t1 for system_time all; +# TODO: check mysqlimport +# --exec $MYSQL_IMPORT test $TMP/dump_history.xml +} + +--echo # --tab with history +drop tables t1, t2; +--exec $MYSQL test < $TMP/t1.sql +--exec $MYSQL test < $TMP/t2.sql +show create table t1; +show create table t2; +set @@system_versioning_insert_history= 1; +--replace_result $TMP tmp +eval load data infile '$TMP/t1.txt' into table t1 (x, row_start, row_end); +--replace_result $TMP tmp +eval load data infile '$TMP/t2.txt' into table t2 (x, row_start, row_end); +set @@system_versioning_insert_history= 0; +select *, check_row_ts(row_start, row_end) from t1 for system_time all; +select *, check_row_ts(row_start, row_end) from t2 for system_time all; + +# Cleanup +--remove_files_wildcard $TMP *.sql +--remove_files_wildcard $TMP *.txt +--remove_files_wildcard $TMP *.xml +drop tables t1, t2; +drop function check_fields; + +--echo # +--echo # MDEV-29730 mysqldump --dump-history creates broken dump if there are precision-versioned tables +--echo # +create table t1 (x int, + rs BIGINT unsigned as row start, re BiGiNt unsigned as row end, + period for system_time (rs,re)) with system versioning engine=innodb; +insert t1 (x) values (1); +insert t1 (x) values (2); +delete from t1 where x=1; + +--replace_result mariadb-dump.exe mariadb-dump +--error 6 +--exec $MYSQL_DUMP --dump-history test 2>&1 >/dev/null +--replace_regex /2,\d+,/2,XXX,/ /mariadb-dump\.exe/mariadb-dump/ +--error 6 +--exec $MYSQL_DUMP --force --dump-history --compact test 2>&1 + +drop table t1; + --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/insert.test b/mysql-test/suite/versioning/t/insert.test index 4e8c91315c671..e6dcd1aeac6b0 100644 --- a/mysql-test/suite/versioning/t/insert.test +++ b/mysql-test/suite/versioning/t/insert.test @@ -81,4 +81,185 @@ select x, y from t2; drop table t1; drop table t2; +--echo # +--echo # MDEV-16546 System versioning setting to allow history modification +--echo # +set @@session.time_zone='+00:00'; +let $MAX_TIMESTAMP= TIMESTAMP'2038-01-19 03:14:07.999999'; + +create table t1(x int primary key) with system versioning; +create table t2(y int primary key, + row_start timestamp(6) as row start invisible, + row_end timestamp(6) as row end invisible, + period for system_time (row_start, row_end)) +with system versioning; +create table t3(z int primary key, + row_start timestamp(6) as row start, + row_end timestamp(6) as row end, + period for system_time (row_start, row_end)) +with system versioning; +--error ER_BAD_FIELD_ERROR +insert into t1(x, row_start, row_end) values (2, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +insert into t2(y, row_start, row_end) values (2, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +set @@system_versioning_insert_history= 1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t1; +insert into t1(x, row_start, row_end) values (3, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +insert into t2(y, row_start, row_end) values (4, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +insert into t3 values (5, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +--error ER_WRONG_VALUE +insert into t3 values (5, '1980-01-02 00:00:00', '1980-01-01 00:00:01'); + +select x, row_start, row_end from t1 for system_time all; +select y, row_start, row_end from t2 for system_time all; +select z, row_start, row_end from t3 for system_time all; + +insert into t1(x) values (1); +insert into t2(y) values (1); + +update t1 set x= x + 1; +--error ER_BAD_FIELD_ERROR +update t1 set row_start= '1971-01-01 00:00:00'; +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +update t2 set row_start= '1971-01-01 00:00:00'; +--error ER_BAD_FIELD_ERROR +insert t1 (x) values (2) on duplicate key update x= 3, row_end= '1970-01-01 00:00:00'; +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +insert t2 (y) values (1) on duplicate key update y= 3, row_end= '1970-01-01 00:00:00'; +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +insert t2 (y,row_end) values (1, '1970-01-01 00:00:00') on duplicate key update y= 3; +# this should work, row_start/row_end must be mentioned explicitly: +insert into t1 values (4); +insert into t1 set x= 5, row_start= '1980-01-01 00:00:00', row_end= '1980-01-01 00:00:01'; +--error ER_WRONG_VALUE +insert into t1(x, row_start, row_end) values (6, '1980-01-01 00:00:01', '1980-01-01 00:00:00'); +--error ER_WRONG_VALUE +insert into t1(x, row_start, row_end) values (7, '1980-01-01 00:00:11', '1980-01-01 00:00:11'); +insert into t1(x, row_start) values (8, '1980-01-01 00:00:22'); +--replace_regex /'202\d-\d\d-\d\d .*'/'now'/ +--error ER_WRONG_VALUE +insert into t1(x, row_end) values (9, '1980-01-01 00:00:33'); +eval insert into t1(x, row_end) values (10, $MAX_TIMESTAMP); +select x, check_row_ts(row_start, row_end) from t1 for system_time all order by x; +eval select x, row_start, row_end from t1 for system_time all +where x > 1 and row_end < $MAX_TIMESTAMP order by x, row_start, row_end; +--echo # Direct insert is not possible for TRX_ID versioning +create or replace table t2(y int primary key, + row_start bigint unsigned as row start, + row_end bigint unsigned as row end, + period for system_time (row_start, row_end)) +with system versioning engine innodb; +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +insert into t2(y, row_start, row_end) values (0, 1, 2); +set @@system_versioning_insert_history= 0; + +--echo ## INSERT..SELECT +create or replace table t2 like t1; +set @@system_versioning_insert_history= 1; +insert into t2 (x, row_start, row_end) select x, row_start, row_end from t1 for system_time all; +select x, check_row_ts(row_start, row_end) from t2 for system_time all order by x; +eval select x, row_start, row_end from t2 for system_time all +where x > 1 and row_end < $MAX_TIMESTAMP order by x, row_start, row_end; +set @@system_versioning_insert_history= 0; + +--echo # REPLACE / REPLACE .. SELECT +create or replace table t2(a int primary key, + row_start timestamp(6) as row start invisible, + row_end timestamp(6) as row end invisible, + period for system_time (row_start, row_end)) +with system versioning; +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +replace into t2 (a, row_start, row_end) values (1, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +replace into t2 (a, row_start, row_end) select x, row_start, row_end from t1; +create or replace table t2 (a int primary key) with system versioning; +--error ER_BAD_FIELD_ERROR +replace into t2 (a, row_start, row_end) values (1, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +--error ER_BAD_FIELD_ERROR +replace into t2 (a, row_start, row_end) select x, row_start, row_end from t1; +set @@system_versioning_insert_history= 1; +--echo # REPLACE ignores system_versioning_insert_history +--error ER_BAD_FIELD_ERROR +replace into t2 (a, row_end) values (0, '1980-01-01 00:00:00'); +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +replace into t3 (z, row_start) values (0, '1980-01-01 00:00:00'); +--error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +replace into t3 values (0, '1980-01-01 00:00:00', '1981-01-01 00:00:00'); + +--echo # LOAD DATA +--let DATAFILE= $MYSQLTEST_VARDIR/tmp/test_versioning_t3.data +--replace_result $DATAFILE DATAFILE +eval select x, row_start, row_end into outfile '$DATAFILE' from t1 for system_time all; +create or replace table t2 like t1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t2; +set @@system_versioning_insert_history= 1; +--replace_result $default_engine DEFAULT_ENGINE +show create table t2; +--replace_result $DATAFILE DATAFILE +eval load data infile '$DATAFILE' into table t2 (x, row_start, row_end); +select x, check_row_ts(row_start, row_end) from t2 for system_time all order by x; +select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t2 for system_time all where x = 3; +--remove_file $DATAFILE + +--echo # Honor secure_timestamp option +--let $restart_parameters= --secure-timestamp=YES +--source include/restart_mysqld.inc +set @@system_versioning_insert_history= 1; +--error ER_OPTION_PREVENTS_STATEMENT +insert into t3(z, row_start, row_end) values (8, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +--error ER_OPTION_PREVENTS_STATEMENT +insert into t3 values (8, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +--let $restart_parameters= --secure-timestamp=REPLICATION +--source include/restart_mysqld.inc +create user nobody; +grant all privileges on test.* to nobody; +change_user nobody; +set @@system_versioning_insert_history= 1; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +insert into test.t3(z, row_start, row_end) values (9, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +insert into test.t3 values (9, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +change_user root; +--let $restart_parameters= --secure-timestamp=SUPER +--source include/restart_mysqld.inc +set @@system_versioning_insert_history= 1; +insert into test.t3(z, row_start, row_end) values (10, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +change_user nobody; +set @@system_versioning_insert_history= 1; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +insert into test.t3(z, row_start, row_end) values (7, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +insert into test.t3 values (7, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +change_user root; +use test; +--let $restart_parameters= --secure-timestamp=NO +--source include/restart_mysqld.inc + +drop tables t1, t2, t3; + +--echo # +--echo # MDEV-29813 REPLACE/IGNORE does not work with historical records in InnoDB +--echo # +set sql_mode='STRICT_ALL_TABLES'; + +create or replace table t1 (a int) with system versioning; +set system_versioning_insert_history= on; +insert into t1 (a,row_start,row_end) values (1,'2022-01-01','2023-01-01'),(1,'2022-01-01','2023-01-01'); +select a,row_start,row_end into outfile 'mdev29813.txt' from t1 for system_time all; + +create or replace table t1 (a int primary key) with system versioning; +load data infile 'mdev29813.txt' ignore into table t1 (a,row_start,row_end); +select a,row_start,row_end from t1 for system_time all; + +create or replace table t1 (a int primary key) with system versioning; +insert ignore into t1 (a,row_start,row_end) values (1,'2022-01-01','2023-01-01'),(1,'2022-01-01','2023-01-01'); +select a,row_start,row_end from t1 for system_time all; + +--let $datadir= `select @@datadir` +--remove_file $datadir/test/mdev29813.txt +drop table t1; +set sql_mode=default; + -- source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/misc.test b/mysql-test/suite/versioning/t/misc.test index dce1e0deced9d..fa5012b6efa0f 100644 --- a/mysql-test/suite/versioning/t/misc.test +++ b/mysql-test/suite/versioning/t/misc.test @@ -18,3 +18,34 @@ set sql_mode=default, timestamp=default; --echo # --echo # End of 10.3 tests --echo # +# +# simple tests that don't need to be run in multiple various combinations +# +set time_zone='+00:00'; + +--echo # +--echo # MDEV-29721 Inconsistency upon inserting history with visible system versioning columns +--echo # +create table t1 (a int, s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; +set system_versioning_insert_history=on; +set timestamp=unix_timestamp('2010-10-10 10:10:10'); +insert t1 (a,s,e) values (1,'2020-01-01',default), (2,'2020-02-02',ignore),(3,default,'2020-03-03'), (4,ignore,'2020-04-04'); +set timestamp=unix_timestamp('2010-11-11 11:11:11'); +insert t1 values (5,'2020-01-01',default), (6,'2020-02-02',ignore),(7,default,'2020-03-03'), (8,ignore,'2020-04-04'); +set timestamp=default; +select * from t1 for system_time all; +drop table t1; + +--echo # +--echo # MDEV-29830 Assertion `table->versioned()' in THD::vers_insert_history_fast +--echo # +create table t1 (a int) with system versioning; +insert into t1 values (1),(2); +create table t2 (a timestamp); +insert into t2 (a) values (now()),(now()); +select * from t2 where a in (select row_start from t1); +drop table t1, t2; + +--echo # +--echo # End of 10.11 tests +--echo # diff --git a/mysql-test/suite/versioning/t/not_embedded.test b/mysql-test/suite/versioning/t/not_embedded.test index 80e936b02f364..38f42a44587c1 100644 --- a/mysql-test/suite/versioning/t/not_embedded.test +++ b/mysql-test/suite/versioning/t/not_embedded.test @@ -50,7 +50,7 @@ create database mysqltest; --enable_warnings create user mysqltest_1@localhost; -connect (user1,localhost,mysqltest_1,,test); +connect (user1,localhost,mysqltest_1,,"*NO-ONE*"); connection user1; connection root; diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index e865ec3b9f6c3..078b621b31ee9 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -2591,8 +2591,8 @@ lock tables t write; --error ER_UNKNOWN_PARTITION delete from t partition (px); unlock tables; -# cleanup drop table t; +set timestamp= default; --echo # --echo # MDEV-28978 Assertion failure in THD::binlog_query or unexpected @@ -2605,6 +2605,23 @@ update t set a = 2 limit 0; # cleanup drop table t; +--echo # +--echo # MDEV-16546 System versioning setting to allow history modification +--echo # +create table t1 (a varchar(100)) with system versioning +partition by system_time interval 1 day +starts '2021-09-30 00:00:00' partitions 3; +set system_versioning_insert_history=1; +insert into t1 (a,row_start,row_end) values +('p0', '2021-09-30', '2021-09-30 10:00:00'), +('p1', '2021-09-30', '2021-10-01 10:00:00'), +('overflows, so also p1','2021-09-30', '2021-10-10 10:00:00'), +('pn, current', '2021-09-30', '2038-01-19 03:14:07.999999'); +select table_name,partition_name,partition_ordinal_position,partition_method,partition_description,table_rows +from information_schema.partitions where table_schema='test'; +drop table t1; +set system_versioning_insert_history=0; + --disable_prepare_warnings set global innodb_stats_persistent= @save_persistent; --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/versioning/t/rpl.test b/mysql-test/suite/versioning/t/rpl.test index 45ac3e62d7f32..16e6af75dbadd 100644 --- a/mysql-test/suite/versioning/t/rpl.test +++ b/mysql-test/suite/versioning/t/rpl.test @@ -1,6 +1,7 @@ --source suite/versioning/engines.inc --source include/have_partition.inc --source include/master-slave.inc +--source suite/versioning/common.inc #BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS #Testing command counters -BEFORE. @@ -10,6 +11,7 @@ let $slave_com_commit_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commi let $slave_com_insert_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1); let $slave_com_delete_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1); let $slave_com_update_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update', Value, 1); +set @@session.time_zone='+00:00'; connection master; CREATE TABLE t1 (x int) with system versioning; @@ -296,4 +298,59 @@ alter table t drop partition p0; drop tables t, t2; set timestamp= default; +--echo # +--echo # MDEV-16546 System versioning setting to allow history modification +--echo # +create table t1(x int) with system versioning; +insert into t1(x) values (1); +--error ER_BAD_FIELD_ERROR +insert into t1(x, row_start, row_end) values (2, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +set @@system_versioning_insert_history= 1; +insert into t1(x, row_start, row_end) values (3, '1980-01-01 00:00:00', '1980-01-01 00:00:01'); +update t1 set x= x + 1; +sync_slave_with_master; +set @@session.time_zone='+00:00'; +select x, check_row_ts(row_start, row_end) from t1 for system_time all order by x; +select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t1 for system_time all where x = 3; + +--echo ## INSERT..SELECT +connection master; +create or replace table t2 like t1; +set @@system_versioning_insert_history= 1; +insert into t2 (x, row_start, row_end) select x, row_start, row_end from t1 for system_time all; +sync_slave_with_master; +select x, check_row_ts(row_start, row_end) from t2 for system_time all order by x; +select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t2 for system_time all where x = 3; + +--echo # LOAD DATA +connection master; +--let DATAFILE= $MYSQLTEST_VARDIR/tmp/test_versioning_t3.data +--replace_result $DATAFILE DATAFILE +eval select x, row_start, row_end into outfile '$DATAFILE' from t1 for system_time all; +create or replace table t3 like t1; +set @@system_versioning_insert_history= 1; +--replace_result $DATAFILE DATAFILE +eval load data infile '$DATAFILE' into table t3 (x, row_start, row_end); +sync_slave_with_master; +select x, check_row_ts(row_start, row_end) from t3 for system_time all order by x; +select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t3 for system_time all where x = 3; +--remove_file $DATAFILE + +--echo # why a slave cannot have system_versioning_insert_history always on +connection master; +set @@system_versioning_insert_history= 0; +set sql_mode=''; +create or replace table t1 (a int, + rs timestamp(6) as row start, re timestamp(6) as row end, + period for system_time (rs,re)) with system versioning; +insert t1 values (1, '2000-01-01 02:03:04', '2001-01-01 02:03.04'); +select a,check_row_ts(rs,re) from t1 for system_time all; +sync_slave_with_master; +select a,check_row_ts(rs,re) from t1 for system_time all; +set sql_mode=default; + +connection master; +drop tables t1, t2, t3; + +--source suite/versioning/common_finish.inc --source include/rpl_end.inc diff --git a/plugin/auth_gssapi/CMakeLists.txt b/plugin/auth_gssapi/CMakeLists.txt index 8c82d335ab2cc..f84f0aafb65bf 100644 --- a/plugin/auth_gssapi/CMakeLists.txt +++ b/plugin/auth_gssapi/CMakeLists.txt @@ -46,11 +46,15 @@ ELSE() ENDIF() ENDIF () - +IF(WIN32) + SET(AUTH_GSSAPI_DEFAULT DEFAULT) +ELSE() + SET(AUTH_GSSAPI_DEFAULT) +ENDIF() MYSQL_ADD_PLUGIN(auth_gssapi server_plugin.cc ${GSSAPI_SERVER} ${GSSAPI_ERRMSG} - LINK_LIBRARIES ${GSSAPI_LIBS} - COMPONENT gssapi-server - MODULE_ONLY) + LINK_LIBRARIES ${GSSAPI_LIBS} + ${AUTH_GSSAPI_DEFAULT} + COMPONENT gssapi-server) # disabled in favor of libmariadb/plugins/auth/auth_gssapi_client.c # diff --git a/plugin/auth_gssapi/mysql-test/auth_gssapi/basic.result b/plugin/auth_gssapi/mysql-test/auth_gssapi/basic.result index b7cf3d8e488ab..09be092d879ad 100644 --- a/plugin/auth_gssapi/mysql-test/auth_gssapi/basic.result +++ b/plugin/auth_gssapi/mysql-test/auth_gssapi/basic.result @@ -1,6 +1,3 @@ -INSTALL SONAME 'auth_gssapi'; -Warnings: -Note 1105 SSPI: using principal name 'localhost', mech 'Negotiate' CREATE USER 'GSSAPI_SHORTNAME' IDENTIFIED WITH gssapi; connect con1,localhost,$GSSAPI_SHORTNAME,,; SELECT USER(),CURRENT_USER(); @@ -23,4 +20,3 @@ DROP USER usr1; CREATE USER nosuchuser IDENTIFIED WITH gssapi AS 'nosuchuser@EXAMPLE.COM'; ERROR 28000: GSSAPI name mismatch, requested 'nosuchuser@EXAMPLE.COM', actual name 'GSSAPI_FULLNAME' DROP USER nosuchuser; -UNINSTALL SONAME 'auth_gssapi'; diff --git a/plugin/auth_gssapi/mysql-test/auth_gssapi/basic.test b/plugin/auth_gssapi/mysql-test/auth_gssapi/basic.test index 2307aa3934a3e..dc242e3a9cb56 100644 --- a/plugin/auth_gssapi/mysql-test/auth_gssapi/basic.test +++ b/plugin/auth_gssapi/mysql-test/auth_gssapi/basic.test @@ -1,6 +1,3 @@ ---replace_regex /name '[^']+'/name 'localhost'/ -INSTALL SONAME 'auth_gssapi'; - # # CREATE USER without 'AS' clause # @@ -42,5 +39,3 @@ CREATE USER nosuchuser IDENTIFIED WITH gssapi AS 'nosuchuser@EXAMPLE.COM'; connect (con1,localhost,nosuchuser,,); --enable_query_log DROP USER nosuchuser; - -UNINSTALL SONAME 'auth_gssapi'; \ No newline at end of file diff --git a/plugin/auth_gssapi/mysql-test/auth_gssapi/groups.result b/plugin/auth_gssapi/mysql-test/auth_gssapi/groups.result index 10b3eb3e9d64b..38244eca35b25 100644 --- a/plugin/auth_gssapi/mysql-test/auth_gssapi/groups.result +++ b/plugin/auth_gssapi/mysql-test/auth_gssapi/groups.result @@ -1,6 +1,3 @@ -INSTALL SONAME 'auth_gssapi'; -Warnings: -Note 1105 SSPI: using principal name 'localhost', mech 'Negotiate' CREATE USER 'nosuchgroup' IDENTIFIED WITH gssapi AS 'GROUP:nosuchgroup'; connect(localhost,nosuchuser,,test,MASTER_MYPORT,MASTER_MYSOCK); connect con1,localhost,nosuchuser,,; @@ -41,4 +38,3 @@ connect con1,localhost,me_sid,,; disconnect con1; connection default; DROP USER me_sid; -UNINSTALL SONAME 'auth_gssapi'; diff --git a/plugin/auth_gssapi/mysql-test/auth_gssapi/groups.test b/plugin/auth_gssapi/mysql-test/auth_gssapi/groups.test index 1c72ad9cc23ae..647e02043f290 100644 --- a/plugin/auth_gssapi/mysql-test/auth_gssapi/groups.test +++ b/plugin/auth_gssapi/mysql-test/auth_gssapi/groups.test @@ -1,6 +1,6 @@ source include/windows.inc; --replace_regex /name '[^']+'/name 'localhost'/ -INSTALL SONAME 'auth_gssapi'; + # Invalid group name @@ -67,7 +67,4 @@ replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT; connect (con1,localhost,me_sid,,); disconnect con1; connection default; -DROP USER me_sid; - - -UNINSTALL SONAME 'auth_gssapi'; \ No newline at end of file +DROP USER me_sid; \ No newline at end of file diff --git a/plugin/auth_gssapi/mysql-test/auth_gssapi/multiauth.result b/plugin/auth_gssapi/mysql-test/auth_gssapi/multiauth.result index c65eb7a86342b..41d2707398b9f 100644 --- a/plugin/auth_gssapi/mysql-test/auth_gssapi/multiauth.result +++ b/plugin/auth_gssapi/mysql-test/auth_gssapi/multiauth.result @@ -1,6 +1,3 @@ -INSTALL SONAME 'auth_gssapi'; -Warnings: -Note 1105 SSPI: using principal name 'localhost', mech 'Negotiate' CREATE USER 'nosuchuser' IDENTIFIED WITH gssapi OR mysql_native_password as password("good"); connect(localhost,nosuchuser,,test,MASTER_MYPORT,MASTER_MYSOCK); connect con1,localhost,nosuchuser,,; @@ -31,4 +28,3 @@ GSSAPI_SHORTNAME@localhost GSSAPI_SHORTNAME@% disconnect con1; connection default; DROP USER 'GSSAPI_SHORTNAME'; -UNINSTALL SONAME 'auth_gssapi'; diff --git a/plugin/auth_gssapi/mysql-test/auth_gssapi/multiauth.test b/plugin/auth_gssapi/mysql-test/auth_gssapi/multiauth.test index 10e1e80907ea9..0257946b786db 100644 --- a/plugin/auth_gssapi/mysql-test/auth_gssapi/multiauth.test +++ b/plugin/auth_gssapi/mysql-test/auth_gssapi/multiauth.test @@ -1,6 +1,3 @@ ---replace_regex /name '[^']+'/name 'localhost'/ -INSTALL SONAME 'auth_gssapi'; - # gssapi,password CREATE USER 'nosuchuser' IDENTIFIED WITH gssapi OR mysql_native_password as password("good"); replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT; @@ -33,4 +30,3 @@ connection default; replace_result $GSSAPI_SHORTNAME GSSAPI_SHORTNAME; eval DROP USER '$GSSAPI_SHORTNAME'; -UNINSTALL SONAME 'auth_gssapi'; diff --git a/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.opt b/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.opt index 3077d70c9c367..c9a5d52260013 100644 --- a/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.opt +++ b/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.opt @@ -1 +1 @@ ---loose-gssapi-keytab-path=$GSSAPI_KEYTAB_PATH --loose-gssapi-principal-name=$GSSAPI_PRINCIPAL_NAME +--loose-gssapi=ON --loose-gssapi-keytab-path=$GSSAPI_KEYTAB_PATH --loose-gssapi-principal-name=$GSSAPI_PRINCIPAL_NAME --plugin-load-add=$AUTH_GSSAPI_SO diff --git a/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.pm b/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.pm index e77ba05cb5cf5..af13b76e74c5a 100644 --- a/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.pm +++ b/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.pm @@ -1,8 +1,9 @@ + package My::Suite::AuthGSSAPI; @ISA = qw(My::Suite); -return "No AUTH_GSSAPI plugin" unless $ENV{AUTH_GSSAPI_SO}; +return "No AUTH_GSSAPI plugin" unless ($ENV{AUTH_GSSAPI_SO} or $::mysqld_variables{gssapi} eq "ON"); return "Not run for embedded server" if $::opt_embedded_server; diff --git a/plugin/auth_gssapi/server_plugin.cc b/plugin/auth_gssapi/server_plugin.cc index eeca4607ece01..c45452cee8ec6 100644 --- a/plugin/auth_gssapi/server_plugin.cc +++ b/plugin/auth_gssapi/server_plugin.cc @@ -141,7 +141,7 @@ static struct st_mysql_auth server_handler= { gssapi_auth, NULL, NULL }; -maria_declare_plugin(gssapi_server) +maria_declare_plugin(auth_gssapi) { MYSQL_AUTHENTICATION_PLUGIN, &server_handler, diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc index 1aac71b132a5a..6b5be475e9776 100644 --- a/plugin/feedback/sender_thread.cc +++ b/plugin/feedback/sender_thread.cc @@ -108,7 +108,7 @@ static int prepare_for_fill(TABLE_LIST *tables) thd->security_ctx->master_access= ALL_KNOWN_ACL; bzero((char*) &thd->net, sizeof(thd->net)); lex_start(thd); - mysql_init_select(thd->lex); + thd->lex->init_select(); LEX_CSTRING tbl_name= {i_s_feedback->table_name, strlen(i_s_feedback->table_name) }; diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test index ce99406ab0678..c446036aaaee8 100644 --- a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test +++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test @@ -33,7 +33,7 @@ let $restart_parameters=$default_parameters --innodb_encryption_threads=5 --inno --echo # Wait until encryption threads have encrypted all tablespaces ---let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'` +--let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'` --let $wait_timeout= 600 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; --source include/wait_condition.inc @@ -63,7 +63,7 @@ alter table t33 encryption_key_id=222; --echo # Wait until encryption threads have encrypted all tablespaces ---let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'` +--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'` --let $wait_timeout= 600 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; --source include/wait_condition.inc @@ -77,7 +77,7 @@ set global innodb_encrypt_tables = OFF; --echo # Wait until encryption threads to decrypt all encrypted tablespaces ---let $tables_count= `select count(*) - 1 from information_schema.tables where engine = 'InnoDB'` +--let $tables_count= `select count(*) - 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'` --let $wait_timeout= 600 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING = 0; --source include/wait_condition.inc @@ -105,7 +105,7 @@ set global innodb_encrypt_tables = ON; --echo # Wait until encryption threads to encrypt all unencrypted tablespaces ---let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'` +--let $tables_count= `select count(*) + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'` --let $wait_timeout= 600 --let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; --source include/wait_condition.inc diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index 0381927d70f85..a46c49c88b0cc 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -295,8 +295,8 @@ ALTER TABLE general_log MODIFY thread_id BIGINT(21) UNSIGNED NOT NULL; SET GLOBAL general_log = @old_log_state; -SET @old_log_state = @@global.slow_query_log; -SET GLOBAL slow_query_log = 'OFF'; +SET @old_log_state = @@global.log_slow_query; +SET GLOBAL log_slow_query = 'OFF'; ALTER TABLE slow_log ADD COLUMN thread_id BIGINT(21) UNSIGNED NOT NULL AFTER sql_text; ALTER TABLE slow_log @@ -314,7 +314,7 @@ ALTER TABLE slow_log MODIFY server_id INTEGER UNSIGNED NOT NULL, MODIFY sql_text MEDIUMTEXT NOT NULL, MODIFY thread_id BIGINT(21) UNSIGNED NOT NULL; -SET GLOBAL slow_query_log = @old_log_state; +SET GLOBAL log_slow_query = @old_log_state; ALTER TABLE plugin MODIFY name varchar(64) COLLATE utf8_general_ci NOT NULL DEFAULT '', diff --git a/scripts/mysql_test_db.sql b/scripts/mysql_test_db.sql index 9f8a0cf604c06..c83f2c44a4fae 100644 --- a/scripts/mysql_test_db.sql +++ b/scripts/mysql_test_db.sql @@ -15,11 +15,12 @@ CREATE DATABASE IF NOT EXISTS test CHARACTER SET latin1 COLLATE latin1_swedish_ci; --- Fill "db" table with default grants for anyone to --- access database 'test' and 'test_%' if "db" table didn't exist +--- Fill "db" table with default grants for anyone to +--- access database 'test' and 'test_%' if "db" table didn't exist +INSERT INTO mysql.global_priv VALUES ('', 'PUBLIC', '{"access":0,"is_role":true}'); CREATE TEMPORARY TABLE tmp_db LIKE db; -INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y'); -INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y'); +INSERT INTO tmp_db VALUES ('','test','PUBLIC','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y'); +INSERT INTO tmp_db VALUES ('','test\_%','PUBLIC','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y','Y'); INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0; DROP TABLE tmp_db; diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 28c39090d03de..9a1f3920f6771 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -227,7 +227,7 @@ sub defaults_for_group #### #### Init log file. Check for appropriate place for log file, in the following -#### order: my_print_defaults mysqld datadir, @datadir@ +#### order: my_print_defaults mysqld datadir, @localstatedir@ #### sub init_log @@ -241,7 +241,7 @@ sub init_log } if (!defined($logdir)) { - $logdir= "@datadir@" if (-d "@datadir@" && -w "@datadir@"); + $logdir= "@localstatedir@" if (-d "@localstatedir@" && -w "@localstatedir@"); } if (!defined($logdir)) { diff --git a/scripts/sys_schema/procedures/ps_trace_thread.sql b/scripts/sys_schema/procedures/ps_trace_thread.sql index 6e5666c2dea8c..1a2ede79a77a6 100644 --- a/scripts/sys_schema/procedures/ps_trace_thread.sql +++ b/scripts/sys_schema/procedures/ps_trace_thread.sql @@ -151,7 +151,7 @@ BEGIN ELSE -- Use long query time from the server to -- flag long running statements in red - IF((timer_wait/1000000000000) > @@long_query_time, + IF((timer_wait/1000000000000) > @@log_slow_query_time, ' style=filled, color=red', ' style=filled, color=lightblue') END diff --git a/scripts/sys_schema/procedures/ps_trace_thread_57.sql b/scripts/sys_schema/procedures/ps_trace_thread_57.sql index 9aae53ba16135..33dc796108977 100644 --- a/scripts/sys_schema/procedures/ps_trace_thread_57.sql +++ b/scripts/sys_schema/procedures/ps_trace_thread_57.sql @@ -154,7 +154,7 @@ BEGIN ELSE -- Use long query time from the server to -- flag long running statements in red - IF((timer_wait/1000000000000) > @@long_query_time, + IF((timer_wait/1000000000000) > @@log_slow_query_time, ' style=filled, color=red', ' style=filled, color=lightblue') END diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index e1efcbf11ad96..82d8d4edd7188 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -150,13 +150,13 @@ then # reason is that dump contains ALTER TABLE for log tables, and # this causes an error if logging is enabled GENERAL_LOG_OPT=$($MYSQL --skip-column-names -e "$STOP_WSREP SELECT @@GENERAL_LOG") - SLOW_LOG_OPT=$($MYSQL --skip-column-names -e "$STOP_WSREP SELECT @@SLOW_QUERY_LOG") + SLOW_LOG_OPT=$($MYSQL --skip-column-names -e "$STOP_WSREP SELECT @@LOG_SLOW_QUERY") - LOG_OFF="SET GLOBAL GENERAL_LOG=OFF; SET GLOBAL SLOW_QUERY_LOG=OFF;" + LOG_OFF="SET GLOBAL GENERAL_LOG=OFF; SET GLOBAL LOG_SLOW_QUERY=OFF;" # commands to restore log settings RESTORE_GENERAL_LOG="SET GLOBAL GENERAL_LOG=$GENERAL_LOG_OPT;" - RESTORE_SLOW_QUERY_LOG="SET GLOBAL SLOW_QUERY_LOG=$SLOW_LOG_OPT;" + RESTORE_SLOW_QUERY_LOG="SET GLOBAL LOG_SLOW_QUERY=$SLOW_LOG_OPT;" (echo "$STOP_WSREP" && echo "$LOG_OFF" && echo "$RESET_MASTER" && \ echo "$SET_GTID_BINLOG_STATE" && echo "$SQL_LOG_BIN_OFF" && \ diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc index 2ac4e2561125e..67c8a8bca4f72 100644 --- a/sql/ddl_log.cc +++ b/sql/ddl_log.cc @@ -3041,7 +3041,7 @@ static bool ddl_log_write(DDL_LOG_STATE *ddl_state, mysql_mutex_lock(&LOCK_gdl); error= ((ddl_log_write_entry(ddl_log_entry, &log_entry)) || - ddl_log_write_execute_entry(log_entry->entry_pos, + ddl_log_write_execute_entry(log_entry->entry_pos, 0, &ddl_state->execute_entry)); mysql_mutex_unlock(&LOCK_gdl); if (error) @@ -3060,7 +3060,7 @@ static bool ddl_log_write(DDL_LOG_STATE *ddl_state, Logging of rename table */ -bool ddl_log_rename_table(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_rename_table(DDL_LOG_STATE *ddl_state, handlerton *hton, const LEX_CSTRING *org_db, const LEX_CSTRING *org_alias, @@ -3089,7 +3089,7 @@ bool ddl_log_rename_table(THD *thd, DDL_LOG_STATE *ddl_state, Logging of rename view */ -bool ddl_log_rename_view(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_rename_view(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *org_db, const LEX_CSTRING *org_alias, const LEX_CSTRING *new_db, @@ -3120,7 +3120,7 @@ bool ddl_log_rename_view(THD *thd, DDL_LOG_STATE *ddl_state, is in original delete order. */ -static bool ddl_log_drop_init(THD *thd, DDL_LOG_STATE *ddl_state, +static bool ddl_log_drop_init(DDL_LOG_STATE *ddl_state, ddl_log_action_code action_code, const LEX_CSTRING *db, const LEX_CSTRING *comment) @@ -3138,18 +3138,18 @@ static bool ddl_log_drop_init(THD *thd, DDL_LOG_STATE *ddl_state, } -bool ddl_log_drop_table_init(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_table_init(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db, const LEX_CSTRING *comment) { - return ddl_log_drop_init(thd, ddl_state, DDL_LOG_DROP_INIT_ACTION, + return ddl_log_drop_init(ddl_state, DDL_LOG_DROP_INIT_ACTION, db, comment); } -bool ddl_log_drop_view_init(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_view_init(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db) { - return ddl_log_drop_init(thd, ddl_state, DDL_LOG_DROP_INIT_ACTION, + return ddl_log_drop_init(ddl_state, DDL_LOG_DROP_INIT_ACTION, db, &empty_clex_str); } @@ -3163,7 +3163,7 @@ bool ddl_log_drop_view_init(THD *thd, DDL_LOG_STATE *ddl_state, See also comment before ddl_log_drop_init(). */ -static bool ddl_log_drop(THD *thd, DDL_LOG_STATE *ddl_state, +static bool ddl_log_drop(DDL_LOG_STATE *ddl_state, ddl_log_action_code action_code, uint phase, handlerton *hton, @@ -3209,32 +3209,32 @@ static bool ddl_log_drop(THD *thd, DDL_LOG_STATE *ddl_state, } -bool ddl_log_drop_table(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_table(DDL_LOG_STATE *ddl_state, handlerton *hton, const LEX_CSTRING *path, const LEX_CSTRING *db, const LEX_CSTRING *table) { DBUG_ENTER("ddl_log_drop_table"); - DBUG_RETURN(ddl_log_drop(thd, ddl_state, + DBUG_RETURN(ddl_log_drop(ddl_state, DDL_LOG_DROP_TABLE_ACTION, DDL_DROP_PHASE_TABLE, hton, path, db, table)); } -bool ddl_log_drop_view(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_view(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *path, const LEX_CSTRING *db, const LEX_CSTRING *table) { DBUG_ENTER("ddl_log_drop_view"); - DBUG_RETURN(ddl_log_drop(thd, ddl_state, + DBUG_RETURN(ddl_log_drop(ddl_state, DDL_LOG_DROP_VIEW_ACTION, 0, (handlerton*) 0, path, db, table)); } -bool ddl_log_drop_trigger(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_trigger(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db, const LEX_CSTRING *table, const LEX_CSTRING *trigger_name, @@ -3284,7 +3284,7 @@ bool ddl_log_drop_trigger(THD *thd, DDL_LOG_STATE *ddl_state, link to the previous entries (not setting ddl_log_entry.next_entry) */ -bool ddl_log_drop_db(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_db(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db, const LEX_CSTRING *path) { DDL_LOG_ENTRY ddl_log_entry; @@ -3305,7 +3305,7 @@ bool ddl_log_drop_db(THD *thd, DDL_LOG_STATE *ddl_state, example when deleting a table that was discovered. */ -bool ddl_log_create_table(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_create_table(DDL_LOG_STATE *ddl_state, handlerton *hton, const LEX_CSTRING *path, const LEX_CSTRING *db, @@ -3333,7 +3333,7 @@ bool ddl_log_create_table(THD *thd, DDL_LOG_STATE *ddl_state, Log CREATE VIEW */ -bool ddl_log_create_view(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_create_view(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *path, enum_ddl_log_create_view_phase phase) { @@ -3351,14 +3351,13 @@ bool ddl_log_create_view(THD *thd, DDL_LOG_STATE *ddl_state, /** Log creation of temporary file that should be deleted during recovery - @param thd Thread handler @param ddl_log_state ddl_state @param path Path to file to be deleted @param depending_state If not NULL, then do not delete the temp file if this entry exists and is active. */ -bool ddl_log_delete_tmp_file(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_delete_tmp_file(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *path, DDL_LOG_STATE *depending_state) { @@ -3379,7 +3378,7 @@ bool ddl_log_delete_tmp_file(THD *thd, DDL_LOG_STATE *ddl_state, Log CREATE TRIGGER */ -bool ddl_log_create_trigger(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_create_trigger(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db, const LEX_CSTRING *table, const LEX_CSTRING *trigger_name, enum_ddl_log_create_trigger_phase phase) @@ -3404,7 +3403,7 @@ bool ddl_log_create_trigger(THD *thd, DDL_LOG_STATE *ddl_state, this is the final table name */ -bool ddl_log_alter_table(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_alter_table(DDL_LOG_STATE *ddl_state, handlerton *org_hton, const LEX_CSTRING *db, const LEX_CSTRING *table, handlerton *new_hton, diff --git a/sql/ddl_log.h b/sql/ddl_log.h index 9960855a813a9..88f6695fc72d7 100644 --- a/sql/ddl_log.h +++ b/sql/ddl_log.h @@ -287,61 +287,59 @@ bool ddl_log_execute_entry(THD *thd, uint first_entry); void ddl_log_add_entry(DDL_LOG_STATE *state, DDL_LOG_MEMORY_ENTRY *log_entry); void ddl_log_release_entries(DDL_LOG_STATE *ddl_log_state); -bool ddl_log_rename_table(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_rename_table(DDL_LOG_STATE *ddl_state, handlerton *hton, const LEX_CSTRING *org_db, const LEX_CSTRING *org_alias, const LEX_CSTRING *new_db, const LEX_CSTRING *new_alias); -bool ddl_log_rename_view(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_rename_view(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *org_db, const LEX_CSTRING *org_alias, const LEX_CSTRING *new_db, const LEX_CSTRING *new_alias); -bool ddl_log_drop_table_init(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_table_init(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db, const LEX_CSTRING *comment); -bool ddl_log_drop_view_init(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_view_init(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db); -bool ddl_log_drop_table(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_table(DDL_LOG_STATE *ddl_state, handlerton *hton, const LEX_CSTRING *path, const LEX_CSTRING *db, const LEX_CSTRING *table); -bool ddl_log_drop_view(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_view(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *path, const LEX_CSTRING *db, const LEX_CSTRING *table); -bool ddl_log_drop_trigger(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_trigger(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db, const LEX_CSTRING *table, const LEX_CSTRING *trigger_name, const LEX_CSTRING *query); -bool ddl_log_drop_view(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_view(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *path, const LEX_CSTRING *db, const LEX_CSTRING *table); -bool ddl_log_drop_view(THD *thd, DDL_LOG_STATE *ddl_state, - const LEX_CSTRING *db); -bool ddl_log_drop_db(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_drop_db(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db, const LEX_CSTRING *path); -bool ddl_log_create_table(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_create_table(DDL_LOG_STATE *ddl_state, handlerton *hton, const LEX_CSTRING *path, const LEX_CSTRING *db, const LEX_CSTRING *table, bool only_frm); -bool ddl_log_create_view(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_create_view(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *path, enum_ddl_log_create_view_phase phase); -bool ddl_log_delete_tmp_file(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_delete_tmp_file(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *path, DDL_LOG_STATE *depending_state); -bool ddl_log_create_trigger(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_create_trigger(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db, const LEX_CSTRING *table, const LEX_CSTRING *trigger_name, enum_ddl_log_create_trigger_phase phase); -bool ddl_log_alter_table(THD *thd, DDL_LOG_STATE *ddl_state, +bool ddl_log_alter_table(DDL_LOG_STATE *ddl_state, handlerton *org_hton, const LEX_CSTRING *db, const LEX_CSTRING *table, handlerton *new_hton, diff --git a/sql/field.cc b/sql/field.cc index fd8ffe3333c02..6b782f79d3aee 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2569,9 +2569,7 @@ Field *Field::make_new_field(MEM_ROOT *root, TABLE *new_table, */ tmp->unireg_check= Field::NONE; tmp->flags&= (NOT_NULL_FLAG | BLOB_FLAG | UNSIGNED_FLAG | - ZEROFILL_FLAG | BINARY_FLAG | ENUM_FLAG | SET_FLAG | - VERS_ROW_START | VERS_ROW_END | - VERS_UPDATE_UNVERSIONED_FLAG); + ZEROFILL_FLAG | BINARY_FLAG | ENUM_FLAG | SET_FLAG); tmp->reset_fields(); tmp->invisible= VISIBLE; return tmp; @@ -11306,7 +11304,13 @@ bool Field::save_in_field_default_value(bool view_error_processing) This condition will go away as well as other conditions with vers_sys_field(). */ if (vers_sys_field()) + { + if (flags & VERS_ROW_START) + set_time(); + else + set_max(); return false; + } if (unlikely(flags & NO_DEFAULT_VALUE_FLAG && real_type() != MYSQL_TYPE_ENUM)) diff --git a/sql/handler.cc b/sql/handler.cc index 2e475404da29d..837a7be7ad629 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -8088,7 +8088,7 @@ static Create_field *vers_init_sys_field(THD *thd, const char *field_name, int f f->field_name.str= field_name; f->field_name.length= strlen(field_name); f->charset= system_charset_info; - f->flags= flags | NOT_NULL_FLAG; + f->flags= flags | NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG; if (integer) { f->set_handler(&type_handler_vers_trx_id); diff --git a/sql/handler.h b/sql/handler.h index dcff4e2c1b410..51266185e5913 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -2665,56 +2665,6 @@ typedef struct st_key_create_information } KEY_CREATE_INFO; -/* - Class for maintaining hooks used inside operations on tables such - as: create table functions, delete table functions, and alter table - functions. - - Class is using the Template Method pattern to separate the public - usage interface from the private inheritance interface. This - imposes no overhead, since the public non-virtual function is small - enough to be inlined. - - The hooks are usually used for functions that does several things, - e.g., create_table_from_items(), which both create a table and lock - it. - */ -class TABLEOP_HOOKS -{ -public: - TABLEOP_HOOKS() {} - virtual ~TABLEOP_HOOKS() {} - - inline void prelock(TABLE **tables, uint count) - { - do_prelock(tables, count); - } - - inline int postlock(TABLE **tables, uint count) - { - return do_postlock(tables, count); - } -private: - /* Function primitive that is called prior to locking tables */ - virtual void do_prelock(TABLE **tables, uint count) - { - /* Default is to do nothing */ - } - - /** - Primitive called after tables are locked. - - If an error is returned, the tables will be unlocked and error - handling start. - - @return Error code or zero. - */ - virtual int do_postlock(TABLE **tables, uint count) - { - return 0; /* Default is to do nothing */ - } -}; - typedef struct st_savepoint SAVEPOINT; extern ulong savepoint_alloc_size; extern KEY_CREATE_INFO default_key_create_info; diff --git a/sql/log_event.cc b/sql/log_event.cc index d4d672e1dca68..b7a23d0d17fb8 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2343,7 +2343,8 @@ void Format_description_log_event::calc_server_version_split() void Format_description_log_event::deduct_options_written_to_bin_log() { options_written_to_bin_log= OPTION_AUTO_IS_NULL | OPTION_NOT_AUTOCOMMIT | - OPTION_NO_FOREIGN_KEY_CHECKS | OPTION_RELAXED_UNIQUE_CHECKS; + OPTION_NO_FOREIGN_KEY_CHECKS | OPTION_RELAXED_UNIQUE_CHECKS | + OPTION_INSERT_HISTORY; if (!server_version_split.version_is_valid() || server_version_split.kind == master_version_split::KIND_MYSQL || server_version_split < Version(10,5,2)) diff --git a/sql/log_event.h b/sql/log_event.h index 272c202fb48d7..4976fcaaa175f 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -529,7 +529,8 @@ class String; */ #define OPTIONS_WRITTEN_TO_BIN_LOG (OPTION_EXPLICIT_DEF_TIMESTAMP |\ OPTION_AUTO_IS_NULL | OPTION_NO_FOREIGN_KEY_CHECKS | \ - OPTION_RELAXED_UNIQUE_CHECKS | OPTION_NOT_AUTOCOMMIT | OPTION_IF_EXISTS) + OPTION_RELAXED_UNIQUE_CHECKS | OPTION_NOT_AUTOCOMMIT | OPTION_IF_EXISTS |\ + OPTION_INSERT_HISTORY) #define CHECKSUM_CRC32_SIGNATURE_LEN 4 /** diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc index 92adb98d8c7f3..15d3ae8921b3b 100644 --- a/sql/log_event_client.cc +++ b/sql/log_event_client.cc @@ -1911,6 +1911,9 @@ bool Query_log_event::print_query_header(IO_CACHE* file, print_set_option(file, tmp, mask & OPTION_EXPLICIT_DEF_TIMESTAMP, flags2, "@@session.explicit_defaults_for_timestamp", &need_comma) || + print_set_option(file, tmp, mask & OPTION_INSERT_HISTORY, flags2, + "@@session.system_versioning_insert_history", + &need_comma) || my_b_printf(file,"%s\n", print_event_info->delimiter)) goto err; print_event_info->flags2= flags2; diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index 98325fe74981f..535a2cf93de40 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -1042,7 +1042,8 @@ void Query_log_event::pack_info(Protocol *protocol) if (flags2 & (OPTION_NO_FOREIGN_KEY_CHECKS | OPTION_AUTO_IS_NULL | OPTION_RELAXED_UNIQUE_CHECKS | OPTION_NO_CHECK_CONSTRAINT_CHECKS | - OPTION_IF_EXISTS)) + OPTION_IF_EXISTS | + OPTION_INSERT_HISTORY)) { buf.append(STRING_WITH_LEN("set ")); if (flags2 & OPTION_NO_FOREIGN_KEY_CHECKS) @@ -1055,6 +1056,8 @@ void Query_log_event::pack_info(Protocol *protocol) buf.append(STRING_WITH_LEN("check_constraint_checks=1, ")); if (flags2 & OPTION_IF_EXISTS) buf.append(STRING_WITH_LEN("@@sql_if_exists=1, ")); + if (flags2 & OPTION_INSERT_HISTORY) + buf.append(STRING_WITH_LEN("@@system_versioning_insert_history=1, ")); buf[buf.length()-2]=';'; } if (query && q_len) @@ -6047,6 +6050,12 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) &m_cols_ai : &m_cols); bitmap_intersect(table->write_set, after_image); + if (table->versioned()) + { + bitmap_set_bit(table->write_set, table->s->vers.start_fieldno); + bitmap_set_bit(table->write_set, table->s->vers.end_fieldno); + } + this->slave_exec_mode= slave_exec_mode_options; // fix the mode // Do event specific preparations @@ -7681,8 +7690,6 @@ Rows_log_event::write_row(rpl_group_info *rgi, if (table->versioned(VERS_TIMESTAMP)) { ulong sec_part; - bitmap_set_bit(table->read_set, table->vers_start_field()->field_index); - table->file->column_bitmaps_signal(); // Check whether a row came from unversioned table and fix vers fields. if (table->vers_start_field()->get_timestamp(&sec_part) == 0 && sec_part == 0) table->vers_update_fields(); @@ -8207,18 +8214,15 @@ int Rows_log_event::find_row(rpl_group_info *rgi) { Field *row_end= table->vers_end_field(); DBUG_ASSERT(table->read_set); - bitmap_set_bit(table->read_set, row_end->field_index); // check whether master table is unversioned if (row_end->val_int() == 0) { - bitmap_set_bit(table->write_set, row_end->field_index); // Plain source table may have a PRIMARY KEY. And row_end is always // a part of PRIMARY KEY. Set it to max value for engine to find it in // index. Needed for an UPDATE/DELETE cases. table->vers_end_field()->set_max(); m_vers_from_plain= true; } - table->file->column_bitmaps_signal(); } DBUG_PRINT("info",("looking for the following record")); @@ -8578,7 +8582,6 @@ int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi) if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP)) { Field *end= m_table->vers_end_field(); - bitmap_set_bit(m_table->write_set, end->field_index); store_record(m_table, record[1]); end->set_time(); error= m_table->file->ha_update_row(m_table->record[1], diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc index 934226685a925..100b4c250967a 100644 --- a/sql/mysql_install_db.cc +++ b/sql/mysql_install_db.cc @@ -438,7 +438,10 @@ static constexpr const char* update_root_passwd= "UPDATE mysql.global_priv SET priv=json_set(priv," "'$.password_last_changed', UNIX_TIMESTAMP()," "'$.plugin','mysql_native_password'," - "'$.authentication_string','%s') where User='root';\n"; + "'$.authentication_string','%s'," + "'$.auth_or', json_array(json_object(), json_object('plugin', 'gssapi','authentication_string','SID:BA'))" + ") where User= 'root';\n "; + static constexpr char remove_default_user_cmd[]= "DELETE FROM mysql.user where User='';\n"; static constexpr char allow_remote_root_access_cmd[]= diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5a26900beb9cd..8922186ab8a6c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2008, 2022, MariaDB + Copyright (c) 2008, 2023, 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 @@ -137,7 +137,6 @@ #define mysqld_charset &my_charset_latin1 - extern "C" { // Because of SCO 3.2V4.2 #include #ifndef __GNU_LIBRARY__ @@ -2293,7 +2292,7 @@ static void activate_tcp_port(uint port, Dynamic_array *sockets, bool is_extra_port= false) { - struct addrinfo *ai, *a; + struct addrinfo *ai, *a = NULL, *head = NULL; struct addrinfo hints; int error; int arg; @@ -2314,16 +2313,52 @@ static void activate_tcp_port(uint port, real_bind_addr_str= my_bind_addr_str; my_snprintf(port_buf, NI_MAXSERV, "%d", port); - error= getaddrinfo(real_bind_addr_str, port_buf, &hints, &ai); - if (unlikely(error != 0)) + + if (real_bind_addr_str && *real_bind_addr_str) { - DBUG_PRINT("error",("Got error: %d from getaddrinfo()", error)); - sql_print_error("%s: %s", ER_DEFAULT(ER_IPSOCK_ERROR), gai_strerror(error)); - unireg_abort(1); /* purecov: tested */ + char *end; + char address[FN_REFLEN]; + + do + { + end= strcend(real_bind_addr_str, ','); + strmake(address, real_bind_addr_str, (uint) (end - real_bind_addr_str)); + + error= getaddrinfo(address, port_buf, &hints, &ai); + if (unlikely(error != 0)) + { + DBUG_PRINT("error", ("Got error: %d from getaddrinfo()", error)); + + sql_print_error("%s: %s", ER_DEFAULT(ER_IPSOCK_ERROR), + gai_strerror(error)); + unireg_abort(1); /* purecov: tested */ + } + + if (!head) + { + head= ai; + } + if (a) + { + a->ai_next= ai; + } + a= ai; + while (a->ai_next) + { + a= a->ai_next; + } + + real_bind_addr_str= end + 1; + } while (*end); + } + else + { + error= getaddrinfo(real_bind_addr_str, port_buf, &hints, &ai); + head= ai; } - for (a= ai; a != NULL; a= a->ai_next) + for (a= head; a != NULL; a= a->ai_next) { ip_sock= mysql_socket_socket(key_socket_tcpip, a->ai_family, a->ai_socktype, a->ai_protocol); @@ -2412,9 +2447,31 @@ static void activate_tcp_port(uint port, if (ret < 0) { char buff[100]; + int s_errno= socket_errno; sprintf(buff, "Can't start server: Bind on TCP/IP port. Got error: %d", - (int) socket_errno); + (int) s_errno); sql_perror(buff); + /* + Linux will quite happily bind to addresses not present. The + mtr test main.bind_multiple_addresses_resolution relies on this. + For Windows, this is fatal and generates the error: + WSAEADDRNOTAVAIL: The requested address is not valid in its context + In this case, where multiple addresses where specified, maybe + we can live with an error in the log and hope the other addresses + are successful. We catch if no successful bindings occur at the + end of this function. + + FreeBSD returns EADDRNOTAVAIL, and EADDRNOTAVAIL is even in Linux + manual pages. So may was well apply uniform behaviour. + */ +#ifdef _WIN32 + if (s_errno == WSAEADDRNOTAVAIL) + continue; +#endif +#ifdef EADDRNOTAVAIL + if (s_errno == EADDRNOTAVAIL) + continue; +#endif sql_print_error("Do you already have another server running on " "port: %u ?", port); unireg_abort(1); @@ -2435,7 +2492,12 @@ static void activate_tcp_port(uint port, } } - freeaddrinfo(ai); + freeaddrinfo(head); + if (head && sockets->size() == 0) + { + sql_print_error("No TCP address could be bound to"); + unireg_abort(1); + } DBUG_VOID_RETURN; } @@ -5257,6 +5319,10 @@ static int init_server_components() MARIADB_REMOVED_OPTION("innodb-thread-concurrency"), MARIADB_REMOVED_OPTION("innodb-thread-sleep-delay"), MARIADB_REMOVED_OPTION("innodb-undo-logs"), + + /* The following options were deprecated in 10.9 */ + MARIADB_REMOVED_OPTION("innodb-change-buffering"), + {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; /* @@ -6557,7 +6623,7 @@ struct my_option my_long_options[]= "names at once (in 'datadir') and is normally the only option you need " "for specifying log files. Sets names for --log-bin, --log-bin-index, " "--relay-log, --relay-log-index, --general-log-file, " - "--log-slow-query-log-file, --log-error-file, and --pid-file", + "--log-slow-query-file, --log-error-file, and --pid-file", &opt_log_basename, &opt_log_basename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"log-bin", OPT_BIN_LOG, @@ -8087,45 +8153,11 @@ mysqld_get_one_option(const struct my_option *opt, const char *argument, case (int)OPT_REPLICATE_REWRITE_DB: { /* See also OPT_REWRITE_DB handling in client/mysqlbinlog.cc */ - const char* key= argument, *ptr, *val; - - // Skipp pre-space in key - while (*key && my_isspace(mysqld_charset, *key)) - key++; - - // Where val begins - if (!(ptr= strstr(key, "->"))) + if (cur_rpl_filter->add_rewrite_db(argument)) { - sql_print_error("Bad syntax in replicate-rewrite-db: missing '->'"); + sql_print_error("Bad syntax in replicate-rewrite-db.Expected syntax is FROM->TO."); return 1; } - val= ptr+2; - - // Skip blanks at the end of key - while (ptr > key && my_isspace(mysqld_charset, ptr[-1])) - ptr--; - if (ptr == key) - { - sql_print_error("Bad syntax in replicate-rewrite-db - empty FROM db"); - return 1; - } - key= strmake_root(&startup_root, key, (size_t) (ptr-key)); - - /* Skipp pre space in value */ - while (*val && my_isspace(mysqld_charset, *val)) - val++; - - // Value ends with \0 or space - for (ptr= val; *ptr && !my_isspace(&my_charset_latin1, *ptr) ; ptr++) - {} - if (ptr == val) - { - sql_print_error("Bad syntax in replicate-rewrite-db - empty TO db"); - return 1; - } - val= strmake_root(&startup_root, val, (size_t) (ptr-val)); - - cur_rpl_filter->add_db_rewrite(key, val); break; } case (int)OPT_SLAVE_PARALLEL_MODE: diff --git a/sql/mysqld.h b/sql/mysqld.h index efa072272c543..2d9a4842d8c26 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -309,6 +309,7 @@ extern uint default_password_lifetime; extern my_bool disconnect_on_expired_password; enum secure_timestamp { SECTIME_NO, SECTIME_SUPER, SECTIME_REPL, SECTIME_YES }; +bool is_set_timestamp_forbidden(THD *thd); #ifdef HAVE_MMAP extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, diff --git a/sql/privilege.h b/sql/privilege.h index f6980aeb6b1db..8e9b9a3748e35 100644 --- a/sql/privilege.h +++ b/sql/privilege.h @@ -390,10 +390,10 @@ constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_SYNC_BINLOG= /* Privileges related to --read-only */ // Was super prior to 10.5.2 -constexpr privilege_t PRIV_IGNORE_READ_ONLY= READ_ONLY_ADMIN_ACL | SUPER_ACL; +constexpr privilege_t PRIV_IGNORE_READ_ONLY= READ_ONLY_ADMIN_ACL; // Was super prior to 10.5.2 constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_READ_ONLY= - READ_ONLY_ADMIN_ACL | SUPER_ACL; + READ_ONLY_ADMIN_ACL; /* Privileges related to connection handling. @@ -546,6 +546,8 @@ constexpr privilege_t PRIV_SET_SYSTEM_SESSION_VAR_GTID_DOMAIN_ID= */ constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_EVENTS_MARKED_FOR_SKIP= REPL_SLAVE_ADMIN_ACL | SUPER_ACL; +constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_REWRITE_DB= + REPL_SLAVE_ADMIN_ACL | SUPER_ACL; constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_DO_DB= REPL_SLAVE_ADMIN_ACL | SUPER_ACL; constexpr privilege_t PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_DO_TABLE= diff --git a/sql/protocol.cc b/sql/protocol.cc index eee6236ffe71a..26bc94c146320 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -1374,21 +1374,49 @@ bool Protocol::store(I_List* str_list) { char buf[256]; String tmp(buf, sizeof(buf), &my_charset_bin); - uint32 len; + size_t len= 0; I_List_iterator it(*str_list); i_string* s; + const char *delimiter= ","; tmp.length(0); while ((s=it++)) { + tmp.append(delimiter, len); tmp.append(s->ptr, strlen(s->ptr)); - tmp.append(','); + len= 1; } - if ((len= tmp.length())) - len--; // Remove last ',' - return store((char*) tmp.ptr(), len, tmp.charset()); + + return store((char*) tmp.ptr(), tmp.length(), tmp.charset()); +} + + +/** + Send a set of strings as a string of key-value pairs with ',' in between. +*/ + +bool Protocol::store(I_List* str_list) +{ + char buf[256]; + const char *delimiter= ","; + String tmp(buf, sizeof(buf), &my_charset_bin); + size_t delim_len= 0; + I_List_iterator it(*str_list); + i_string_pair* s; + + tmp.length(0); + while ((s=it++)) + { + tmp.append(delimiter, delim_len); + tmp.append(s->key, strlen(s->key)); + tmp.append(STRING_WITH_LEN("->")); + tmp.append(s->val, strlen(s->val)); + delim_len= 1; + } + return store((char*) tmp.ptr(), tmp.length(), tmp.charset()); } + /**************************************************************************** Functions to handle the simple (default) protocol where everything is This protocol is the one that is used by default between the MySQL server diff --git a/sql/protocol.h b/sql/protocol.h index f095ad68a345c..39569a825d573 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -99,6 +99,7 @@ class Protocol bool send_result_set_row(List *row_items); bool store(I_List *str_list); + bool store(I_List *str_list); bool store_string_or_null(const char *from, CHARSET_INFO *cs); bool store_warning(const char *from, size_t length); String *storage_packet() { return packet; } diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc index 1e1f98c1e3e51..982c0c9482df7 100644 --- a/sql/rpl_filter.cc +++ b/sql/rpl_filter.cc @@ -48,7 +48,7 @@ Rpl_filter::~Rpl_filter() free_string_array(&wild_ignore_table); free_string_list(&do_db); free_string_list(&ignore_db); - free_list(&rewrite_db); + free_string_pair_list(&rewrite_db); } @@ -470,14 +470,6 @@ Rpl_filter::set_wild_ignore_table(const char* table_spec) } -void -Rpl_filter::add_db_rewrite(const char* from_db, const char* to_db) -{ - i_string_pair *db_pair = new i_string_pair(from_db, to_db); - rewrite_db.push_back(db_pair); -} - - int Rpl_filter::add_table_rule(HASH* h, const char* table_spec) { @@ -520,6 +512,70 @@ Rpl_filter::add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec) } +int +Rpl_filter::add_string_pair_list(const char* spec) +{ + /* See also OPT_REWRITE_DB handling in client/mysqlbinlog.cc */ + char* from_db, *to_db; + const char *ptr, *val_ptr; + size_t len; + + // Remove pre-space in key + while(*spec && my_isspace(system_charset_info, (unsigned char)*spec)) spec++; + + if (!(ptr= strstr(spec, "->"))) + { + // Bad syntax, missing -> + return 1; + } + + // value + val_ptr= ptr + 2; + + // Skip blanks at the end of spec + while(ptr > spec && my_isspace(system_charset_info, ptr[-1])) ptr--; + + if (ptr == spec) + { + // Bad syntax: empty FROM db (key) + return 1; + } + + // key + len= (size_t)(ptr - spec); + if (! (from_db= (char *) my_malloc(PSI_NOT_INSTRUMENTED, len + 1, MYF(0)))) + { + return 1; + } + memcpy(from_db, spec, len); + from_db[len]='\0'; + + // Remove pre-space in val + while(*val_ptr && my_isspace(system_charset_info, (unsigned char)*val_ptr)) val_ptr++; + // Value ends with \0 or space + if (!strlen(val_ptr)) + { + // Bad syntax: Empty value \n" + my_free(from_db); + return 1; + } + + for (ptr= val_ptr; *ptr && !my_isspace(system_charset_info, *ptr); ptr++){} + // value + len= (size_t)(ptr - val_ptr); + if(! (to_db= (char *) my_malloc(PSI_NOT_INSTRUMENTED, len + 1, MYF(0)))) + { + my_free(from_db); + return 1; + } + memcpy(to_db, val_ptr, len); + to_db[len]='\0'; + i_string_pair *db_pair = new i_string_pair(from_db, to_db); + rewrite_db.push_back(db_pair); + return false; +} + + int Rpl_filter::add_string_list(I_List *list, const char* spec) { @@ -541,6 +597,14 @@ Rpl_filter::add_string_list(I_List *list, const char* spec) } +int +Rpl_filter::add_rewrite_db(const char* table_spec) +{ + DBUG_ENTER("Rpl_filter::add_rewrite_db"); + DBUG_RETURN(add_string_pair_list(table_spec)); +} + + int Rpl_filter::add_do_db(const char* table_spec) { @@ -557,6 +621,14 @@ Rpl_filter::add_ignore_db(const char* table_spec) } +int +Rpl_filter::set_rewrite_db(const char* db_spec) +{ + free_string_pair_list(&rewrite_db); + return parse_filter_rule(db_spec, &Rpl_filter::add_rewrite_db); +} + + int Rpl_filter::set_do_db(const char* db_spec) { @@ -665,6 +737,21 @@ Rpl_filter::free_string_list(I_List *l) } +void +Rpl_filter::free_string_pair_list(I_List *l) +{ + i_string_pair *tmp; + + while ((tmp= l->get())) + { + my_free((void *) tmp->key); + my_free((void *) tmp->val); + delete tmp; + } + + l->empty(); +} + /* Builds a String from a HASH of TABLE_RULE_ENT. Cannot be used for any other hash, as it assumes that the hash entries are TABLE_RULE_ENT. @@ -749,6 +836,34 @@ Rpl_filter::rewrite_db_is_empty() } +I_List* +Rpl_filter::get_rewrite_db() +{ + return &rewrite_db; +} + + +void +Rpl_filter::db_rewrite_rule_ent_list_to_str(String* str, I_List* list) +{ + I_List_iterator it(*list); + i_string_pair* s; + + str->length(0); + + const char *delimiter= ","; + size_t delim_len= 0; + while ((s= it++)) + { + str->append(delimiter, delim_len); + str->append(s->key, strlen(s->key)); + str->append(STRING_WITH_LEN("->")); + str->append(s->val, strlen(s->val)); + delim_len= 1; + } +} + + const char* Rpl_filter::get_rewrite_db(const char* db, size_t *new_len) { @@ -769,18 +884,6 @@ Rpl_filter::get_rewrite_db(const char* db, size_t *new_len) } -void -Rpl_filter::copy_rewrite_db(Rpl_filter *from) -{ - I_List_iterator it(from->rewrite_db); - i_string_pair* tmp; - DBUG_ASSERT(rewrite_db.is_empty()); - - /* TODO: Add memory checking here and in all add_xxxx functions ! */ - while ((tmp=it++)) - add_db_rewrite(tmp->key, tmp->val); -} - I_List* Rpl_filter::get_do_db() { @@ -815,6 +918,13 @@ Rpl_filter::db_rule_ent_list_to_str(String* str, I_List* list) } +void +Rpl_filter::get_rewrite_db(String* str) +{ + db_rewrite_rule_ent_list_to_str(str, get_rewrite_db()); +} + + void Rpl_filter::get_do_db(String* str) { diff --git a/sql/rpl_filter.h b/sql/rpl_filter.h index f22ec8a0ce4f0..ee3b9d516b710 100644 --- a/sql/rpl_filter.h +++ b/sql/rpl_filter.h @@ -71,9 +71,11 @@ class Rpl_filter int set_wild_do_table(const char* table_spec); int set_wild_ignore_table(const char* table_spec); + int add_rewrite_db(const char* table_spec); int add_do_db(const char* db_spec); int add_ignore_db(const char* db_spec); + int set_rewrite_db(const char* db_spec); int set_do_db(const char* db_spec); int set_ignore_db(const char* db_spec); @@ -87,8 +89,6 @@ class Rpl_filter return parallel_mode; } - void add_db_rewrite(const char* from_db, const char* to_db); - /* Getters - to get information about current rules */ void get_do_table(String* str); @@ -98,8 +98,9 @@ class Rpl_filter void get_wild_ignore_table(String* str); bool rewrite_db_is_empty(); + I_List* get_rewrite_db(); + void get_rewrite_db(String *str); const char* get_rewrite_db(const char* db, size_t *new_len); - void copy_rewrite_db(Rpl_filter *from); I_List* get_do_db(); I_List* get_ignore_db(); @@ -121,15 +122,17 @@ class Rpl_filter void free_string_array(DYNAMIC_ARRAY *a); void free_string_list(I_List *l); + void free_string_pair_list(I_List *l); void table_rule_ent_hash_to_str(String* s, HASH* h, bool inited); void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a, bool inited); + void db_rewrite_rule_ent_list_to_str(String*, I_List*); void db_rule_ent_list_to_str(String* s, I_List* l); TABLE_RULE_ENT* find_wild(DYNAMIC_ARRAY *a, const char* key, int len); int add_string_list(I_List *list, const char* spec); - + int add_string_pair_list(const char* my_spec); /* Those 4 structures below are uninitialized memory unless the corresponding *_inited variables are "true". diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index ab2523d960b65..3c698f27a19f4 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -1024,10 +1024,12 @@ void copy_filter_setting(Rpl_filter* dst_filter, Rpl_filter* src_filter) dst_filter->set_wild_ignore_table(tmp.ptr()); } - if (dst_filter->rewrite_db_is_empty()) + dst_filter->get_rewrite_db(&tmp); + if (tmp.is_empty()) { - if (!src_filter->rewrite_db_is_empty()) - dst_filter->copy_rewrite_db(src_filter); + src_filter->get_rewrite_db(&tmp); + if (!tmp.is_empty()) + dst_filter->set_rewrite_db(tmp.ptr()); } } diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 530ab9c1ed258..65a7e613b7244 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6304,11 +6304,8 @@ ER_VIEW_FRM_NO_USER eng "View '%-.192s'.'%-.192s' has no definer information (old table format). Current user is used as definer. Please recreate the view!" ger "View '%-.192s'.'%-.192s' hat keine Definierer-Information (altes Tabellenformat). Der aktuelle Benutzer wird als Definierer verwendet. Bitte erstellen Sie den View neu" spa "La vista '%-.192s'.'%-.192s' no tiene información de definidor (formato viejo de tabla). Se usa el usuario actual como definidor. Por favor, ¡recrea la vista!" -ER_VIEW_OTHER_USER - chi "您需要使用'%-.192s'@'%-.192s'的创建视图的超级特权" - eng "You need the SUPER privilege for creation view with '%-.192s'@'%-.192s' definer" - ger "Sie brauchen die SUPER-Berechtigung, um einen View mit dem Definierer '%-.192s'@'%-.192s' zu erzeugen" - spa "Vd necesita el privilegio SUPER para la creación de la vista con definidor '%-.192s'@'%-.192s'" +ER_UNUSED_30 + eng "You should never see it" ER_NO_SUCH_USER chi "指定为定义的用户('%-.64s'@'%-.64s')不存在" eng "The user specified as a definer ('%-.64s'@'%-.64s') does not exist" @@ -9995,9 +9992,8 @@ ER_UNKNOWN_DATA_TYPE ER_UNKNOWN_OPERATOR eng "Operator does not exists: '%-.128s'" spa "El operador no existe: '%-.128s'" -ER_WARN_HISTORY_ROW_START_TIME - eng "Table `%s.%s` history row start '%s' is later than row end '%s'" - spa "En la historia de la tabla `%s.%s` el inicio de fila '%s' es posterior al fin de fila '%s'" +ER_UNUSED_29 + eng "You should never see it" ER_PART_STARTS_BEYOND_INTERVAL eng "%`s: STARTS is later than query time, first history partition may exceed INTERVAL value" spa "%`s: STARTS es posterior al momento de consulta (query), la primera partición de historia puede exceder el valor INTERVAL" diff --git a/sql/slave.cc b/sql/slave.cc index eac1326df342e..04831e1f18b6f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2954,6 +2954,9 @@ void show_master_info_get_fields(THD *thd, List *field_list, field_list->push_back(new (mem_root) Item_empty_string(thd, "Slave_SQL_Running", 3), mem_root); + field_list->push_back(new (mem_root) + Item_empty_string(thd, "Replicate_Rewrite_DB", 23), + mem_root); field_list->push_back(new (mem_root) Item_empty_string(thd, "Replicate_Do_DB", 20), mem_root); @@ -3209,6 +3212,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, &my_charset_bin); protocol->store(&slave_running[mi->slave_running], &my_charset_bin); protocol->store(mi->rli.slave_running ? &msg_yes : &msg_no, &my_charset_bin); + protocol->store(rpl_filter->get_rewrite_db()); protocol->store(rpl_filter->get_do_db()); protocol->store(rpl_filter->get_ignore_db()); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 40121e4e9ac98..f686d12b9ea31 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -103,8 +103,10 @@ LEX_CSTRING host_not_specified= { STRING_WITH_LEN("%") }; */ LEX_CSTRING current_user= { STRING_WITH_LEN("*current_user") }; LEX_CSTRING current_role= { STRING_WITH_LEN("*current_role") }; -LEX_CSTRING current_user_and_current_role= { STRING_WITH_LEN("*current_user_and_current_role") }; - +LEX_CSTRING current_user_and_current_role= + { STRING_WITH_LEN("*current_user_and_current_role") }; +LEX_CSTRING none= {STRING_WITH_LEN("NONE") }; +LEX_CSTRING public_name= {STRING_WITH_LEN("PUBLIC") }; static plugin_ref old_password_plugin; static plugin_ref native_password_plugin; @@ -129,6 +131,10 @@ struct acl_host_and_ip #ifndef NO_EMBEDDED_ACCESS_CHECKS static bool compare_hostname(const acl_host_and_ip *, const char *, const char *); +static inline bool is_public(const char *l) { return l == public_name.str; } +static inline bool is_public(const LEX_CSTRING *l) { return is_public(l->str); } +static inline bool is_public(const LEX_USER *l) { return is_public(&l->user); } + #else #define compare_hostname(X,Y,Z) 0 #endif @@ -279,8 +285,8 @@ class ACL_ROLE :public ACL_USER_BASE uint counter; DYNAMIC_ARRAY parent_grantee; // array of backlinks to elements granted - ACL_ROLE(ACL_USER * user, MEM_ROOT *mem); - ACL_ROLE(const char * rolename, privilege_t privileges, MEM_ROOT *mem); + ACL_ROLE(ACL_USER *user); + ACL_ROLE(const char *rolename, privilege_t privileges, MEM_ROOT *mem); }; @@ -317,6 +323,13 @@ static bool show_table_and_column_privileges(THD *, const char *, const char *, static int show_routine_grants(THD *, const char *, const char *, const Sp_handler *sph, char *, int); +static ACL_ROLE *acl_public= NULL; + +inline privilege_t public_access() +{ + return (acl_public ? acl_public->access : NO_ACL); +} + class Grant_tables; class User_table; class Proxies_priv_table; @@ -685,7 +698,7 @@ static void rebuild_check_host(void); static void rebuild_role_grants(void); static ACL_USER *find_user_exact(const char *host, const char *user); static ACL_USER *find_user_wild(const char *host, const char *user, const char *ip= 0); -static ACL_ROLE *find_acl_role(const char *user); +static ACL_ROLE *find_acl_role(const char *user, bool allow_public); static ROLE_GRANT_PAIR *find_role_grant_pair(const LEX_CSTRING *u, const LEX_CSTRING *h, const LEX_CSTRING *r); static ACL_USER_BASE *find_acl_user_base(const char *user, const char *host); static bool update_user_table_password(THD *, const User_table&, const ACL_USER&); @@ -1532,6 +1545,11 @@ class User_table_json: public User_table { privilege_t mask= ALL_KNOWN_ACL_100304; ulonglong orig_access= access; + if (version_id < 101100) + { + if (access & SUPER_ACL) + access|= READ_ONLY_ADMIN_ACL; + } if (version_id >= 100509) { mask= ALL_KNOWN_ACL_100509; @@ -2168,7 +2186,7 @@ enum enum_acl_lists ROLES_MAPPINGS_HASH }; -ACL_ROLE::ACL_ROLE(ACL_USER *user, MEM_ROOT *root) +ACL_ROLE::ACL_ROLE(ACL_USER *user) : /* set initial role access the same as the table row privileges */ initial_role_access(user->access), @@ -2180,25 +2198,49 @@ ACL_ROLE::ACL_ROLE(ACL_USER *user, MEM_ROOT *root) flags= IS_ROLE; } -ACL_ROLE::ACL_ROLE(const char * rolename, privilege_t privileges, - MEM_ROOT *root) : - initial_role_access(privileges), counter(0) +ACL_ROLE::ACL_ROLE(const char *rolename, privilege_t privileges, MEM_ROOT *root) + : initial_role_access(privileges), counter(0) { this->access= initial_role_access; - this->user.str= safe_strdup_root(root, rolename); - this->user.length= strlen(rolename); + if (is_public(rolename)) + this->user= public_name; + else + { + this->user.str= safe_strdup_root(root, rolename); + this->user.length= strlen(rolename); + } bzero(&parent_grantee, sizeof(parent_grantee)); flags= IS_ROLE; } +enum role_name_check_result +{ + ROLE_NAME_OK= 0, + ROLE_NAME_PUBLIC, + ROLE_NAME_INVALID +}; -static bool is_invalid_role_name(const char *str) +static role_name_check_result check_role_name(LEX_CSTRING *str, + bool public_is_ok) { - if (*str && strcasecmp(str, "PUBLIC") && strcasecmp(str, "NONE")) - return false; + if (str->length) + { + if (str->length == public_name.length && + strcasecmp(str->str, public_name.str) == 0) + { + *str= public_name; + if (public_is_ok) + return ROLE_NAME_PUBLIC; + else + goto error; + } + if (str->length != none.length || strcasecmp(str->str, none.str) != 0) + return ROLE_NAME_OK; + } - my_error(ER_INVALID_ROLE, MYF(0), str); - return true; +error: + my_error(ER_INVALID_ROLE, MYF(0), str->str); + return ROLE_NAME_INVALID; } @@ -2627,16 +2669,20 @@ static bool acl_load(THD *thd, const Grant_tables& tables) if (is_role) { - if (is_invalid_role_name(username)) + role_name_check_result result= check_role_name(&user.user, true); + if (result == ROLE_NAME_INVALID) { thd->clear_error(); // the warning is still issued continue; } - ACL_ROLE *entry= new (&acl_memroot) ACL_ROLE(&user, &acl_memroot); + ACL_ROLE *entry= new (&acl_memroot) ACL_ROLE(&user); entry->role_grants = user.role_grants; my_init_dynamic_array(key_memory_acl_mem, &entry->parent_grantee, sizeof(ACL_USER_BASE *), 0, 8, MYF(0)); + if (result == ROLE_NAME_PUBLIC) + acl_public= entry; + my_hash_insert(&acl_roles, (uchar *)entry); continue; @@ -2693,7 +2739,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables) char *db_name; db.user=safe_str(get_field(&acl_memroot, db_table.user())); const char *hostname= get_field(&acl_memroot, db_table.host()); - if (!hostname && find_acl_role(db.user)) + if (!hostname && find_acl_role(db.user, true)) hostname= ""; update_hostname(&db.host, hostname); db.db= db_name= get_field(&acl_memroot, db_table.db()); @@ -2823,6 +2869,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables) void acl_free(bool end) { my_hash_free(&acl_roles); + acl_public= NULL; free_root(&acl_memroot,MYF(0)); delete_dynamic(&acl_hosts); delete_dynamic_with_callback(&acl_users, (FREE_FUNC) free_acl_user); @@ -2867,10 +2914,12 @@ bool acl_reload(THD *thd) DYNAMIC_ARRAY old_acl_hosts, old_acl_users, old_acl_proxy_users; Dynamic_array old_acl_dbs(PSI_INSTRUMENT_MEM, 0, 0); HASH old_acl_roles, old_acl_roles_mappings; + ACL_ROLE *old_acl_public; MEM_ROOT old_mem; int result; DBUG_ENTER("acl_reload"); + Grant_tables tables; /* To avoid deadlocks we should obtain table locks before @@ -2897,6 +2946,7 @@ bool acl_reload(THD *thd) old_acl_hosts= acl_hosts; old_acl_users= acl_users; old_acl_roles= acl_roles; + old_acl_public= acl_public; old_acl_roles_mappings= acl_roles_mappings; old_acl_proxy_users= acl_proxy_users; old_acl_dbs= acl_dbs; @@ -2913,6 +2963,7 @@ bool acl_reload(THD *thd) old_mem= acl_memroot; delete_dynamic(&acl_wild_hosts); my_hash_free(&acl_check_hosts); + acl_public= NULL; if ((result= acl_load(thd, tables))) { // Error. Revert to old list @@ -2921,6 +2972,7 @@ bool acl_reload(THD *thd) acl_hosts= old_acl_hosts; acl_users= old_acl_users; acl_roles= old_acl_roles; + acl_public= old_acl_public; acl_roles_mappings= old_acl_roles_mappings; acl_proxy_users= old_acl_proxy_users; acl_dbs= old_acl_dbs; @@ -3205,7 +3257,7 @@ bool acl_getroot(Security_context *sctx, const char *user, const char *host, } else // Role, not User { - ACL_ROLE *acl_role= find_acl_role(user); + ACL_ROLE *acl_role= find_acl_role(user, false); if (acl_role) { res= 0; @@ -3218,6 +3270,14 @@ bool acl_getroot(Security_context *sctx, const char *user, const char *host, } } + if (acl_public) + { + if (ACL_DB *acl_db= acl_db_find(db, public_name.str, "", "", FALSE)) + sctx->db_access|= acl_db->access; + + sctx->master_access|= acl_public->access; + } + mysql_mutex_unlock(&acl_cache->lock); DBUG_RETURN(res); } @@ -3259,7 +3319,7 @@ static int check_user_can_set_role(THD *thd, const char *user, /* clear role privileges */ mysql_mutex_lock(&acl_cache->lock); - if (!strcasecmp(rolename, "NONE")) + if (!strcasecmp(rolename, none.str)) { /* have to clear the privileges */ /* get the current user */ @@ -3272,7 +3332,7 @@ static int check_user_can_set_role(THD *thd, const char *user, goto end; } - role= find_acl_role(rolename); + role= find_acl_role(rolename, false); /* According to SQL standard, the same error message must be presented */ if (role == NULL) @@ -3303,11 +3363,12 @@ static int check_user_can_set_role(THD *thd, const char *user, } if (access) - { *access = acl_user->access | role->access; - } end: + if (acl_public && access) + *access|= acl_public->access; + mysql_mutex_unlock(&acl_cache->lock); /* We present different error messages depending if the user has sufficient @@ -3377,20 +3438,18 @@ int acl_setrole(THD *thd, const char *rolename, privilege_t access) /* merge the privileges */ Security_context *sctx= thd->security_ctx; sctx->master_access= access; - if (thd->db.str) - sctx->db_access= acl_get(sctx->host, sctx->ip, sctx->user, thd->db.str, FALSE); - - if (!strcasecmp(rolename, "NONE")) + if (!strcasecmp(rolename, none.str)) { thd->security_ctx->priv_role[0]= 0; } else { - if (thd->db.str) - sctx->db_access|= acl_get("", "", rolename, thd->db.str, FALSE); /* mark the current role */ strmake_buf(thd->security_ctx->priv_role, rolename); } + if (thd->db.str) + sctx->db_access= acl_get_all3(sctx, thd->db.str, FALSE); + return 0; } @@ -3404,9 +3463,12 @@ static uchar* check_get_key(ACL_USER *buff, size_t *length, static void acl_update_role(const char *rolename, const privilege_t privileges) { - ACL_ROLE *role= find_acl_role(rolename); + ACL_ROLE *role= find_acl_role(rolename, true); if (role) + { role->initial_role_access= role->access= privileges; + DBUG_ASSERT(strcasecmp(rolename, public_name.str) || acl_public == role); + } } @@ -3528,6 +3590,8 @@ static int acl_user_update(THD *thd, ACL_USER *acl_user, uint nauth, static void acl_insert_role(const char *rolename, privilege_t privileges) { ACL_ROLE *entry; + DBUG_ENTER("acl_insert_role"); + DBUG_PRINT("enter", ("Role: '%s'", rolename)); mysql_mutex_assert_owner(&acl_cache->lock); entry= new (&acl_memroot) ACL_ROLE(rolename, privileges, &acl_memroot); @@ -3537,6 +3601,11 @@ static void acl_insert_role(const char *rolename, privilege_t privileges) sizeof(ACL_ROLE *), 0, 8, MYF(0)); my_hash_insert(&acl_roles, (uchar *)entry); + DBUG_ASSERT(strcasecmp(rolename, public_name.str) || is_public(rolename)); + if (is_public(rolename)) + acl_public= entry; + + DBUG_VOID_RETURN; } @@ -3655,7 +3724,8 @@ privilege_t acl_get(const char *host, const char *ip, if (acl_db->host.hostname) goto exit; // Fully specified. Take it /* the host table is not used for roles */ - if ((!host || !host[0]) && !acl_db->host.hostname && find_acl_role(user)) + if ((!host || !host[0]) && !acl_db->host.hostname && + find_acl_role(user, false)) goto exit; } @@ -3695,6 +3765,23 @@ privilege_t acl_get(const char *host, const char *ip, DBUG_RETURN(db_access & host_access); } +/* + Check if there is access for the host/user, role, public on the database +*/ + +privilege_t acl_get_all3(Security_context *sctx, const char *db, + bool db_is_patern) +{ + privilege_t access= acl_get(sctx->host, sctx->ip, + sctx->priv_user, db, db_is_patern); + if (sctx->priv_role[0]) + access|= acl_get("", "", sctx->priv_role, db, db_is_patern); + if (acl_public) + access|= acl_get("", "", public_name.str, db, db_is_patern); + return access; +} + + /* Check if there are any possible matching entries for this host @@ -3816,7 +3903,7 @@ static bool add_role_user_mapping(const char *uname, const char *hname, const char *rname) { ACL_USER_BASE *grantee= find_acl_user_base(uname, hname); - ACL_ROLE *role= find_acl_role(rname); + ACL_ROLE *role= find_acl_role(rname, false); if (grantee == NULL || role == NULL) return 1; @@ -4169,7 +4256,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user, DBUG_PRINT("enter",("host: '%s' user: '%s' rolename: '%s'", user, safe_str(host), safe_str(rolename))); - if (!strcasecmp(rolename, "NONE")) + if (!strcasecmp(rolename, none.str)) clear_role= TRUE; if (mysql_bin_log.is_open() || @@ -4289,7 +4376,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user, /* - Find user in ACL + Find user in ACL. Uses to check a definer SYNOPSIS is_acl_user() @@ -4297,8 +4384,8 @@ int acl_set_default_role(THD *thd, const char *host, const char *user, user user name RETURN - FALSE user not fond - TRUE there is such user + FALSE definer not fond + TRUE there is such definer */ bool is_acl_user(const char *host, const char *user) @@ -4314,7 +4401,7 @@ bool is_acl_user(const char *host, const char *user) if (*host) // User res= find_user_exact(host, user) != NULL; else // Role - res= find_acl_role(user) != NULL; + res= find_acl_role(user, false) != NULL; mysql_mutex_unlock(&acl_cache->lock); return res; @@ -4364,7 +4451,7 @@ static ACL_USER * find_user_wild(const char *host, const char *user, const char /* Find a role with the specified name */ -static ACL_ROLE *find_acl_role(const char *role) +static ACL_ROLE *find_acl_role(const char *role, bool allow_public) { size_t length= strlen(role); DBUG_ENTER("find_acl_role"); @@ -4373,21 +4460,22 @@ static ACL_ROLE *find_acl_role(const char *role) mysql_mutex_assert_owner(&acl_cache->lock); - if (!length) + if (!length || (!allow_public && strcasecmp(role, public_name.str) == 0)) DBUG_RETURN(NULL); - ACL_ROLE *r= (ACL_ROLE *)my_hash_search(&acl_roles, (uchar *)role, - length); + ACL_ROLE *r= (ACL_ROLE *)my_hash_search(&acl_roles, (uchar *)role, length); DBUG_RETURN(r); } - +/* + Finds a grantee - something that privileges or roles can be granted to. +*/ static ACL_USER_BASE *find_acl_user_base(const char *user, const char *host) { if (*host) return find_user_exact(host, user); - return find_acl_role(user); + return find_acl_role(user, true); } @@ -4603,10 +4691,7 @@ static bool test_if_create_new_users(THD *thd) NULL, TL_WRITE); create_new_users= 1; - db_access=acl_get(sctx->host, sctx->ip, - sctx->priv_user, tl.db.str, 0); - if (sctx->priv_role[0]) - db_access|= acl_get("", "", sctx->priv_role, tl.db.str, 0); + db_access= acl_get_all3(sctx, tl.db.str, FALSE); if (!(db_access & INSERT_ACL)) { if (check_grant(thd, INSERT_ACL, &tl, FALSE, UINT_MAX, TRUE)) @@ -4898,7 +4983,7 @@ static int replace_db_table(TABLE *table, const char *db, if (!find_user_wild(combo.host.str,combo.user.str)) { /* The user could be a role, check if the user is registered as a role */ - if (!combo.host.length && !find_acl_role(combo.user.str)) + if (!combo.host.length && !find_acl_role(combo.user.str, true)) { my_message(ER_PASSWORD_NO_MATCH, ER_THD(table->in_use, ER_PASSWORD_NO_MATCH), MYF(0)); @@ -5410,7 +5495,7 @@ GRANT_NAME::GRANT_NAME(TABLE *form, bool is_routine) const char *hostname= get_field(&grant_memroot, form->field[0]); mysql_mutex_lock(&acl_cache->lock); - if (!hostname && find_acl_role(user)) + if (!hostname && find_acl_role(user, true)) hostname= ""; mysql_mutex_unlock(&acl_cache->lock); update_hostname(&host, hostname); @@ -5872,6 +5957,8 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, privilege_t store_table_rights(NO_ACL), store_col_rights(NO_ACL); uchar user_key[MAX_KEY_LENGTH]; DBUG_ENTER("replace_table_table"); + DBUG_PRINT("enter", ("User: '%s' Host: '%s' Revoke:'%d'", + combo.user.str, combo.host.str, (int) revoke_grant)); get_grantor(thd, grantor); /* @@ -5880,7 +5967,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, */ if (!find_user_wild(combo.host.str,combo.user.str)) { - if (!combo.host.length && !find_acl_role(combo.user.str)) + if (!combo.host.length && !find_acl_role(combo.user.str, true)) { my_message(ER_PASSWORD_NO_MATCH, ER_THD(thd, ER_PASSWORD_NO_MATCH), MYF(0)); /* purecov: deadcode */ @@ -7191,11 +7278,12 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, continue; } /* Create user if needed */ - error= copy_and_check_auth(Str, tmp_Str, thd) || + error= copy_and_check_auth(Str, Str, thd) || replace_user_table(thd, tables.user_table(), Str, NO_ACL, revoke_grant, create_new_users, - MY_TEST(thd->variables.sql_mode & - MODE_NO_AUTO_CREATE_USER)); + MY_TEST(!is_public(Str) && + (thd->variables.sql_mode & + MODE_NO_AUTO_CREATE_USER))); if (unlikely(error)) { result= TRUE; // Remember error @@ -7291,7 +7379,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, } } if (Str->is_role()) - propagate_role_grants(find_acl_role(Str->user.str), + propagate_role_grants(find_acl_role(Str->user.str, true), PRIVS_TO_MERGE::TABLE_COLUMN, db_name, table_name); } @@ -7379,7 +7467,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, if (copy_and_check_auth(Str, tmp_Str, thd) || replace_user_table(thd, tables.user_table(), Str, NO_ACL, revoke_grant, create_new_users, - MY_TEST(thd->variables.sql_mode & + !is_public(Str) && (thd->variables.sql_mode & MODE_NO_AUTO_CREATE_USER))) { result= TRUE; @@ -7418,7 +7506,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, continue; } if (Str->is_role()) - propagate_role_grants(find_acl_role(Str->user.str), + propagate_role_grants(find_acl_role(Str->user.str, true), sp_privs_to_merge(sph->type()), db_name, table_name); } @@ -7547,8 +7635,7 @@ bool mysql_grant_role(THD *thd, List &list, bool revoke) rolename= granted_role->user; create_new_user= test_if_create_new_users(thd); - no_auto_create_user= MY_TEST(thd->variables.sql_mode & - MODE_NO_AUTO_CREATE_USER); + no_auto_create_user= thd->variables.sql_mode & MODE_NO_AUTO_CREATE_USER; Grant_tables tables; if ((result= tables.open_and_lock(thd, Table_user | Table_roles_mapping, TL_WRITE))) @@ -7556,7 +7643,7 @@ bool mysql_grant_role(THD *thd, List &list, bool revoke) mysql_rwlock_wrlock(&LOCK_grant); mysql_mutex_lock(&acl_cache->lock); - if (!(role= find_acl_role(rolename.str))) + if (!(role= find_acl_role(rolename.str, false))) { mysql_mutex_unlock(&acl_cache->lock); mysql_rwlock_unlock(&LOCK_grant); @@ -7582,12 +7669,12 @@ bool mysql_grant_role(THD *thd, List &list, bool revoke) /* current_role is NONE */ if (!thd->security_ctx->priv_role[0]) { - my_error(ER_INVALID_ROLE, MYF(0), "NONE"); - append_str(&wrong_users, STRING_WITH_LEN("NONE")); + my_error(ER_INVALID_ROLE, MYF(0), none.str); + append_str(&wrong_users, none.str, none.length); result= 1; continue; } - if (!(role_as_user= find_acl_role(thd->security_ctx->priv_role))) + if (!(role_as_user= find_acl_role(thd->security_ctx->priv_role, true))) { LEX_CSTRING ls= { thd->security_ctx->priv_role, strlen(thd->security_ctx->priv_role) }; @@ -7616,22 +7703,26 @@ bool mysql_grant_role(THD *thd, List &list, bool revoke) } else { - username= user->user; if (user->host.str) hostname= user->host; else - if ((role_as_user= find_acl_role(user->user.str))) - hostname= empty_clex_str; - else - { - if (is_invalid_role_name(username.str)) - { - append_user(thd, &wrong_users, &username, &empty_clex_str); - result= 1; - continue; - } - hostname= host_not_specified; + switch (check_role_name(&user->user, true)) { + case ROLE_NAME_INVALID: + append_user(thd, &wrong_users, &user->user, &empty_clex_str); + result= 1; + continue; + case ROLE_NAME_PUBLIC: + user->host= hostname= empty_clex_str; + role_as_user= acl_public; + break; + case ROLE_NAME_OK: + if ((role_as_user= find_acl_role(user->user.str, false))) + hostname= empty_clex_str; + else + hostname= host_not_specified; + break; } + username= user->user; } ROLE_GRANT_PAIR *hash_entry= find_role_grant_pair(&username, &hostname, @@ -7640,25 +7731,28 @@ bool mysql_grant_role(THD *thd, List &list, bool revoke) if (has_auth(user, thd->lex)) DBUG_ASSERT(!grantee); - else if (!grantee) + else if (!grantee && !is_public(user)) grantee= find_user_exact(hostname.str, username.str); if (!grantee && !revoke) { LEX_USER user_combo = *user; - user_combo.host = hostname; user_combo.user = username; + user_combo.host = hostname; if (copy_and_check_auth(&user_combo, &user_combo, thd) || replace_user_table(thd, tables.user_table(), &user_combo, NO_ACL, false, create_new_user, - no_auto_create_user)) + (!is_public(&user_combo) && no_auto_create_user))) { append_user(thd, &wrong_users, &username, &hostname); result= 1; continue; } - grantee= find_user_exact(hostname.str, username.str); + if (!is_public(&user_combo)) + grantee= find_user_exact(hostname.str, username.str); + else + grantee= role_as_user= acl_public; /* either replace_user_table failed, or we've added the user */ DBUG_ASSERT(grantee); @@ -7827,8 +7921,9 @@ bool mysql_grant(THD *thd, const char *db, List &list, replace_user_table(thd, tables.user_table(), Str, (!db ? rights : NO_ACL), revoke_grant, create_new_users, - MY_TEST(thd->variables.sql_mode & - MODE_NO_AUTO_CREATE_USER))) + MY_TEST(!is_public(Str) && + (thd->variables.sql_mode & + MODE_NO_AUTO_CREATE_USER)))) result= true; else if (db) { @@ -7852,7 +7947,7 @@ bool mysql_grant(THD *thd, const char *db, List &list, result= true; } if (Str->is_role()) - propagate_role_grants(find_acl_role(Str->user.str), + propagate_role_grants(find_acl_role(Str->user.str, true), db ? PRIVS_TO_MERGE::DB : PRIVS_TO_MERGE::GLOBAL, db); } @@ -8218,8 +8313,6 @@ bool check_grant(THD *thd, privilege_t want_access, TABLE_LIST *tables, uint i; privilege_t original_want_access(want_access); bool locked= 0; - GRANT_TABLE *grant_table; - GRANT_TABLE *grant_table_role= NULL; DBUG_ENTER("check_grant"); DBUG_ASSERT(number > 0); @@ -8341,18 +8434,11 @@ bool check_grant(THD *thd, privilege_t want_access, TABLE_LIST *tables, mysql_rwlock_rdlock(&LOCK_grant); } - grant_table= table_hash_search(sctx->host, sctx->ip, - t_ref->get_db_name(), - sctx->priv_user, - t_ref->get_table_name(), - FALSE); - if (sctx->priv_role[0]) - grant_table_role= table_hash_search("", NULL, t_ref->get_db_name(), - sctx->priv_role, - t_ref->get_table_name(), - TRUE); + t_ref->grant.read(sctx, t_ref->get_db_name(), t_ref->get_table_name()); - if (!grant_table && !grant_table_role) + if (!t_ref->grant.grant_table_user && + !t_ref->grant.grant_table_role && + !t_ref->grant.grant_public) { want_access&= ~t_ref->grant.privilege; goto err; // No grants @@ -8365,19 +8451,14 @@ bool check_grant(THD *thd, privilege_t want_access, TABLE_LIST *tables, if (any_combination_will_do) continue; - t_ref->grant.grant_table_user= grant_table; // Remember for column test - t_ref->grant.grant_table_role= grant_table_role; - t_ref->grant.version= grant_version; - t_ref->grant.privilege|= grant_table ? grant_table->privs : NO_ACL; - t_ref->grant.privilege|= grant_table_role ? grant_table_role->privs : NO_ACL; + t_ref->grant.privilege|= t_ref->grant.aggregate_privs(); t_ref->grant.want_privilege= ((want_access & COL_ACLS) & ~t_ref->grant.privilege); if (!(~t_ref->grant.privilege & want_access)) continue; - if ((want_access&= ~((grant_table ? grant_table->cols : NO_ACL) | - (grant_table_role ? grant_table_role->cols : NO_ACL) | - t_ref->grant.privilege))) + if ((want_access&= ~(t_ref->grant.aggregate_cols() | + t_ref->grant.privilege))) { goto err; // impossible } @@ -8420,6 +8501,46 @@ static void check_grant_column_int(GRANT_TABLE *grant_table, const char *name, } } +inline privilege_t GRANT_INFO::aggregate_privs() +{ + return (grant_table_user ? grant_table_user->privs : NO_ACL) | + (grant_table_role ? grant_table_role->privs : NO_ACL) | + (grant_public ? grant_public->privs : NO_ACL); +} + +inline privilege_t GRANT_INFO::aggregate_cols() +{ + return (grant_table_user ? grant_table_user->cols : NO_ACL) | + (grant_table_role ? grant_table_role->cols : NO_ACL) | + (grant_public ? grant_public->cols : NO_ACL); +} + +void GRANT_INFO::refresh(const Security_context *sctx, + const char *db, const char *table) +{ + if (version != grant_version) + read(sctx, db, table); +} + +void GRANT_INFO::read(const Security_context *sctx, + const char *db, const char *table) +{ +#ifdef EMBEDDED_LIBRARY + grant_table_user= grant_table_role= grant_public= NULL; +#else + grant_table_user= + table_hash_search(sctx->host, sctx->ip, db, sctx->priv_user, + table, FALSE); /* purecov: inspected */ + grant_table_role= + sctx->priv_role[0] ? table_hash_search("", NULL, db, sctx->priv_role, + table, TRUE) : NULL; + grant_public= + acl_public ? table_hash_search("", NULL, db, public_name.str, + table, TRUE) : NULL; +#endif + version= grant_version; /* purecov: inspected */ +} + /* Check column rights in given security context @@ -8453,24 +8574,14 @@ bool check_grant_column(THD *thd, GRANT_INFO *grant, mysql_rwlock_rdlock(&LOCK_grant); /* reload table if someone has modified any grants */ - - if (grant->version != grant_version) - { - grant->grant_table_user= - table_hash_search(sctx->host, sctx->ip, db_name, - sctx->priv_user, - table_name, 0); /* purecov: inspected */ - grant->grant_table_role= - sctx->priv_role[0] ? table_hash_search("", NULL, db_name, - sctx->priv_role, - table_name, TRUE) : NULL; - grant->version= grant_version; /* purecov: inspected */ - } + grant->refresh(sctx, db_name, table_name); check_grant_column_int(grant->grant_table_user, name, (uint)length, &want_access); check_grant_column_int(grant->grant_table_role, name, (uint)length, &want_access); + check_grant_column_int(grant->grant_public, name, (uint)length, + &want_access); mysql_rwlock_unlock(&LOCK_grant); if (!want_access) @@ -8586,6 +8697,7 @@ bool check_grant_all_columns(THD *thd, privilege_t want_access_arg, GRANT_INFO *grant; GRANT_TABLE *UNINIT_VAR(grant_table); GRANT_TABLE *UNINIT_VAR(grant_table_role); + GRANT_TABLE *UNINIT_VAR(grant_public); /* Flag that gets set if privilege checking has to be performed on column level. @@ -8611,22 +8723,12 @@ bool check_grant_all_columns(THD *thd, privilege_t want_access_arg, if (want_access) { /* reload table if someone has modified any grants */ - if (grant->version != grant_version) - { - grant->grant_table_user= - table_hash_search(sctx->host, sctx->ip, db_name, - sctx->priv_user, - table_name, 0); /* purecov: inspected */ - grant->grant_table_role= - sctx->priv_role[0] ? table_hash_search("", NULL, db_name, - sctx->priv_role, - table_name, TRUE) : NULL; - grant->version= grant_version; /* purecov: inspected */ - } + grant->refresh(sctx, db_name, table_name); grant_table= grant->grant_table_user; grant_table_role= grant->grant_table_role; - if (!grant_table && !grant_table_role) + grant_public= grant->grant_public; + if (!grant_table && !grant_table_role && !grant_public) goto err; } } @@ -8649,6 +8751,15 @@ bool check_grant_all_columns(THD *thd, privilege_t want_access_arg, if (grant_column) have_access|= grant_column->rights; } + if (grant_public) + { + GRANT_COLUMN *grant_column= + column_hash_search(grant_public, field_name->str, + field_name->length); + if (grant_column) + have_access|= grant_column->rights; + + } if (have_access) using_column_privileges= TRUE; @@ -8828,6 +8939,13 @@ bool check_grant_routine(THD *thd, privilege_t want_access, table->table_name.str, sph, 0))) table->grant.privilege|= grant_proc->privs; } + if (acl_public) + { + if ((grant_proc= routine_hash_search("", NULL, table->db.str, + public_name.str, + table->table_name.str, sph, 0))) + table->grant.privilege|= grant_proc->privs; + } if (want_access & ~table->grant.privilege) { @@ -8907,27 +9025,10 @@ privilege_t get_table_grant(THD *thd, TABLE_LIST *table) { Security_context *sctx= thd->security_ctx; const char *db = table->db.str ? table->db.str : thd->db.str; - GRANT_TABLE *grant_table; - GRANT_TABLE *grant_table_role= NULL; mysql_rwlock_rdlock(&LOCK_grant); -#ifdef EMBEDDED_LIBRARY - grant_table= NULL; - grant_table_role= NULL; -#else - grant_table= table_hash_search(sctx->host, sctx->ip, db, sctx->priv_user, - table->table_name.str, 0); - if (sctx->priv_role[0]) - grant_table_role= table_hash_search("", "", db, sctx->priv_role, - table->table_name.str, 0); -#endif - table->grant.grant_table_user= grant_table; // Remember for column test - table->grant.grant_table_role= grant_table_role; - table->grant.version=grant_version; - if (grant_table) - table->grant.privilege|= grant_table->privs; - if (grant_table_role) - table->grant.privilege|= grant_table_role->privs; + table->grant.read(sctx, db, table->table_name.str); + table->grant.privilege|= table->grant.aggregate_privs(); privilege_t privilege(table->grant.privilege); mysql_rwlock_unlock(&LOCK_grant); return privilege; @@ -8958,29 +9059,19 @@ privilege_t get_column_grant(THD *thd, GRANT_INFO *grant, { GRANT_TABLE *grant_table; GRANT_TABLE *grant_table_role; + GRANT_TABLE *grant_public; GRANT_COLUMN *grant_column; privilege_t priv(NO_ACL); mysql_rwlock_rdlock(&LOCK_grant); /* reload table if someone has modified any grants */ - if (grant->version != grant_version) - { - Security_context *sctx= thd->security_ctx; - grant->grant_table_user= - table_hash_search(sctx->host, sctx->ip, - db_name, sctx->priv_user, - table_name, 0); /* purecov: inspected */ - grant->grant_table_role= - sctx->priv_role[0] ? table_hash_search("", "", db_name, - sctx->priv_role, - table_name, TRUE) : NULL; - grant->version= grant_version; /* purecov: inspected */ - } + grant->refresh(thd->security_ctx, db_name, table_name); grant_table= grant->grant_table_user; grant_table_role= grant->grant_table_role; + grant_public= grant->grant_public; - if (!grant_table && !grant_table_role) + if (!grant_table && !grant_table_role && !grant_public) priv= grant->privilege; else { @@ -9004,6 +9095,16 @@ privilege_t get_column_grant(THD *thd, GRANT_INFO *grant, priv|= (grant->privilege | grant_table_role->privs | grant_column->rights); } + if (grant_public) + { + grant_column= column_hash_search(grant_public, field_name, + (uint) strlen(field_name)); + if (!grant_column) + priv|= (grant->privilege | grant_public->privs); + else + priv|= (grant->privilege | grant_public->privs | + grant_column->rights); + } } mysql_rwlock_unlock(&LOCK_grant); return priv; @@ -9370,7 +9471,7 @@ bool get_show_user(THD *thd, LEX_USER *lex_user, const char **username, if (lex_user->is_role()) { *rolename= lex_user->user.str; - do_check_access= strcmp(*rolename, sctx->priv_role); + do_check_access= !is_public(lex_user) && strcmp(*rolename, sctx->priv_role); } else { @@ -9479,7 +9580,7 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user) if (rolename) { - acl_role= find_acl_role(rolename); + acl_role= find_acl_role(rolename, true); if (acl_role) { /* get a list of all inherited roles */ @@ -9499,6 +9600,12 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user) } } + if (username && rolename) // show everything, incl. PUBLIC + { + if (acl_public) + traverse_role_graph_down(acl_public, thd, show_grants_callback, NULL); + } + if (username) { /* Show default role to acl_user */ @@ -9578,7 +9685,10 @@ static bool show_role_grants(THD *thd, const char *hostname, ACL_ROLE**)); append_identifier(thd, &grant, acl_role->user.str, acl_role->user.length); grant.append(STRING_WITH_LEN(" TO ")); - append_identifier(thd, &grant, acl_entry->user.str, acl_entry->user.length); + if (acl_entry == acl_public) + grant.append(public_name); + else + append_identifier(thd, &grant, acl_entry->user.str, acl_entry->user.length); if (!(acl_entry->flags & IS_ROLE)) { grant.append('@'); @@ -9618,6 +9728,11 @@ static bool show_global_privileges(THD *thd, ACL_USER_BASE *acl_entry, want_access= ((ACL_ROLE *)acl_entry)->initial_role_access; else want_access= acl_entry->access; + + // suppress "GRANT USAGE ON *.* TO `PUBLIC`" + if (!(want_access & ~GRANT_ACL) && acl_entry == acl_public) + return FALSE; + if (test_all_bits(want_access, (GLOBAL_ACLS & ~ GRANT_ACL))) global.append(STRING_WITH_LEN("ALL PRIVILEGES")); else if (!(want_access & ~GRANT_ACL)) @@ -9639,7 +9754,10 @@ static bool show_global_privileges(THD *thd, ACL_USER_BASE *acl_entry, } } global.append (STRING_WITH_LEN(" ON *.* TO ")); - append_identifier(thd, &global, acl_entry->user.str, acl_entry->user.length); + if (acl_entry == acl_public) + global.append(public_name); + else + append_identifier(thd, &global, acl_entry->user.str, acl_entry->user.length); if (!handle_as_role) add_user_parameters(thd, &global, (ACL_USER *)acl_entry, @@ -9661,7 +9779,10 @@ static void add_to_user(THD *thd, String *result, const char *user, bool is_user, const char *host) { result->append(STRING_WITH_LEN(" TO ")); - append_identifier(thd, result, user, strlen(user)); + if (is_public(user)) + result->append(public_name); + else + append_identifier(thd, result, user, strlen(user)); if (is_user) { result->append('@'); @@ -9879,9 +10000,8 @@ static bool show_table_and_column_privileges(THD *thd, const char *username, } -static int show_routine_grants(THD* thd, - const char *username, const char *hostname, - const Sp_handler *sph, +static int show_routine_grants(THD* thd, const char *username, + const char *hostname, const Sp_handler *sph, char *buff, int buffsize) { uint counter, index; @@ -10353,7 +10473,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, if (struct_no == ROLE_ACL) //no need to scan the structures in this case { - acl_role= find_acl_role(user_from->user.str); + acl_role= find_acl_role(user_from->user.str, true); if (!acl_role) DBUG_RETURN(0); @@ -10711,7 +10831,7 @@ static int handle_grant_data(THD *thd, Grant_tables& tables, bool drop, if (search_only) { /* quickly search in-memory structures first */ - if (handle_as_role && find_acl_role(user_from->user.str)) + if (handle_as_role && find_acl_role(user_from->user.str, true)) DBUG_RETURN(1); // found if (!handle_as_role && find_user_exact(user_from->host.str, user_from->user.str)) @@ -10942,7 +11062,8 @@ bool mysql_create_user(THD *thd, List &list, bool handle_as_role) continue; } - if (handle_as_role && is_invalid_role_name(user_name->user.str)) + if (handle_as_role && + (check_role_name(&user_name->user, false) == ROLE_NAME_INVALID)) { append_user(thd, &wrong_users, user_name); result= TRUE; @@ -11010,7 +11131,7 @@ bool mysql_create_user(THD *thd, List &list, bool handle_as_role) { ACL_USER_BASE *grantee= find_acl_user_base(thd->lex->definer->user.str, thd->lex->definer->host.str); - ACL_ROLE *role= find_acl_role(user_name->user.str); + ACL_ROLE *role= find_acl_role(user_name->user.str, false); /* just like with routines, views, triggers, and events we allow @@ -11102,10 +11223,13 @@ bool mysql_drop_user(THD *thd, List &list, bool handle_as_role) { int rc; user_name= get_current_user(thd, tmp_user_name, false); - if (!user_name) + if (!user_name || (handle_as_role && is_public(user_name))) { thd->clear_error(); - append_str(&wrong_users, STRING_WITH_LEN("CURRENT_ROLE")); + if (!user_name) + append_str(&wrong_users, STRING_WITH_LEN("CURRENT_ROLE")); + else + append_str(&wrong_users, public_name.str, public_name.length); result= TRUE; continue; } @@ -11534,7 +11658,7 @@ bool mysql_revoke_all(THD *thd, List &list) if (lex_user->is_role()) { /* this can not fail due to get_current_user already having searched for it */ - user_or_role= find_acl_role(lex_user->user.str); + user_or_role= find_acl_role(lex_user->user.str, true); } else { @@ -12055,6 +12179,8 @@ static bool set_user_salt_if_needed(ACL_USER *, int, plugin_ref) { return 0; } bool check_grant(THD *, privilege_t, TABLE_LIST *, bool, uint, bool) { return 0; } +inline privilege_t public_access() +{ return NO_ACL; } #endif /*NO_EMBEDDED_ACCESS_CHECKS */ @@ -12300,8 +12426,7 @@ SHOW_VAR acl_statistics[] = { hostname == NULL means we are looking for a role as a starting point, otherwise a user. */ -bool check_role_is_granted(const char *username, - const char *hostname, +bool check_role_is_granted(const char *username, const char *hostname, const char *rolename) { DBUG_ENTER("check_role_is_granted"); @@ -12312,7 +12437,7 @@ bool check_role_is_granted(const char *username, if (hostname) root= find_user_exact(hostname, username); else - root= find_acl_role(username); + root= find_acl_role(username, false); LEX_CSTRING role_lex; role_lex.str= rolename; @@ -12340,7 +12465,7 @@ int fill_schema_enabled_roles(THD *thd, TABLE_LIST *tables, COND *cond) { mysql_rwlock_rdlock(&LOCK_grant); mysql_mutex_lock(&acl_cache->lock); - ACL_ROLE *acl_role= find_acl_role(thd->security_ctx->priv_role); + ACL_ROLE *acl_role= find_acl_role(thd->security_ctx->priv_role, false); if (acl_role) traverse_role_graph_down(acl_role, table, enabled_roles_insert, NULL); mysql_mutex_unlock(&acl_cache->lock); @@ -12814,11 +12939,7 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, if (!thd->db.str || strcmp(db, thd->db.str)) { - /* db privileges */ - grant->privilege|= acl_get(sctx->host, sctx->ip, sctx->priv_user, db, 0); - /* db privileges for role */ - if (sctx->priv_role[0]) - grant->privilege|= acl_get("", "", sctx->priv_role, db, 0); + grant->privilege|= acl_get_all3(sctx, db, FALSE); } else { @@ -12827,18 +12948,8 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, /* table privileges */ mysql_rwlock_rdlock(&LOCK_grant); - if (grant->version != grant_version) - { - grant->grant_table_user= - table_hash_search(sctx->host, sctx->ip, db, - sctx->priv_user, - table, 0); /* purecov: inspected */ - grant->grant_table_role= - sctx->priv_role[0] ? table_hash_search("", "", db, - sctx->priv_role, - table, TRUE) : NULL; - grant->version= grant_version; /* purecov: inspected */ - } + grant->refresh(sctx, db, table); + if (grant->grant_table_user != 0) { grant->privilege|= grant->grant_table_user->privs; @@ -12847,6 +12958,10 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, { grant->privilege|= grant->grant_table_role->privs; } + if (grant->grant_public != 0) + { + grant->privilege|= grant->grant_public->privs; + } mysql_rwlock_unlock(&LOCK_grant); DBUG_PRINT("info", ("privilege 0x%llx", (longlong) grant->privilege)); @@ -12902,12 +13017,18 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user, bool lock) return dup; } - if (is_invalid_role_name(user->user.str)) + role_name_check_result result= check_role_name(&dup->user, true); + if (result == ROLE_NAME_INVALID) return 0; + if (result == ROLE_NAME_PUBLIC) + { + dup->host= empty_clex_str; + return dup; + } if (lock) mysql_mutex_lock(&acl_cache->lock); - if (find_acl_role(dup->user.str)) + if (find_acl_role(dup->user.str, false)) dup->host= empty_clex_str; else dup->host= host_not_specified; @@ -14516,7 +14637,7 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len) } #endif - sctx->master_access= acl_user->access; + sctx->master_access= (acl_user->access | public_access()); strmake_buf(sctx->priv_user, acl_user->user.str); if (acl_user->host.hostname) @@ -14974,5 +15095,3 @@ extern "C" void maria_update_hostname( *ip_mask= h.ip_mask; #endif } - - diff --git a/sql/sql_acl.h b/sql/sql_acl.h index 570da144b46e5..ab98cfff36426 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -58,6 +58,8 @@ extern LEX_CSTRING host_not_specified; extern LEX_CSTRING current_user; extern LEX_CSTRING current_role; extern LEX_CSTRING current_user_and_current_role; +extern LEX_CSTRING none; +extern LEX_CSTRING public_name; static inline int access_denied_error_code(int passwd_used) @@ -76,8 +78,8 @@ bool hostname_requires_resolving(const char *hostname); bool acl_init(bool dont_read_acl_tables); bool acl_reload(THD *thd); void acl_free(bool end=0); -privilege_t acl_get(const char *host, const char *ip, - const char *user, const char *db, my_bool db_is_pattern); +privilege_t acl_get_all3(Security_context *sctx, const char *db, + bool db_is_patern); bool acl_authenticate(THD *thd, uint com_change_user_pkt_len); bool acl_getroot(Security_context *sctx, const char *user, const char *host, const char *ip, const char *db); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index b067d62663dc8..91ab545687565 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -6306,10 +6306,14 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, size_t length, !DBUG_IF("test_completely_invisible")) DBUG_RETURN((Field*)0); - if (field->invisible == INVISIBLE_SYSTEM && - thd->column_usage != MARK_COLUMNS_READ && + if (thd->column_usage != MARK_COLUMNS_READ && thd->column_usage != COLUMNS_READ) - DBUG_RETURN((Field*)0); + { + if (thd->vers_insert_history(field)) + DBUG_ASSERT(table->versioned()); + else if (field->invisible == INVISIBLE_SYSTEM) + DBUG_RETURN((Field*)0); + } } else { @@ -6373,12 +6377,10 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, size_t length, */ Field * -find_field_in_table_ref(THD *thd, TABLE_LIST *table_list, - const char *name, size_t length, - const char *item_name, const char *db_name, - const char *table_name, - ignored_tables_list_t ignored_tables, - Item **ref, +find_field_in_table_ref(THD *thd, TABLE_LIST *table_list, const char *name, + size_t length, const char *item_name, + const char *db_name, const char *table_name, + ignored_tables_list_t ignored_tables, Item **ref, bool check_privileges, bool allow_rowid, field_index_t *cached_field_index_ptr, bool register_tree_change, TABLE_LIST **actual_table) @@ -6451,8 +6453,7 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list, /* 'table_list' is a stored table. */ DBUG_ASSERT(table_list->table); if ((fld= find_field_in_table(thd, table_list->table, name, length, - allow_rowid, - cached_field_index_ptr))) + allow_rowid, cached_field_index_ptr))) *actual_table= table_list; } else @@ -6682,18 +6683,16 @@ find_field_in_tables(THD *thd, Item_ident *item, #ifndef NO_EMBEDDED_ACCESS_CHECKS /* Check if there are sufficient access rights to the found field. */ if (found && check_privileges && !is_temporary_table(table_ref) && - check_column_grant_in_table_ref(thd, table_ref, name, length, - found)) + check_column_grant_in_table_ref(thd, table_ref, name, length, found)) found= WRONG_GRANT; #endif } else - found= find_field_in_table_ref(thd, table_ref, name, length, item->name.str, - NULL, NULL, ignored_tables, ref, - check_privileges, TRUE, - &(item->cached_field_index), - register_tree_change, - &actual_table); + found= find_field_in_table_ref(thd, table_ref, name, length, + item->name.str, NULL, NULL, + ignored_tables, ref, check_privileges, + TRUE, &(item->cached_field_index), + register_tree_change, &actual_table); if (found) { if (found == WRONG_GRANT) @@ -6703,8 +6702,7 @@ find_field_in_tables(THD *thd, Item_ident *item, Only views fields should be marked as dependent, not an underlying fields. */ - if (!table_ref->belong_to_view && - !table_ref->belong_to_derived) + if (!table_ref->belong_to_view && !table_ref->belong_to_derived) { SELECT_LEX *current_sel= item->context->select_lex; SELECT_LEX *last_select= table_ref->select_lex; @@ -7909,8 +7907,9 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, bool allow_sum_func) { Item *item; + LEX * const lex= thd->lex; enum_column_usage saved_column_usage= thd->column_usage; - nesting_map save_allow_sum_func= thd->lex->allow_sum_func; + nesting_map save_allow_sum_func= lex->allow_sum_func; List_iterator it(fields); bool save_is_item_list_lookup; bool make_pre_fix= (pre_fix && (pre_fix->elements == 0)); @@ -7926,15 +7925,14 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, 2) nest level of all SELECTs on the same level shoud be equal first SELECT on this level (and each other). */ - DBUG_ASSERT(thd->lex->current_select->nest_level >= 0); - DBUG_ASSERT(thd->lex->current_select->master_unit()->first_select() - ->nest_level == - thd->lex->current_select->nest_level); + DBUG_ASSERT(lex->current_select->nest_level >= 0); + DBUG_ASSERT(lex->current_select->master_unit()->first_select()->nest_level == + lex->current_select->nest_level); if (allow_sum_func) - thd->lex->allow_sum_func.set_bit(thd->lex->current_select->nest_level); + lex->allow_sum_func.set_bit(lex->current_select->nest_level); thd->where= THD::DEFAULT_WHERE; - save_is_item_list_lookup= thd->lex->current_select->is_item_list_lookup; - thd->lex->current_select->is_item_list_lookup= 0; + save_is_item_list_lookup= lex->current_select->is_item_list_lookup; + lex->current_select->is_item_list_lookup= 0; /* To prevent fail on forward lookup we fill it with zeroes, @@ -7964,13 +7962,13 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, items we have to refresh their entries before fixing of Item_func_get_user_var items. */ - List_iterator li(thd->lex->set_var_list); + List_iterator li(lex->set_var_list); Item_func_set_user_var *var; while ((var= li++)) var->set_entry(thd, FALSE); Ref_ptr_array ref= ref_pointer_array; - thd->lex->current_select->cur_pos_in_select_list= 0; + lex->current_select->cur_pos_in_select_list= 0; while ((item= it++)) { if (make_pre_fix) @@ -7978,8 +7976,8 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, if (item->fix_fields_if_needed_for_scalar(thd, it.ref())) { - thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; - thd->lex->allow_sum_func= save_allow_sum_func; + lex->current_select->is_item_list_lookup= save_is_item_list_lookup; + lex->allow_sum_func= save_allow_sum_func; thd->column_usage= saved_column_usage; DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage)); DBUG_RETURN(TRUE); /* purecov: inspected */ @@ -8001,16 +7999,15 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, item->split_sum_func(thd, ref_pointer_array, *sum_func_list, SPLIT_SUM_SELECT); } - thd->lex->current_select->select_list_tables|= item->used_tables(); - thd->lex->used_tables|= item->used_tables(); - thd->lex->current_select->cur_pos_in_select_list++; - - thd->lex->current_select->rownum_in_field_list |= item->with_rownum_func(); + lex->current_select->select_list_tables|= item->used_tables(); + lex->used_tables|= item->used_tables(); + lex->current_select->cur_pos_in_select_list++; + lex->current_select->rownum_in_field_list |= item->with_rownum_func(); } - thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; - thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS; + lex->current_select->is_item_list_lookup= save_is_item_list_lookup; + lex->current_select->cur_pos_in_select_list= UNDEF_POS; - thd->lex->allow_sum_func= save_allow_sum_func; + lex->allow_sum_func= save_allow_sum_func; thd->column_usage= saved_column_usage; DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage)); DBUG_RETURN(MY_TEST(thd->is_error())); @@ -8836,6 +8833,35 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List &leaves, } +static bool vers_update_or_validate_fields(TABLE *table) +{ + if (!table->versioned()) + return 0; + DBUG_ASSERT(table->vers_write); + + if (table->vers_update_fields()) + return 0; + + Field *row_start= table->vers_start_field(); + Field *row_end= table->vers_end_field(); + MYSQL_TIME ltime; + + /* + Inserting the history row directly, check ROW_START < ROW_END and + ROW_START is non-zero. + */ + if ((row_start->cmp(row_start->ptr, row_end->ptr) < 0) && + !row_start->get_date(<ime, Datetime::Options( + TIME_NO_ZERO_DATE, time_round_mode_t(time_round_mode_t::FRAC_NONE)))) + return 0; + + StringBuffer val; + row_start->val_str(&val); + my_error(ER_WRONG_VALUE, MYF(0), row_start->field_name.str, val.c_ptr()); + return 1; +} + + /****************************************************************************** ** Fill a record with data (for INSERT or UPDATE) ** Returns : 1 if some field has wrong type @@ -8900,7 +8926,10 @@ fill_record(THD *thd, TABLE *table_arg, List &fields, List &values, if (table->next_number_field && rfield->field_index == table->next_number_field->field_index) table->auto_increment_field_not_null= TRUE; - const bool skip_sys_field= rfield->vers_sys_field(); // TODO: && !thd->vers_modify_history() [MDEV-16546] + + const bool skip_sys_field= rfield->vers_sys_field() && + (update || !thd->vers_insert_history_fast(table)); + if ((rfield->vcol_info || skip_sys_field) && !value->vcol_assignment_allowed_value() && table->s->table_category != TABLE_CATEGORY_TEMPORARY) @@ -8915,11 +8944,14 @@ fill_record(THD *thd, TABLE *table_arg, List &fields, List &values, if (rfield->stored_in_db()) { - if (!skip_sys_field && - unlikely(value->save_in_field(rfield, 0) < 0) && !ignore_errors) + if (!skip_sys_field) { - my_message(ER_UNKNOWN_ERROR, ER_THD(thd, ER_UNKNOWN_ERROR), MYF(0)); - goto err; + if (value->save_in_field(rfield, 0) < 0 && !ignore_errors) + { + my_message(ER_UNKNOWN_ERROR, ER_THD(thd, ER_UNKNOWN_ERROR), MYF(0)); + goto err; + } + rfield->set_has_explicit_value(); } /* In sql MODE_SIMULTANEOUS_ASSIGNMENT, @@ -8930,7 +8962,6 @@ fill_record(THD *thd, TABLE *table_arg, List &fields, List &values, rfield->move_field_offset((my_ptrdiff_t) (table->record[1] - table->record[0])); } - rfield->set_has_explicit_value(); } if (update && thd->variables.sql_mode & MODE_SIMULTANEOUS_ASSIGNMENT) @@ -8956,8 +8987,9 @@ fill_record(THD *thd, TABLE *table_arg, List &fields, List &values, table_arg->update_default_fields(ignore_errors)) goto err; - if (table_arg->versioned() && !only_unvers_fields) - table_arg->vers_update_fields(); + if (!only_unvers_fields && vers_update_or_validate_fields(table_arg)) + goto err; + /* Update virtual fields */ if (table_arg->vfield && table_arg->update_virtual_fields(table_arg->file, VCOL_UPDATE_FOR_WRITE)) @@ -9181,11 +9213,12 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List &values, /* Ensure the end of the list of values is not reached */ DBUG_ASSERT(value); - bool vers_sys_field= table->versioned() && field->vers_sys_field(); + const bool skip_sys_field= field->vers_sys_field() && + !thd->vers_insert_history_fast(table); if (field->field_index == autoinc_index) table->auto_increment_field_not_null= TRUE; - if ((unlikely(field->vcol_info) || (vers_sys_field && !ignore_errors)) && + if ((unlikely(field->vcol_info) || (skip_sys_field && !ignore_errors)) && !value->vcol_assignment_allowed_value() && table->s->table_category != TABLE_CATEGORY_TEMPORARY) { @@ -9193,10 +9226,11 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List &values, ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN, ER_THD(thd, ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN), field->field_name.str, table->s->table_name.str); - if (vers_sys_field) - continue; } + if (skip_sys_field) + continue; + if (use_value) value->save_val(field); else @@ -9210,8 +9244,8 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List &values, thd->abort_on_warning= FALSE; if (table->default_field && table->update_default_fields(ignore_errors)) goto err; - if (table->versioned()) - table->vers_update_fields(); + if (vers_update_or_validate_fields(table)) + goto err; if (table->vfield && table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_WRITE)) goto err; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c3fc62f5f5de2..d85de20583641 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -6038,11 +6038,7 @@ void THD::get_definer(LEX_USER *definer, bool role) { binlog_invoker(role); #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) -#ifdef WITH_WSREP - if ((wsrep_applier || slave_thread) && has_invoker()) -#else - if (slave_thread && has_invoker()) -#endif + if ((IF_WSREP(wsrep_applier, 0) || slave_thread) && has_invoker()) { definer->user= invoker.user; definer->host= invoker.host; diff --git a/sql/sql_class.h b/sql/sql_class.h index 26d383dac575d..e13fe9defcbdf 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5571,6 +5571,27 @@ class THD: public THD_count, /* this must be first */ { lex= backup_lex; } + + bool vers_insert_history_fast(const TABLE *table) + { + DBUG_ASSERT(table->versioned()); + return table->versioned(VERS_TIMESTAMP) && + (variables.option_bits & OPTION_INSERT_HISTORY) && + lex->duplicates == DUP_ERROR; + } + + bool vers_insert_history(const Field *field) + { + if (!field->vers_sys_field()) + return false; + if (!vers_insert_history_fast(field->table)) + return false; + if (lex->sql_command != SQLCOM_INSERT && + lex->sql_command != SQLCOM_INSERT_SELECT && + lex->sql_command != SQLCOM_LOAD) + return false; + return !is_set_timestamp_forbidden(this); + } }; @@ -6136,7 +6157,6 @@ class select_insert :public select_result_interceptor { class select_create: public select_insert { - TABLE_LIST *create_table; Table_specification_st *create_info; TABLE_LIST *select_tables; Alter_info *alter_info; @@ -6157,7 +6177,6 @@ class select_create: public select_insert { TABLE_LIST *select_tables_arg): select_insert(thd_arg, table_arg, NULL, &select_fields, 0, 0, duplic, ignore, NULL), - create_table(table_arg), create_info(create_info_par), select_tables(select_tables_arg), alter_info(alter_info_arg), @@ -6184,8 +6203,8 @@ class select_create: public select_insert { private: TABLE *create_table_from_items(THD *thd, List *items, - MYSQL_LOCK **lock, - TABLEOP_HOOKS *hooks); + MYSQL_LOCK **lock); + int postlock(THD *thd, TABLE **tables); }; #include diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 9da1ac5ca7796..452a01773e552 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -1129,7 +1129,7 @@ mysql_rm_db_internal(THD *thd, const LEX_CSTRING *db, bool if_exists, debug_crash_here("ddl_log_drop_after_drop_tables"); LEX_CSTRING cpath{ path, path_length}; - ddl_log_drop_db(thd, &ddl_log_state, &rm_db, &cpath); + ddl_log_drop_db(&ddl_log_state, &rm_db, &cpath); drop_database_objects(thd, &cpath, &rm_db, rm_mysql_schema); @@ -1778,16 +1778,13 @@ uint mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, #ifndef NO_EMBEDDED_ACCESS_CHECKS if (test_all_bits(sctx->master_access, DB_ACLS)) + { db_access= DB_ACLS; + } else { - db_access= acl_get(sctx->host, sctx->ip, sctx->priv_user, - new_db_file_name.str, FALSE) | sctx->master_access; - if (sctx->priv_role[0]) - { - /* include a possible currently set role for access */ - db_access|= acl_get("", "", sctx->priv_role, new_db_file_name.str, FALSE); - } + db_access= acl_get_all3(sctx, new_db_file_name.str, FALSE); + db_access|= sctx->master_access; } if (!force_switch && diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 83ae0132ea13b..7c3e87d42e364 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -44,9 +44,10 @@ static void append_item_to_str(String *out, Item *item, bool no_tmp_tbl); Explain_query::Explain_query(THD *thd_arg, MEM_ROOT *root) : mem_root(root), upd_del_plan(nullptr), insert_plan(nullptr), - unions(root), selects(root), stmt_thd(thd_arg), apc_enabled(false), + unions(root), selects(root), stmt_thd(thd_arg), apc_enabled(false), operations(0) { + optimization_time_tracker.start_tracking(stmt_thd); } static void print_json_array(Json_writer *writer, @@ -154,6 +155,8 @@ void Explain_query::add_upd_del_plan(Explain_update *upd_del_plan_arg) void Explain_query::query_plan_ready() { + optimization_time_tracker.stop_tracking(stmt_thd); + if (!apc_enabled) stmt_thd->apc_target.enable(); apc_enabled= true; @@ -256,44 +259,80 @@ int Explain_query::print_explain_json(select_result_sink *output, #endif writer.start_object(); - if (is_analyze && query_time_in_progress_ms > 0) - writer.add_member("r_query_time_in_progress_ms"). - add_ull(query_time_in_progress_ms); - + /* If we are printing ANALYZE FORMAT=JSON output, take into account that query's temporary tables have already been freed. See sql_explain.h, sql_explain.h:ExplainDataStructureLifetime for details. */ if (is_analyze) - is_show_cmd= true; + { + if (query_time_in_progress_ms > 0){ + writer.add_member("r_query_time_in_progress_ms"). + add_ull(query_time_in_progress_ms); + } + + print_query_optimization_json(&writer); + is_show_cmd = true; + } + + bool plan_found = print_query_blocks_json(&writer, is_analyze, is_show_cmd); + + writer.end_object(); + + if( plan_found ) + { + send_explain_json_to_output(&writer, output); + } + + return 0; +} +void Explain_query::print_query_optimization_json(Json_writer *writer) +{ + if (optimization_time_tracker.has_timed_statistics()) + { + // if more timers are added, move the query_optimization member + // outside the if statement + writer->add_member("query_optimization").start_object(); + writer->add_member("r_total_time_ms"). + add_double(optimization_time_tracker.get_time_ms()); + writer->end_object(); + } +} + +bool Explain_query::print_query_blocks_json(Json_writer *writer, + const bool is_analyze, + const bool is_show_cmd) +{ if (upd_del_plan) - upd_del_plan->print_explain_json(this, &writer, is_analyze, is_show_cmd); + upd_del_plan->print_explain_json(this, writer, is_analyze, is_show_cmd); else if (insert_plan) - insert_plan->print_explain_json(this, &writer, is_analyze, is_show_cmd); + insert_plan->print_explain_json(this, writer, is_analyze, is_show_cmd); else { - /* Start printing from node with id=1 */ + /* Start printing from root node with id=1 */ Explain_node *node= get_node(1); if (!node) - return 1; /* No query plan */ - node->print_explain_json(this, &writer, is_analyze, is_show_cmd); + return false; /* No query plan */ + node->print_explain_json(this, writer, is_analyze, is_show_cmd); } - writer.end_object(); + return true; +} +void Explain_query::send_explain_json_to_output(Json_writer *writer, + select_result_sink *output) +{ CHARSET_INFO *cs= system_charset_info; List item_list; - const String *buf= writer.output.get_string(); + const String *buf= writer->output.get_string(); THD *thd= output->thd; item_list.push_back(new (thd->mem_root) Item_string(thd, buf->ptr(), buf->length(), cs), thd->mem_root); output->send_data(item_list); - return 0; -} - +} bool print_explain_for_slow_log(LEX *lex, THD *thd, String *str) { diff --git a/sql/sql_explain.h b/sql/sql_explain.h index 919d51aef8ba0..38c5c3e659525 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -512,6 +512,10 @@ class Explain_query : public Sql_alloc Explain_update *get_upd_del_plan() { return upd_del_plan; } private: + bool print_query_blocks_json(Json_writer *writer, const bool is_analyze, const bool is_show_cmd); + void print_query_optimization_json(Json_writer *writer); + void send_explain_json_to_output(Json_writer *writer, select_result_sink *output); + /* Explain_delete inherits from Explain_update */ Explain_update *upd_del_plan; @@ -533,6 +537,8 @@ class Explain_query : public Sql_alloc #ifndef DBUG_OFF bool can_print_json= false; #endif + + Exec_time_tracker optimization_time_tracker; }; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index da832cfbf5fce..5d713d2176ed2 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -320,7 +320,8 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list, static bool has_no_default_value(THD *thd, Field *field, TABLE_LIST *table_list) { - if ((field->flags & NO_DEFAULT_VALUE_FLAG) && field->real_type() != MYSQL_TYPE_ENUM) + if ((field->flags & (NO_DEFAULT_VALUE_FLAG | VERS_ROW_START | VERS_ROW_END)) + == NO_DEFAULT_VALUE_FLAG && field->real_type() != MYSQL_TYPE_ENUM) { bool view= false; if (table_list) @@ -372,6 +373,7 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list, { TABLE *table= insert_table_list->table; my_bool UNINIT_VAR(autoinc_mark); + enum_sql_command sql_command_save= thd->lex->sql_command; table->next_number_field_updated= FALSE; @@ -386,10 +388,17 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list, field_index); } + thd->lex->sql_command= SQLCOM_UPDATE; + /* Check the fields we are going to modify */ if (setup_fields(thd, Ref_ptr_array(), update_fields, MARK_COLUMNS_WRITE, 0, NULL, 0)) + { + thd->lex->sql_command= sql_command_save; return -1; + } + + thd->lex->sql_command= sql_command_save; if (insert_table_list->is_view() && insert_table_list->is_merged_derived() && @@ -889,10 +898,8 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, For single line insert, generate an error if try to set a NOT NULL field to NULL. */ - thd->count_cuted_fields= ((values_list.elements == 1 && - !ignore) ? - CHECK_FIELD_ERROR_FOR_NULL : - CHECK_FIELD_WARN); + thd->count_cuted_fields= (values_list.elements == 1 && !ignore) + ? CHECK_FIELD_ERROR_FOR_NULL : CHECK_FIELD_WARN; thd->cuted_fields = 0L; table->next_number_field=table->found_next_number_field; @@ -1734,11 +1741,16 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, if (check_duplic_insert_without_overlaps(thd, table, duplic) != 0) DBUG_RETURN(true); - if (table->versioned(VERS_TIMESTAMP) && duplic == DUP_REPLACE) + if (table->versioned(VERS_TIMESTAMP)) { // Additional memory may be required to create historical items. - if (table_list->set_insert_values(thd->mem_root)) + if (duplic == DUP_REPLACE && table_list->set_insert_values(thd->mem_root)) DBUG_RETURN(1); + + Field *row_start= table->vers_start_field(); + Field *row_end= table->vers_end_field(); + if (!fields.elements && !(row_start->invisible && row_end->invisible)) + thd->vers_insert_history(row_start); // check privileges } if (!select_insert) @@ -1801,8 +1813,7 @@ static int last_uniq_key(TABLE *table,uint keynr) int vers_insert_history_row(TABLE *table) { DBUG_ASSERT(table->versioned(VERS_TIMESTAMP)); - if (!table->vers_write) - return 0; + DBUG_ASSERT(table->vers_write); restore_record(table,record[1]); // Set Sys_end to now() @@ -2101,6 +2112,7 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info, select_result *sink) { if (table->versioned(VERS_TRX_ID)) { + DBUG_ASSERT(table->vers_write); bitmap_set_bit(table->write_set, table->vers_start_field()->field_index); table->file->column_bitmaps_signal(); table->vers_start_field()->store(0, false); @@ -2114,7 +2126,7 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info, select_result *sink) info->deleted++; if (!table->file->has_transactions()) thd->transaction->stmt.modified_non_trans_table= TRUE; - if (table->versioned(VERS_TIMESTAMP)) + if (table->versioned(VERS_TIMESTAMP) && table->vers_write) { store_record(table, record[2]); error= vers_insert_history_row(table); @@ -2257,9 +2269,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry, TABLE_LIST *t for (Field **field=entry->field ; *field ; field++) { if (!bitmap_is_set(write_set, (*field)->field_index) && - !(*field)->vers_sys_field() && - has_no_default_value(thd, *field, table_list) && - ((*field)->real_type() != MYSQL_TYPE_ENUM)) + has_no_default_value(thd, *field, table_list)) err=1; } return thd->abort_on_warning ? err : 0; @@ -4158,7 +4168,6 @@ int select_insert::send_data(List &values) DBUG_RETURN(1); } - table->vers_write= table->versioned(); if (table_list) // Not CREATE ... SELECT { switch (table_list->view_check_option(thd, info.ignore)) { @@ -4170,7 +4179,6 @@ int select_insert::send_data(List &values) } error= write_record(thd, table, &info, sel_result); - table->vers_write= table->versioned(); table->auto_increment_field_not_null= FALSE; if (likely(!error)) @@ -4483,8 +4491,7 @@ Field *Item::create_field_for_create_select(MEM_ROOT *root, TABLE *table) */ TABLE *select_create::create_table_from_items(THD *thd, List *items, - MYSQL_LOCK **lock, - TABLEOP_HOOKS *hooks) + MYSQL_LOCK **lock) { TABLE tmp_table; // Used during 'Create_field()' TABLE_SHARE share; @@ -4507,7 +4514,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, if (!(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP)) promote_first_timestamp_column(&alter_info->create_list); - if (create_info->fix_create_fields(thd, alter_info, *create_table)) + if (create_info->fix_create_fields(thd, alter_info, *table_list)) DBUG_RETURN(NULL); while ((item=it++)) @@ -4558,21 +4565,21 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, Create_field::upgrade_data_types(alter_info->create_list); if (create_info->check_fields(thd, alter_info, - create_table->table_name, - create_table->db, + table_list->table_name, + table_list->db, select_field_count)) DBUG_RETURN(NULL); DEBUG_SYNC(thd,"create_table_select_before_create"); /* Check if LOCK TABLES + CREATE OR REPLACE of existing normal table*/ - if (thd->locked_tables_mode && create_table->table && + if (thd->locked_tables_mode && table_list->table && !create_info->tmp_table()) { /* Remember information about the locked table */ create_info->pos_in_locked_tables= - create_table->table->pos_in_locked_tables; - create_info->mdl_ticket= create_table->table->mdl_ticket; + table_list->table->pos_in_locked_tables; + create_info->mdl_ticket= table_list->table->mdl_ticket; } /* @@ -4593,10 +4600,10 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, */ if (!mysql_create_table_no_lock(thd, &ddl_log_state_create, &ddl_log_state_rm, - &create_table->db, - &create_table->table_name, + &table_list->db, + &table_list->table_name, create_info, alter_info, NULL, - select_field_count, create_table)) + select_field_count, table_list)) { DEBUG_SYNC(thd,"create_table_select_before_open"); @@ -4604,7 +4611,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, If we had a temporary table or a table used with LOCK TABLES, it was closed by mysql_create() */ - create_table->table= 0; + table_list->table= 0; if (!create_info->tmp_table()) { @@ -4612,20 +4619,20 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, TABLE_LIST::enum_open_strategy save_open_strategy; /* Force the newly created table to be opened */ - save_open_strategy= create_table->open_strategy; - create_table->open_strategy= TABLE_LIST::OPEN_NORMAL; + save_open_strategy= table_list->open_strategy; + table_list->open_strategy= TABLE_LIST::OPEN_NORMAL; /* Here we open the destination table, on which we already have an exclusive metadata lock. */ - if (open_table(thd, create_table, &ot_ctx)) + if (open_table(thd, table_list, &ot_ctx)) { - quick_rm_table(thd, create_info->db_type, &create_table->db, - table_case_name(create_info, &create_table->table_name), + quick_rm_table(thd, create_info->db_type, &table_list->db, + table_case_name(create_info, &table_list->table_name), 0); } /* Restore */ - create_table->open_strategy= save_open_strategy; + table_list->open_strategy= save_open_strategy; } else { @@ -4633,8 +4640,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, The pointer to the newly created temporary table has been stored in table->create_info. */ - create_table->table= create_info->table; - if (!create_table->table) + table_list->table= create_info->table; + if (!table_list->table) { /* This shouldn't happen as creation of temporary table should make @@ -4643,13 +4650,13 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, */ DBUG_ASSERT(0); } - create_table->table->pos_in_table_list= create_table; + table_list->table->pos_in_table_list= table_list; } } else - create_table->table= 0; // Create failed + table_list->table= 0; // Create failed - if (unlikely(!(table= create_table->table))) + if (unlikely(!(table= table_list->table))) { if (likely(!thd->is_error())) // CREATE ... IF NOT EXISTS my_ok(thd); // succeed, but did nothing @@ -4661,7 +4668,6 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, DEBUG_SYNC(thd,"create_table_select_before_lock"); table->reginfo.lock_type=TL_WRITE; - hooks->prelock(&table, 1); // Call prelock hooks /* Ensure that decide_logging_format(), called by mysql_lock_tables(), works @@ -4676,7 +4682,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, the table) and thus can't get aborted. */ if (unlikely(!((*lock)= mysql_lock_tables(thd, &table, 1, 0)) || - hooks->postlock(&table, 1))) + postlock(thd, &table))) { /* purecov: begin tested */ /* @@ -4692,7 +4698,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, mysql_unlock_tables(thd, *lock); *lock= 0; } - drop_open_table(thd, table, &create_table->db, &create_table->table_name); + drop_open_table(thd, table, &table_list->db, &table_list->table_name); ddl_log_complete(&ddl_log_state_rm); ddl_log_complete(&ddl_log_state_create); DBUG_RETURN(NULL); @@ -4715,71 +4721,52 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, } -int -select_create::prepare(List &_values, SELECT_LEX_UNIT *u) +/* + For row-based replication, the CREATE-SELECT statement is written + in two pieces: the first one contain the CREATE TABLE statement + necessary to create the table and the second part contain the rows + that should go into the table. + + For non-temporary tables, the start of the CREATE-SELECT + implicitly commits the previous transaction, and all events + forming the statement will be stored the transaction cache. At end + of the statement, the entire statement is committed as a + transaction, and all events are written to the binary log. + + On the master, the table is locked for the duration of the + statement, but since the CREATE part is replicated as a simple + statement, there is no way to lock the table for accesses on the + slave. Hence, we have to hold on to the CREATE part of the + statement until the statement has finished. +*/ +int select_create::postlock(THD *thd, TABLE **tables) { - List values(_values, thd->mem_root); - MYSQL_LOCK *extra_lock= NULL; - DBUG_ENTER("select_create::prepare"); - - TABLEOP_HOOKS *hook_ptr= NULL; /* - For row-based replication, the CREATE-SELECT statement is written - in two pieces: the first one contain the CREATE TABLE statement - necessary to create the table and the second part contain the rows - that should go into the table. - - For non-temporary tables, the start of the CREATE-SELECT - implicitly commits the previous transaction, and all events - forming the statement will be stored the transaction cache. At end - of the statement, the entire statement is committed as a - transaction, and all events are written to the binary log. - - On the master, the table is locked for the duration of the - statement, but since the CREATE part is replicated as a simple - statement, there is no way to lock the table for accesses on the - slave. Hence, we have to hold on to the CREATE part of the - statement until the statement has finished. - */ - class MY_HOOKS : public TABLEOP_HOOKS { - public: - MY_HOOKS(select_create *x, TABLE_LIST *create_table_arg, - TABLE_LIST *select_tables_arg) - : ptr(x), - create_table(create_table_arg), - select_tables(select_tables_arg) - { - } - - private: - virtual int do_postlock(TABLE **tables, uint count) - { - int error; - THD *thd= const_cast(ptr->get_thd()); - TABLE_LIST *save_next_global= create_table->next_global; - - create_table->next_global= select_tables; - - error= thd->decide_logging_format(create_table); + NOTE: for row format CREATE TABLE must be logged before row data. + */ + int error; + TABLE_LIST *save_next_global= table_list->next_global; + table_list->next_global= select_tables; + error= thd->decide_logging_format(table_list); + table_list->next_global= save_next_global; - create_table->next_global= save_next_global; + if (unlikely(error)) + return error; - if (unlikely(error)) - return error; + TABLE const *const table = *tables; + if (thd->is_current_stmt_binlog_format_row() && + !table->s->tmp_table) + return binlog_show_create_table_(thd, *tables, create_info); + return 0; +} - TABLE const *const table = *tables; - if (thd->is_current_stmt_binlog_format_row() && - !table->s->tmp_table) - return binlog_show_create_table_(thd, *tables, ptr->create_info); - return 0; - } - select_create *ptr; - TABLE_LIST *create_table; - TABLE_LIST *select_tables; - }; - MY_HOOKS hooks(this, create_table, select_tables); - hook_ptr= &hooks; +int +select_create::prepare(List &_values, SELECT_LEX_UNIT *u) +{ + List values(_values, thd->mem_root); + MYSQL_LOCK *extra_lock= NULL; + DBUG_ENTER("select_create::prepare"); unit= u; @@ -4795,12 +4782,12 @@ select_create::prepare(List &_values, SELECT_LEX_UNIT *u) thd->binlog_start_trans_and_stmt(); } - if (!(table= create_table_from_items(thd, &values, &extra_lock, hook_ptr))) + if (!(table= create_table_from_items(thd, &values, &extra_lock))) { if (create_info->or_replace()) { /* Original table was deleted. We have to log it */ - log_drop_table(thd, &create_table->db, &create_table->table_name, + log_drop_table(thd, &table_list->db, &table_list->table_name, &create_info->org_storage_engine_name, create_info->db_type == partition_hton, &create_info->org_tabledef_version, @@ -4820,7 +4807,7 @@ select_create::prepare(List &_values, SELECT_LEX_UNIT *u) list to keep them inaccessible from inner statements. e.g. CREATE TEMPORARY TABLE `t1` AS SELECT * FROM `t1`; */ - saved_tmp_table_share= thd->save_tmp_table_share(create_table->table); + saved_tmp_table_share= thd->save_tmp_table_share(table_list->table); } if (extra_lock) @@ -5119,8 +5106,8 @@ bool select_create::send_eof() */ wsrep_key_arr_t key_arr= {0, 0}; wsrep_prepare_keys_for_isolation(thd, - create_table->db.str, - create_table->table_name.str, + table_list->db.str, + table_list->table_name.str, table_list, &key_arr); int rcode= wsrep_thd_append_key(thd, key_arr.keys, key_arr.keys_len, @@ -5176,8 +5163,8 @@ bool select_create::send_eof() else lex_string_set(&ddl_log.org_storage_engine_name, ha_resolve_storage_engine_name(create_info->db_type)); - ddl_log.org_database= create_table->db; - ddl_log.org_table= create_table->table_name; + ddl_log.org_database= table_list->db; + ddl_log.org_table= table_list->table_name; ddl_log.org_table_id= create_info->tabledef_version; backup_log_ddl(&ddl_log); } @@ -5292,7 +5279,7 @@ void select_create::abort_result_set() m_plock= NULL; } - drop_open_table(thd, table, &create_table->db, &create_table->table_name); + drop_open_table(thd, table, &table_list->db, &table_list->table_name); table=0; // Safety if (thd->log_current_statement()) { @@ -5307,7 +5294,7 @@ void select_create::abort_result_set() ddl_log_update_xid(&ddl_log_state_create, thd->binlog_xid); ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid); debug_crash_here("ddl_log_create_before_binlog"); - log_drop_table(thd, &create_table->db, &create_table->table_name, + log_drop_table(thd, &table_list->db, &table_list->table_name, &create_info->org_storage_engine_name, create_info->db_type == partition_hton, &create_info->tabledef_version, @@ -5323,8 +5310,8 @@ void select_create::abort_result_set() ddl_log.query= { C_STRING_WITH_LEN("DROP_AFTER_CREATE") }; ddl_log.org_partitioned= (create_info->db_type == partition_hton); ddl_log.org_storage_engine_name= create_info->org_storage_engine_name; - ddl_log.org_database= create_table->db; - ddl_log.org_table= create_table->table_name; + ddl_log.org_database= table_list->db; + ddl_log.org_table= table_list->table_name; ddl_log.org_table_id= create_info->tabledef_version; backup_log_ddl(&ddl_log); } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 9d16f0dad35d4..e3f486486d7ae 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -6405,7 +6405,7 @@ bool LEX::sf_return_fill_definition(const Lex_field_type_st &def) void LEX::set_stmt_init() { sql_command= SQLCOM_SET_OPTION; - mysql_init_select(this); + init_select(); option_type= OPT_SESSION; autocommit= 0; var_list.empty(); @@ -9815,7 +9815,7 @@ bool LEX::last_field_generated_always_as_row_start_or_end(Lex_ident *p, last_field->field_name.str); return true; } - last_field->flags|= (flag | NOT_NULL_FLAG); + last_field->flags|= (flag | NO_DEFAULT_VALUE_FLAG | NOT_NULL_FLAG); DBUG_ASSERT(p); *p= last_field->field_name; return false; @@ -10389,8 +10389,7 @@ bool LEX::parsed_TVC_start() save_values_list_state(); many_values.empty(); insert_list= 0; - if (!(sel= alloc_select(TRUE)) || - push_select(sel)) + if (!(sel= alloc_select(TRUE)) || push_select(sel)) return true; sel->init_select(); sel->braces= FALSE; // just initialisation @@ -10402,9 +10401,7 @@ SELECT_LEX *LEX::parsed_TVC_end() { SELECT_LEX *res= pop_select(); // above TVC select if (!(res->tvc= - new (thd->mem_root) table_value_constr(many_values, - res, - res->options))) + new (thd->mem_root) table_value_constr(many_values, res, res->options))) return NULL; restore_values_list_state(); return res; diff --git a/sql/sql_list.cc b/sql/sql_list.cc index 92664898718d4..6ccec9b5f2a44 100644 --- a/sql/sql_list.cc +++ b/sql/sql_list.cc @@ -23,13 +23,6 @@ list_node end_of_list; -void free_list(I_List *list) -{ - i_string_pair *tmp; - while ((tmp= list->get())) - delete tmp; -} - void free_list(I_List *list) { diff --git a/sql/sql_list.h b/sql/sql_list.h index 9d159071ff341..edecb0f0be4c5 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -869,7 +869,6 @@ list_copy_and_replace_each_value(List &list, MEM_ROOT *mem_root) it.replace(el->clone(mem_root)); } -void free_list(I_List *list); void free_list(I_List *list); #endif // INCLUDES_MYSQL_SQL_LIST_H diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 91e2be2c78e26..48c3147a95c76 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2801,6 +2801,11 @@ bool sp_process_definer(THD *thd) LEX_USER *d= get_current_user(thd, lex->definer); if (!d) DBUG_RETURN(TRUE); + if (d->user.str == public_name.str) + { + my_error(ER_INVALID_ROLE, MYF(0), lex->definer->user.str); + DBUG_RETURN(TRUE); + } thd->change_item_tree((Item**)&lex->definer, (Item*)d); /* @@ -2824,12 +2829,9 @@ bool sp_process_definer(THD *thd) #ifndef NO_EMBEDDED_ACCESS_CHECKS if (!is_acl_user(lex->definer->host.str, lex->definer->user.str)) { - push_warning_printf(thd, - Sql_condition::WARN_LEVEL_NOTE, - ER_NO_SUCH_USER, - ER_THD(thd, ER_NO_SUCH_USER), - lex->definer->user.str, - lex->definer->host.str); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, + ER_NO_SUCH_USER, ER_THD(thd, ER_NO_SUCH_USER), + lex->definer->user.str, lex->definer->host.str); } #endif /* NO_EMBEDDED_ACCESS_CHECKS */ @@ -3121,8 +3123,7 @@ mysql_create_routine(THD *thd, LEX *lex) */ if (thd->slave_thread && is_acl_user(definer->host.str, definer->user.str)) { - security_context.change_security_context(thd, - &thd->lex->definer->user, + security_context.change_security_context(thd, &thd->lex->definer->user, &thd->lex->definer->host, &thd->lex->sphead->m_db, &backup); @@ -6763,10 +6764,7 @@ check_access(THD *thd, privilege_t want_access, { if (db && (!thd->db.str || db_is_pattern || strcmp(db, thd->db.str))) { - db_access= acl_get(sctx->host, sctx->ip, sctx->priv_user, db, - db_is_pattern); - if (sctx->priv_role[0]) - db_access|= acl_get("", "", sctx->priv_role, db, db_is_pattern); + db_access= acl_get_all3(sctx, db, db_is_pattern); } else { @@ -6811,14 +6809,7 @@ check_access(THD *thd, privilege_t want_access, } if (db && (!thd->db.str || db_is_pattern || strcmp(db, thd->db.str))) - { - db_access= acl_get(sctx->host, sctx->ip, sctx->priv_user, db, - db_is_pattern); - if (sctx->priv_role[0]) - { - db_access|= acl_get("", "", sctx->priv_role, db, db_is_pattern); - } - } + db_access= acl_get_all3(sctx, db, db_is_pattern); else db_access= sctx->db_access; DBUG_PRINT("info",("db_access: %llx want_access: %llx", @@ -7611,21 +7602,6 @@ void THD::reset_for_next_command(bool do_clear_error) } -/** - Resets the lex->current_select object. - @note It is assumed that lex->current_select != NULL - - This function is a wrapper around select_lex->init_select() with an added - check for the special situation when using INTO OUTFILE and LOAD DATA. -*/ - -void -mysql_init_select(LEX *lex) -{ - lex->init_select(); -} - - /** Used to allocate a new SELECT_LEX object on the current thd mem_root and link it into the relevant lists. @@ -7742,7 +7718,7 @@ void create_select_for_variable(THD *thd, LEX_CSTRING *var_name) DBUG_ENTER("create_select_for_variable"); lex= thd->lex; - mysql_init_select(lex); + lex->init_select(); lex->sql_command= SQLCOM_SELECT; /* We set the name of Item to @@session.var_name because that then is used @@ -7761,7 +7737,7 @@ void create_select_for_variable(THD *thd, LEX_CSTRING *var_name) void mysql_init_multi_delete(LEX *lex) { lex->sql_command= SQLCOM_DELETE_MULTI; - mysql_init_select(lex); + lex->init_select(); lex->first_select_lex()->limit_params.clear(); lex->unit.lim.clear(); lex->first_select_lex()->table_list. diff --git a/sql/sql_parse.h b/sql/sql_parse.h index d3cf83b6e08c5..eeb7f832adb26 100644 --- a/sql/sql_parse.h +++ b/sql/sql_parse.h @@ -87,7 +87,6 @@ bool stmt_causes_implicit_commit(THD *thd, uint mask); bool is_update_query(enum enum_sql_command command); bool is_log_table_write_query(enum enum_sql_command command); bool alloc_query(THD *thd, const char *packet, size_t packet_length); -void mysql_init_select(LEX *lex); void mysql_parse(THD *thd, char *rawbuf, uint length, Parser_state *parser_state); bool mysql_new_select(LEX *lex, bool move_down, SELECT_LEX *sel); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 75e0d096a40ef..c57e76da52c1a 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1773,7 +1773,7 @@ static bool mysql_test_call_fields(Prepared_statement *stmt, static bool select_like_stmt_test(Prepared_statement *stmt, int (*specific_prepare)(THD *thd), - ulong setup_tables_done_option) + ulonglong setup_tables_done_option) { DBUG_ENTER("select_like_stmt_test"); THD *thd= stmt->thd; @@ -1810,7 +1810,7 @@ static bool select_like_stmt_test_with_open(Prepared_statement *stmt, TABLE_LIST *tables, int (*specific_prepare)(THD *thd), - ulong setup_tables_done_option) + ulonglong setup_tables_done_option) { uint table_count= 0; DBUG_ENTER("select_like_stmt_test_with_open"); diff --git a/sql/sql_priv.h b/sql/sql_priv.h index 381ac26f3a37a..6f4eff4880c0c 100644 --- a/sql/sql_priv.h +++ b/sql/sql_priv.h @@ -147,8 +147,7 @@ #define OPTION_RELAXED_UNIQUE_CHECKS (1ULL << 27) // THD, user, binlog #define OPTION_IF_EXISTS (1ULL << 28) // binlog #define OPTION_SCHEMA_TABLE (1ULL << 29) // SELECT, intern -/** Flag set if setup_tables already done */ -#define OPTION_SETUP_TABLES_DONE (1ULL << 30) // intern +#define OPTION_INSERT_HISTORY (1ULL << 30) /** If not set then the thread will ignore all warnings with level notes. */ #define OPTION_SQL_NOTES (1ULL << 31) // THD, user /** @@ -187,6 +186,8 @@ #define OPTION_BIN_COMMIT_OFF (1ULL << 43) /* The following is used to detect a conflict with DISTINCT */ #define SELECT_ALL (1ULL << 44) // SELECT, user, parser +/** Flag set if setup_tables already done */ +#define OPTION_SETUP_TABLES_DONE (1ULL << 45) // intern #define OPTION_LEX_FOUND_COMMENT (1ULL << 0) // intern, parser diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 5948b8ebc3d5a..1137e0e1b0983 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -376,7 +376,7 @@ do_rename(THD *thd, rename_param *param, DDL_LOG_STATE *ddl_log_state, thd->replication_flags= 0; - if (ddl_log_rename_table(thd, ddl_log_state, hton, + if (ddl_log_rename_table(ddl_log_state, hton, &ren_table->db, old_alias, new_db, new_alias)) DBUG_RETURN(1); @@ -440,7 +440,7 @@ do_rename(THD *thd, rename_param *param, DDL_LOG_STATE *ddl_log_state, DBUG_RETURN(1); } - ddl_log_rename_view(thd, ddl_log_state, &ren_table->db, + ddl_log_rename_view(ddl_log_state, &ren_table->db, &ren_table->table_name, new_db, new_alias); debug_crash_here("ddl_log_rename_before_rename_view"); rc= mysql_rename_view(thd, new_db, new_alias, &ren_table->db, diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5b3d65d83156f..f56ab1dd87415 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -559,7 +559,7 @@ static void trace_table_dependencies(THD *thd, */ bool handle_select(THD *thd, LEX *lex, select_result *result, - ulong setup_tables_done_option) + ulonglong setup_tables_done_option) { bool res; SELECT_LEX *select_lex= lex->first_select_lex(); diff --git a/sql/sql_select.h b/sql/sql_select.h index 498c292a69007..2cd32d73e38f5 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -2083,7 +2083,7 @@ int join_read_key2(THD *thd, struct st_join_table *tab, TABLE *table, struct st_table_ref *table_ref); bool handle_select(THD *thd, LEX *lex, select_result *result, - ulong setup_tables_done_option); + ulonglong setup_tables_done_option); bool mysql_select(THD *thd, TABLE_LIST *tables, List &list, COND *conds, uint og_num, ORDER *order, ORDER *group, Item *having, ORDER *proc_param, ulonglong select_type, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e1a5aff3473f7..9510d74c86d93 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -65,7 +65,7 @@ #include "transaction.h" #include "opt_trace.h" #include "my_cpu.h" - +#include "key.h" #include "lex_symbol.h" #define KEYWORD_SIZE 64 @@ -150,7 +150,8 @@ static int show_create_sequence(THD *thd, TABLE_LIST *table_list, static const LEX_CSTRING *view_algorithm(TABLE_LIST *table); -bool get_lookup_field_values(THD *, COND *, TABLE_LIST *, LOOKUP_FIELD_VALUES *); +bool get_lookup_field_values(THD *, COND *, bool, TABLE_LIST *, + LOOKUP_FIELD_VALUES *); /** Try to lock a mutex, but give up after a short while to not cause deadlocks @@ -340,7 +341,7 @@ int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond) TABLE *table= tables->table; LOOKUP_FIELD_VALUES lookup; - if (get_lookup_field_values(thd, cond, tables, &lookup)) + if (get_lookup_field_values(thd, cond, true, tables, &lookup)) DBUG_RETURN(0); if (lookup.db_value.str && !lookup.db_value.str[0]) @@ -1405,12 +1406,8 @@ bool mysqld_show_create_db(THD *thd, LEX_CSTRING *dbname, if (test_all_bits(sctx->master_access, DB_ACLS)) db_access=DB_ACLS; else - { - db_access= acl_get(sctx->host, sctx->ip, sctx->priv_user, dbname->str, 0) | + db_access= acl_get_all3(sctx, dbname->str, FALSE) | sctx->master_access; - if (sctx->priv_role[0]) - db_access|= acl_get("", "", sctx->priv_role, dbname->str, 0); - } if (!(db_access & DB_ACLS) && check_grant_db(thd,dbname->str)) { @@ -4256,7 +4253,8 @@ COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table) 1 error, there can be no matching records for the condition */ -bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables, +bool get_lookup_field_values(THD *thd, COND *cond, bool fix_table_name_case, + TABLE_LIST *tables, LOOKUP_FIELD_VALUES *lookup_field_values) { LEX *lex= thd->lex; @@ -4291,7 +4289,7 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables, lex->first_select_lex()->db.length); if (wild) { - thd->make_lex_string(&lookup_field_values->table_value, + thd->make_lex_string(&lookup_field_values->table_value, wild->ptr(), wild->length()); lookup_field_values->wild_table_value= 1; } @@ -4314,7 +4312,8 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables, if (lookup_field_values->db_value.str && lookup_field_values->db_value.str[0]) my_casedn_str(system_charset_info, (char*) lookup_field_values->db_value.str); - if (lookup_field_values->table_value.str && + if (fix_table_name_case && + lookup_field_values->table_value.str && lookup_field_values->table_value.str[0]) my_casedn_str(system_charset_info, (char*) lookup_field_values->table_value.str); @@ -5299,7 +5298,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) &thd->col_access, NULL, 0, 1) || (!thd->col_access && check_grant_db(thd, db_name->str))) || sctx->master_access & (DB_ACLS | SHOW_DB_ACL) || - acl_get(sctx->host, sctx->ip, sctx->priv_user, db_name->str, 0)) + acl_get_all3(sctx, db_name->str, 0)) #endif { Dynamic_array table_names(PSI_INSTRUMENT_MEM); @@ -5469,7 +5468,7 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond) #endif DBUG_ENTER("fill_schema_shemata"); - if (get_lookup_field_values(thd, cond, tables, &lookup_field_vals)) + if (get_lookup_field_values(thd, cond, true, tables, &lookup_field_vals)) DBUG_RETURN(0); DBUG_PRINT("INDEX VALUES",("db_name: %s table_name: %s", lookup_field_vals.db_value.str, @@ -5499,9 +5498,7 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond) } #ifndef NO_EMBEDDED_ACCESS_CHECKS if (sctx->master_access & (DB_ACLS | SHOW_DB_ACL) || - acl_get(sctx->host, sctx->ip, sctx->priv_user, db_name->str, false) || - (sctx->priv_role[0] ? - acl_get("", "", sctx->priv_role, db_name->str, false) : NO_ACL) || + acl_get_all3(sctx, db_name->str, false) || !check_grant_db(thd, db_name->str)) #endif { @@ -6449,25 +6446,82 @@ static inline void copy_field_as_string(Field *to_field, Field *from_field) } +/** + @brief When scanning mysql.proc check if we should skip this record or even + stop the scan + + @param name_field_charset mysql.proc.name field charset info + @param lookup values from the WHERE clause which are + used for the index lookup + @param db mysql.proc.db field value of + the current record + @param name mysql.proc.name field value of + the current record + + @return Result + @retval -1 The record is match (do further processing) + @retval 0 Skip this record, it doesn't match. + @retval HA_ERR_END_OF_FILE Stop scanning, no further matches possible +*/ + +int check_proc_record(const CHARSET_INFO *name_field_charset, + const LOOKUP_FIELD_VALUES *lookup, + const LEX_CSTRING &db, + const LEX_CSTRING &name) +{ + if (lookup->db_value.str && cmp(lookup->db_value, db)) + { + /* + We have the name of target database. If we got a non-matching + record, this means we've finished reading matching mysql.proc records + */ + return HA_ERR_END_OF_FILE; + } + + if (lookup->table_value.str) + { + if ((my_ci_strnncoll(name_field_charset, + (const uchar *) lookup->table_value.str, + lookup->table_value.length, + (const uchar *) name.str, name.length, 0))) + { + /* Routine name doesn't match. */ + if (lookup->db_value.str) + { + /* + We're using index lookup. A non-matching record means we've + finished reading matches. + */ + return HA_ERR_END_OF_FILE; + } + else + { + /* The routine name doesn't match, but we're scanning all databases */ + return 0; /* Continue scanning */ + } + } + } + return -1; /* This is a match */ +} + /** @brief Store record into I_S.PARAMETERS table @param[in] thd thread handler @param[in] table I_S table @param[in] proc_table 'mysql.proc' table - @param[in] wild wild string, not used for now, - will be useful - if we add 'SHOW PARAMETERs' @param[in] full_access if 1 user has privileges on the routine @param[in] sp_user user in 'user@host' format @return Operation status @retval 0 ok - @retval 1 error + @retval != 0 error / HA_ERR_END_OF_FILE + (if there are no more + matching records) */ -bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table, - const char *wild, bool full_access, +int store_schema_params(THD *thd, TABLE *table, TABLE *proc_table, + LOOKUP_FIELD_VALUES *lookup, bool full_access, const char *sp_user) { TABLE_SHARE share; @@ -6481,6 +6535,7 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table, bool free_sp_head; bool error= 0; sql_mode_t sql_mode; + int rc; DBUG_ENTER("store_schema_params"); bzero((char*) &tbl, sizeof(TABLE)); @@ -6489,6 +6544,12 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table, proc_table->field[MYSQL_PROC_FIELD_DB]->val_str_nopad(thd->mem_root, &db); proc_table->field[MYSQL_PROC_FIELD_NAME]->val_str_nopad(thd->mem_root, &name); + + CHARSET_INFO *name_cs= proc_table->field[MYSQL_PROC_FIELD_NAME]->charset(); + + if ((rc= check_proc_record(name_cs, lookup, db, name)) != -1) + DBUG_RETURN(rc); /* either HA_ERR_END_OF_FILE or 0 if name didn't match */ + proc_table->field[MYSQL_PROC_FIELD_DEFINER]->val_str_nopad(thd->mem_root, &definer); sql_mode= (sql_mode_t) proc_table->field[MYSQL_PROC_FIELD_SQL_MODE]->val_int(); sph= Sp_handler::handler_mysql_proc((enum_sp_type) @@ -6592,16 +6653,24 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table, } -bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, - const char *wild, bool full_access, const char *sp_user) +int store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, + LOOKUP_FIELD_VALUES *lookup, bool full_access, + const char *sp_user) { LEX *lex= thd->lex; CHARSET_INFO *cs= system_charset_info; const Sp_handler *sph; LEX_CSTRING db, name, definer, returns= empty_clex_str; + const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS; + int rc; proc_table->field[MYSQL_PROC_FIELD_DB]->val_str_nopad(thd->mem_root, &db); proc_table->field[MYSQL_PROC_FIELD_NAME]->val_str_nopad(thd->mem_root, &name); + + CHARSET_INFO *name_cs= proc_table->field[MYSQL_PROC_FIELD_NAME]->charset(); + if ((rc= check_proc_record(name_cs, lookup, db, name)) != -1) + return rc; /* either HA_ERR_END_OF_FILE or 0 if name didn't match */ + proc_table->field[MYSQL_PROC_FIELD_DEFINER]->val_str_nopad(thd->mem_root, &definer); sph= Sp_handler::handler_mysql_proc((enum_sp_type) proc_table->field[MYSQL_PROC_MYSQL_TYPE]-> @@ -6713,7 +6782,6 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond) { TABLE *proc_table; TABLE_LIST proc_tables; - const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS; int res= 0; TABLE *table= tables->table; bool full_access; @@ -6733,6 +6801,13 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond) full_access= !check_table_access(thd, SELECT_ACL, &proc_tables, FALSE, 1, TRUE); + LOOKUP_FIELD_VALUES lookup; + if (get_lookup_field_values(thd, cond, false, tables, &lookup)) + { + // There can be no matching records for the condition + DBUG_RETURN(0); + } + start_new_trans new_trans(thd); if (!(proc_table= open_proc_table_for_read(thd))) @@ -6751,34 +6826,55 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond) goto err; } - if ((res= proc_table->file->ha_index_first(proc_table->record[0]))) + if (lookup.db_value.str) { - res= (res == HA_ERR_END_OF_FILE) ? 0 : 1; - goto err; + KEY *keyinfo= proc_table->key_info; + uint keylen= keyinfo->key_part[0].length; + key_part_map keypart_map= 1; + enum ha_rkey_function find_flag= HA_READ_PREFIX; + const auto sp_name_len= NAME_LEN * 2 + 1 /*for type*/; + StringBuffer keybuf; + keybuf.alloc(proc_table->key_info->key_length); + keybuf.length(proc_table->key_info->key_length); + proc_table->field[0]->store(lookup.db_value.str, lookup.db_value.length, + system_charset_info); + if (lookup.table_value.str) + { + proc_table->field[1]->store(lookup.table_value.str, + lookup.table_value.length, + system_charset_info); + keylen+= keyinfo->key_part[1].length; + keypart_map= 3; + find_flag= HA_READ_KEY_EXACT; + } + key_copy((uchar*)keybuf.ptr(), proc_table->record[0], keyinfo, keylen, 0); + res= proc_table->file->ha_index_read_map(proc_table->record[0], + (const uchar*) keybuf.ptr(), + keypart_map, find_flag); } + else + res= proc_table->file->ha_index_first(proc_table->record[0]); - if (schema_table_idx == SCH_PROCEDURES ? - store_schema_proc(thd, table, proc_table, wild, full_access, definer) : - store_schema_params(thd, table, proc_table, wild, full_access, definer)) - { - res= 1; + if (res) goto err; - } - while (!proc_table->file->ha_index_next(proc_table->record[0])) + + res= schema_table_idx == SCH_PROCEDURES ? + store_schema_proc(thd, table, proc_table, &lookup, full_access,definer) : + store_schema_params(thd, table, proc_table, &lookup, full_access, definer); + while (!res && !proc_table->file->ha_index_next(proc_table->record[0])) { - if (schema_table_idx == SCH_PROCEDURES ? - store_schema_proc(thd, table, proc_table, wild, full_access, definer): - store_schema_params(thd, table, proc_table, wild, full_access, definer)) - { - res= 1; - goto err; - } + res= schema_table_idx == SCH_PROCEDURES ? + store_schema_proc(thd, table, proc_table, &lookup, full_access, definer) : + store_schema_params(thd, table, proc_table, &lookup, full_access, definer); } err: if (proc_table->file->inited) (void) proc_table->file->ha_index_end(); + if (res == HA_ERR_END_OF_FILE || res == HA_ERR_KEY_NOT_FOUND) + res= 0; + thd->commit_whole_transaction_and_close_tables(); new_trans.restore_old_transaction(); @@ -8676,7 +8772,8 @@ static bool optimize_for_get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond goto end; } - if (get_lookup_field_values(thd, cond, tables, &plan->lookup_field_vals)) + if (get_lookup_field_values(thd, cond, true, tables, + &plan->lookup_field_vals)) { plan->no_rows= true; goto end; @@ -9868,7 +9965,7 @@ ST_SCHEMA_TABLE schema_tables[]= {"OPTIMIZER_TRACE", Show::optimizer_trace_info, 0, fill_optimizer_trace_info, NULL, NULL, -1, -1, false, 0}, {"PARAMETERS", Show::parameters_fields_info, 0, - fill_schema_proc, 0, 0, -1, -1, 0, 0}, + fill_schema_proc, 0, 0, 1, 2, 0, 0}, {"PARTITIONS", Show::partitions_fields_info, 0, get_all_tables, 0, get_schema_partitions_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY}, @@ -9883,7 +9980,7 @@ ST_SCHEMA_TABLE schema_tables[]= 0, get_all_tables, 0, get_referential_constraints_record, 1, 9, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY}, {"ROUTINES", Show::proc_fields_info, 0, - fill_schema_proc, make_proc_old_format, 0, -1, -1, 0, 0}, + fill_schema_proc, make_proc_old_format, 0, 2, 3, 0, 0}, {"SCHEMATA", Show::schema_fields_info, 0, fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0}, {"SCHEMA_PRIVILEGES", Show::schema_privileges_fields_info, 0, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 478bfa5e3a39a..3ca70ff93f01c 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -820,7 +820,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) create_info->db_type= work_part_info->default_engine_type; /* NOTE: partitioned temporary tables are not supported. */ DBUG_ASSERT(!create_info->tmp_table()); - if (ddl_log_create_table(thd, part_info, create_info->db_type, &new_path, + if (ddl_log_create_table(part_info, create_info->db_type, &new_path, &alter_ctx->new_db, &alter_ctx->new_name, true) || ERROR_INJECT("create_before_create_frm")) DBUG_RETURN(TRUE); @@ -1537,7 +1537,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, if (!table_count++) { LEX_CSTRING comment= {comment_start, (size_t) comment_len}; - if (ddl_log_drop_table_init(thd, ddl_log_state, current_db, &comment)) + if (ddl_log_drop_table_init(ddl_log_state, current_db, &comment)) { error= 1; goto err; @@ -1595,10 +1595,10 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool enoent_warning= !dont_log_query && !(hton && hton->discover_table); if (was_view) - res= ddl_log_drop_view(thd, ddl_log_state, &cpath, &db, + res= ddl_log_drop_view(ddl_log_state, &cpath, &db, &table_name); else - res= ddl_log_drop_table(thd, ddl_log_state, hton, &cpath, &db, + res= ddl_log_drop_table(ddl_log_state, hton, &cpath, &db, &table_name); if (res) { @@ -1676,7 +1676,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, int ferror= 0; DBUG_ASSERT(!was_view); - if (ddl_log_drop_table(thd, ddl_log_state, 0, &cpath, &db, + if (ddl_log_drop_table(ddl_log_state, 0, &cpath, &db, &table_name)) { error= -1; @@ -3693,7 +3693,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, } if (sql_field->invisible == INVISIBLE_USER && sql_field->flags & NOT_NULL_FLAG && - sql_field->flags & NO_DEFAULT_VALUE_FLAG) + sql_field->flags & NO_DEFAULT_VALUE_FLAG && + !sql_field->vers_sys_field()) { my_error(ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT, MYF(0), sql_field->field_name.str); @@ -4550,7 +4551,7 @@ int create_table_impl(THD *thd, .frm files are deleted */ if (ddl_log_state_create) - ddl_log_create_table(thd, ddl_log_state_create, (handlerton*) 0, &path, + ddl_log_create_table(ddl_log_state_create, (handlerton*) 0, &path, &db, &table_name, 1); ha_err= hton->discover_table_structure(hton, thd, &share, create_info); @@ -4575,7 +4576,7 @@ int create_table_impl(THD *thd, else { if (ddl_log_state_create) - ddl_log_create_table(thd, ddl_log_state_create, create_info->db_type, + ddl_log_create_table(ddl_log_state_create, create_info->db_type, &path, &db, &table_name, frm_only); debug_crash_here("ddl_log_create_before_create_frm"); @@ -9507,7 +9508,7 @@ simple_rename_or_index_change(THD *thd, TABLE_LIST *table_list, close_all_tables_for_name(thd, table->s, HA_EXTRA_PREPARE_FOR_RENAME, NULL); - (void) ddl_log_rename_table(thd, &ddl_log_state, old_db_type, + (void) ddl_log_rename_table(&ddl_log_state, old_db_type, &alter_ctx->db, &alter_ctx->table_name, &alter_ctx->new_db, &alter_ctx->new_alias); if (mysql_rename_table(old_db_type, &alter_ctx->db, &alter_ctx->table_name, @@ -10585,7 +10586,7 @@ do_continue:; if (alter_ctx.is_table_renamed()) tmp_table= alter_ctx.new_alias; - if (ddl_log_alter_table(thd, &ddl_log_state, + if (ddl_log_alter_table(&ddl_log_state, old_db_type, &alter_ctx.db, &alter_ctx.table_name, new_db_type, @@ -10620,7 +10621,7 @@ do_continue:; Partitioning: part_info is passed via thd->work_part_info */ - error= create_table_impl(thd, nullptr, nullptr, + error= create_table_impl(thd, (DDL_LOG_STATE*) 0, (DDL_LOG_STATE*) 0, alter_ctx.db, alter_ctx.table_name, alter_ctx.new_db, alter_ctx.tmp_name, alter_ctx.get_tmp_cstring_path(), diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index d29ef53238262..067b921eaf3a9 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -983,7 +983,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, /* Use the filesystem to enforce trigger namespace constraints. */ trigger_exists= !access(trigname_file.str, F_OK); - ddl_log_create_trigger(thd, ddl_log_state, &tables->db, &tables->table_name, + ddl_log_create_trigger(ddl_log_state, &tables->db, &tables->table_name, &lex->spname->m_name, trigger_exists || table->triggers->count ? DDL_CREATE_TRIGGER_PHASE_DELETE_COPY : @@ -992,7 +992,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, /* Make a backup of the .TRG file that we can restore in case of crash */ if (table->triggers->count && (sql_backup_definition_file(&file, &backup_name) || - ddl_log_delete_tmp_file(thd, ddl_log_state_tmp_file, &backup_name, + ddl_log_delete_tmp_file(ddl_log_state_tmp_file, &backup_name, ddl_log_state))) DBUG_RETURN(true); @@ -1004,7 +1004,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, /* Make a backup of the .TRN file that we can restore in case of crash */ if (sql_backup_definition_file(&trigname_file, &backup_name) || - ddl_log_delete_tmp_file(thd, ddl_log_state_tmp_file, &backup_name, + ddl_log_delete_tmp_file(ddl_log_state_tmp_file, &backup_name, ddl_log_state)) DBUG_RETURN(true); ddl_log_update_phase(ddl_log_state, DDL_CREATE_TRIGGER_PHASE_OLD_COPIED); @@ -1350,7 +1350,7 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables, /* This code is executed in case of DROP TRIGGER */ lex_string_set3(&query, thd->query(), thd->query_length()); } - if (ddl_log_drop_trigger(thd, ddl_log_state, + if (ddl_log_drop_trigger(ddl_log_state, &tables->db, &tables->table_name, sp_name, &query)) goto err; diff --git a/sql/sql_tvc.cc b/sql/sql_tvc.cc index d1c32e7d9d3ff..066d6b7483d08 100644 --- a/sql/sql_tvc.cc +++ b/sql/sql_tvc.cc @@ -984,7 +984,7 @@ Item *Item_func_in::in_predicate_to_in_subs_transformer(THD *thd, */ if (mysql_new_select(lex, 1, NULL)) goto err; - mysql_init_select(lex); + lex->init_select(); /* Create item list as '*' for the subquery SQ */ Item *item; SELECT_LEX *sq_select; // select for IN subquery; @@ -1002,7 +1002,7 @@ Item *Item_func_in::in_predicate_to_in_subs_transformer(THD *thd, SELECT_LEX_UNIT *derived_unit; // unit for tvc_select if (mysql_new_select(lex, 1, NULL)) goto err; - mysql_init_select(lex); + lex->init_select(); tvc_select= lex->current_select; derived_unit= tvc_select->master_unit(); tvc_select->set_linkage(DERIVED_TABLE_TYPE); diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 758edbdcbaa09..0a92422676a04 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -33,7 +33,7 @@ #include "item_windowfunc.h" bool mysql_union(THD *thd, LEX *lex, select_result *result, - SELECT_LEX_UNIT *unit, ulong setup_tables_done_option) + SELECT_LEX_UNIT *unit, ulonglong setup_tables_done_option) { DBUG_ENTER("mysql_union"); bool res; diff --git a/sql/sql_union.h b/sql/sql_union.h index 3776831bdd7b2..2cda0cbba3602 100644 --- a/sql/sql_union.h +++ b/sql/sql_union.h @@ -23,7 +23,7 @@ struct LEX; typedef class st_select_lex_unit SELECT_LEX_UNIT; bool mysql_union(THD *thd, LEX *lex, select_result *result, - SELECT_LEX_UNIT *unit, ulong setup_tables_done_option); + SELECT_LEX_UNIT *unit, ulonglong setup_tables_done_option); #endif /* SQL_UNION_INCLUDED */ diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 033f98fd7195b..f56ec5c83c941 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -51,7 +51,7 @@ compare_record(TABLE*). */ bool records_are_comparable(const TABLE *table) { - return !table->versioned(VERS_TRX_ID) && + return !table->versioned() && (((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) == 0) || bitmap_is_subset(table->write_set, table->read_set)); } diff --git a/sql/sql_view.cc b/sql/sql_view.cc index a2b744fc8bed8..30fba1bcf98c6 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -725,7 +725,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, if (backup_file_name[0]) { LEX_CSTRING cpath= {backup_file_name, strlen(backup_file_name) }; - ddl_log_delete_tmp_file(thd, &ddl_log_state_tmp_file, &cpath, + ddl_log_delete_tmp_file(&ddl_log_state_tmp_file, &cpath, &ddl_log_state); } debug_crash_here("ddl_log_create_before_binlog"); @@ -1199,7 +1199,7 @@ static int mysql_register_view(THD *thd, DDL_LOG_STATE *ddl_log_state, goto err; } - ddl_log_create_view(thd, ddl_log_state, &path, old_view_exists ? + ddl_log_create_view(ddl_log_state, &path, old_view_exists ? DDL_CREATE_VIEW_PHASE_DELETE_VIEW_COPY : DDL_CREATE_VIEW_PHASE_NO_OLD_VIEW); @@ -1987,10 +1987,10 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) } if (!view_count++) { - if (ddl_log_drop_view_init(thd, &ddl_log_state, &thd->db)) + if (ddl_log_drop_view_init(&ddl_log_state, &thd->db)) DBUG_RETURN(TRUE); } - if (ddl_log_drop_view(thd, &ddl_log_state, &cpath, &view->db, + if (ddl_log_drop_view(&ddl_log_state, &cpath, &view->db, &view->table_name)) DBUG_RETURN(TRUE); debug_crash_here("ddl_log_drop_before_delete_view"); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index a1df516f58bb9..f0ed46646aeac 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1580,7 +1580,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); field_scale opt_field_scale %type user grant_user grant_role user_or_role current_role - admin_option_for_role user_maybe_role + admin_option_for_role user_maybe_role role_name %type opt_auth_str auth_expression auth_token text_or_password @@ -12767,7 +12767,7 @@ do: lex->sql_command = SQLCOM_DO; if (lex->main_select_push(true)) MYSQL_YYABORT; - mysql_init_select(lex); + lex->init_select(); } expr_list { @@ -12991,7 +12991,7 @@ replace: insert_start: { if (Lex->main_select_push()) MYSQL_YYABORT; - mysql_init_select(Lex); + Lex->init_select(); Lex->inc_select_stack_outer_barrier(); Lex->current_select->parsing_place= BEFORE_OPT_LIST; } @@ -13258,7 +13258,7 @@ update: LEX *lex= Lex; if (Lex->main_select_push()) MYSQL_YYABORT; - mysql_init_select(lex); + lex->init_select(); lex->sql_command= SQLCOM_UPDATE; lex->duplicates= DUP_ERROR; } @@ -13340,7 +13340,7 @@ delete: YYPS->m_mdl_type= MDL_SHARED_WRITE; if (Lex->main_select_push()) MYSQL_YYABORT; - mysql_init_select(lex); + lex->init_select(); lex->ignore= 0; lex->first_select_lex()->order_list.empty(); } @@ -13617,7 +13617,7 @@ show: lex->ident= null_clex_str; if (Lex->main_select_push()) MYSQL_YYABORT; - mysql_init_select(lex); + lex->init_select(); lex->current_select->parsing_place= SELECT_LIST; lex->create_info.init(); } @@ -13820,7 +13820,7 @@ show_param: { Lex->sql_command= SQLCOM_SHOW_GRANTS; if (unlikely(!(Lex->grant_user= - (LEX_USER*)thd->alloc(sizeof(LEX_USER))))) + (LEX_USER*)thd->calloc(sizeof(LEX_USER))))) MYSQL_YYABORT; Lex->grant_user->user= current_user_and_current_role; } @@ -13929,7 +13929,7 @@ show_param: { Lex->sql_command= SQLCOM_SHOW_CREATE_USER; if (unlikely(!(Lex->grant_user= - (LEX_USER*)thd->alloc(sizeof(LEX_USER))))) + (LEX_USER*)thd->calloc(sizeof(LEX_USER))))) MYSQL_YYABORT; Lex->grant_user->user= current_user; } @@ -14117,7 +14117,7 @@ describe: LEX *lex= Lex; if (lex->main_select_push()) MYSQL_YYABORT; - mysql_init_select(lex); + lex->init_select(); lex->current_select->parsing_place= SELECT_LIST; lex->sql_command= SQLCOM_SHOW_FIELDS; lex->first_select_lex()->db= null_clex_str; @@ -14208,7 +14208,7 @@ explain_for_connection: lex->ident= null_clex_str; if (Lex->main_select_push()) MYSQL_YYABORT; - mysql_init_select(lex); + lex->init_select(); lex->current_select->parsing_place= SELECT_LIST; lex->create_info.init(); Select->parsing_place= NO_MATTER; @@ -14578,7 +14578,7 @@ load: } if (lex->main_select_push()) MYSQL_YYABORT; - mysql_init_select(lex); + lex->init_select(); } load_data_lock opt_local INFILE TEXT_STRING_filesystem { @@ -16692,12 +16692,12 @@ option_value_no_option_type: if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY))) MYSQL_YYABORT; } - | ROLE_SYM ident_or_text + | ROLE_SYM role_name { if (sp_create_assignment_lex(thd, $1.pos())) MYSQL_YYABORT; LEX *lex = Lex; - set_var_role *var= new (thd->mem_root) set_var_role($2); + set_var_role *var= new (thd->mem_root) set_var_role($2->user); if (unlikely(var == NULL) || unlikely(lex->var_list.push_back(var, thd->mem_root)) || unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY))) @@ -17144,32 +17144,32 @@ current_role: if (unlikely(!($$=(LEX_USER*) thd->calloc(sizeof(LEX_USER))))) MYSQL_YYABORT; $$->user= current_role; - $$->auth= NULL; } ; -grant_role: - ident_or_text - { - CHARSET_INFO *cs= system_charset_info; - /* trim end spaces (as they'll be lost in mysql.user anyway) */ - $1.length= cs->lengthsp($1.str, $1.length); - ((char*) $1.str)[$1.length] = '\0'; - if (unlikely($1.length == 0)) - my_yyabort_error((ER_INVALID_ROLE, MYF(0), "")); - if (unlikely(!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))) - MYSQL_YYABORT; - $$->user= $1; - $$->host= empty_clex_str; - $$->auth= NULL; - if (unlikely(check_string_char_length(&$$->user, ER_USERNAME, - username_char_length, - cs, 0))) - MYSQL_YYABORT; - } - | current_role - ; +role_name: ident_or_text + { + CHARSET_INFO *cs= system_charset_info; + /* trim end spaces (as they'll be lost in mysql.user anyway) */ + $1.length= cs->lengthsp($1.str, $1.length); + ((char*) $1.str)[$1.length] = '\0'; + if (unlikely($1.length == 0)) + my_yyabort_error((ER_INVALID_ROLE, MYF(0), "")); + if (unlikely(!($$=(LEX_USER*) thd->calloc(sizeof(LEX_USER))))) + MYSQL_YYABORT; + if (lex_string_eq(&$1, &none)) + $$->user= none; + else if (lex_string_eq(&$1, &public_name)) + $$->user= public_name; + else if (check_string_char_length(&($$->user= $1), ER_USERNAME, + username_char_length, cs, 0)) + MYSQL_YYABORT; + $$->host= empty_clex_str; + } + ; + +grant_role: role_name | current_role ; opt_table: /* Empty */ diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 695c215a8546f..338f0f23c2c43 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -511,7 +511,8 @@ static Sys_var_charptr_fscs Sys_basedir( DEFAULT(0)); static Sys_var_charptr_fscs Sys_my_bind_addr( - "bind_address", "IP address to bind to.", + "bind_address", "IP address to bind to. Several addresses may be " + "specified, separated by a comma (,).", READ_ONLY GLOBAL_VAR(my_bind_addr_str), CMD_LINE(REQUIRED_ARG), DEFAULT(0)); @@ -1544,6 +1545,7 @@ static bool update_cached_long_query_time(sys_var *self, THD *thd, static Sys_var_double Sys_long_query_time( "long_query_time", + "Alias for log_slow_query_time. " "Log all queries that have taken more than long_query_time seconds " "to execute to the slow query log file. The argument will be treated " "as a decimal value with microsecond precision", @@ -1552,6 +1554,15 @@ static Sys_var_double Sys_long_query_time( NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(update_cached_long_query_time)); +static Sys_var_double Sys_log_slow_query_time( + "log_slow_query_time", + "Log all queries that have taken more than log_slow_query_time seconds " + "to execute to the slow query log file. The argument will be treated " + "as a decimal value with microsecond precision", + SESSION_VAR(long_query_time_double), + CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(10), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), + ON_UPDATE(update_cached_long_query_time)); static bool update_cached_max_statement_time(sys_var *self, THD *thd, enum_var_type type) @@ -1769,9 +1780,9 @@ static bool check_max_delayed_threads(sys_var *self, THD *thd, set_var *var) global_system_variables.max_insert_delayed_threads; } -// Alias for max_delayed_threads static Sys_var_ulong Sys_max_insert_delayed_threads( "max_insert_delayed_threads", + "Alias for max_delayed_threads. " "Don't start more than this number of threads to handle INSERT " "DELAYED statements. If set to zero INSERT DELAYED will be not used", SESSION_VAR(max_insert_delayed_threads), @@ -2600,6 +2611,14 @@ static Sys_var_ulong Sys_max_write_lock_count( static Sys_var_ulong Sys_min_examined_row_limit( "min_examined_row_limit", + "Alias for log_slow_min_examined_row_limit. " + "Don't write queries to slow log that examine fewer rows " + "than that", + SESSION_VAR(min_examined_row_limit), CMD_LINE(REQUIRED_ARG), + VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1)); + +static Sys_var_ulong Sys_log_slow_min_examined_row_limit( + "log_slow_min_examined_row_limit", "Don't write queries to slow log that examine fewer rows " "than that", SESSION_VAR(min_examined_row_limit), CMD_LINE(REQUIRED_ARG), @@ -3030,7 +3049,8 @@ static Sys_var_on_access_globalis_open(); log_type= QUERY_LOG_SLOW; @@ -5420,6 +5467,9 @@ bool Sys_var_rpl_filter::set_filter_value(const char *value, Master_info *mi) /* Proctect against other threads */ mysql_mutex_lock(&LOCK_active_mi); switch (opt_id) { + case OPT_REPLICATE_REWRITE_DB: + status= rpl_filter->set_rewrite_db(value); + break; case OPT_REPLICATE_DO_DB: status= rpl_filter->set_do_db(value); break; @@ -5468,6 +5518,9 @@ Sys_var_rpl_filter::global_value_ptr(THD *thd, mysql_mutex_lock(&LOCK_active_mi); switch (opt_id) { + case OPT_REPLICATE_REWRITE_DB: + rpl_filter->get_rewrite_db(&tmp); + break; case OPT_REPLICATE_DO_DB: rpl_filter->get_do_db(&tmp); break; @@ -5507,6 +5560,13 @@ static Sys_var_rpl_filter Sys_replicate_do_db( "actual names of table(s) being updated are checked.", PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_DO_DB); +static Sys_var_rpl_filter Sys_replicate_rewrite_db( + "replicate_rewrite_db", OPT_REPLICATE_REWRITE_DB, + "Tells the slave to replicate binlog events " + "into a different database than their original target on the master." + "Example: replicate-rewrite-db=master_db_name->slave_db_name.", + PRIV_SET_SYSTEM_GLOBAL_VAR_REPLICATE_REWRITE_DB); + static Sys_var_rpl_filter Sys_replicate_do_table( "replicate_do_table", OPT_REPLICATE_DO_TABLE, "Tells the slave to restrict replication to tables in the " @@ -6901,3 +6961,11 @@ static Sys_var_ulonglong Sys_max_rowid_filter_size( SESSION_VAR(max_rowid_filter_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(1024, (ulonglong)~(intptr)0), DEFAULT(128*1024), BLOCK_SIZE(1)); + +static Sys_var_bit Sys_system_versioning_insert_history( + "system_versioning_insert_history", + "Allows direct inserts into ROW_START and ROW_END columns if " + "secure_timestamp allows changing @@timestamp", + SESSION_VAR(option_bits), CMD_LINE(OPT_ARG), + OPTION_INSERT_HISTORY, DEFAULT(FALSE), + NO_MUTEX_GUARD, IN_BINLOG); diff --git a/sql/table.cc b/sql/table.cc index 0bc06d47a7148..6200288d9300c 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -7609,6 +7609,8 @@ void TABLE::mark_columns_needed_for_update() } if (s->versioned) { + bitmap_set_bit(write_set, s->vers.start_fieldno); + bitmap_set_bit(write_set, s->vers.end_fieldno); /* For System Versioning we have to read all columns since we store a copy of previous row with modified row_end back to a table. @@ -7666,6 +7668,12 @@ void TABLE::mark_columns_needed_for_insert() mark_auto_increment_column(); if (default_field) mark_default_fields_for_write(TRUE); + if (s->versioned) + { + bitmap_set_bit(write_set, s->vers.start_fieldno); + bitmap_set_bit(write_set, s->vers.end_fieldno); + bitmap_set_bit(read_set, s->vers.end_fieldno); + } /* Mark virtual columns for insert */ if (vfield) mark_virtual_columns_for_write(TRUE); @@ -9141,34 +9149,25 @@ bool TABLE::check_period_overlaps(const KEY &key, return true; } -void TABLE::vers_update_fields() +/* returns true if vers_end_field was updated */ +bool TABLE::vers_update_fields() { - if (!vers_write) + bool res= false; + if (versioned(VERS_TIMESTAMP) && !vers_start_field()->has_explicit_value()) { - file->column_bitmaps_signal(); - return; + if (vers_start_field()->set_time()) + DBUG_ASSERT(0); } - if (versioned(VERS_TIMESTAMP)) + if (!versioned(VERS_TIMESTAMP) || !vers_end_field()->has_explicit_value()) { - bitmap_set_bit(write_set, vers_start_field()->field_index); - if (vers_start_field()->store_timestamp(in_use->query_start(), - in_use->query_start_sec_part())) - { - DBUG_ASSERT(0); - } - vers_start_field()->set_has_explicit_value(); - bitmap_set_bit(read_set, vers_start_field()->field_index); + vers_end_field()->set_max(); + res= true; } - bitmap_set_bit(write_set, vers_end_field()->field_index); - vers_end_field()->set_max(); - vers_end_field()->set_has_explicit_value(); - bitmap_set_bit(read_set, vers_end_field()->field_index); - - file->column_bitmaps_signal(); if (vfield) update_virtual_fields(file, VCOL_UPDATE_FOR_READ); + return res; } @@ -9177,7 +9176,6 @@ void TABLE::vers_update_end() if (vers_end_field()->store_timestamp(in_use->query_start(), in_use->query_start_sec_part())) DBUG_ASSERT(0); - vers_end_field()->set_has_explicit_value(); } /** diff --git a/sql/table.h b/sql/table.h index aeba303926a0b..5e858a24f88fa 100644 --- a/sql/table.h +++ b/sql/table.h @@ -301,6 +301,7 @@ typedef struct st_grant_info */ GRANT_TABLE *grant_table_user; GRANT_TABLE *grant_table_role; + GRANT_TABLE *grant_public; /** @brief Used for cache invalidation when caching privilege information. @@ -347,6 +348,14 @@ typedef struct st_grant_info want_privilege(NO_ACL), orig_want_privilege(NO_ACL) { } + + void read(const Security_context *sctx, const char *db, + const char *table); + + inline void refresh(const Security_context *sctx, const char *db, + const char *table); + inline privilege_t aggregate_privs(); + inline privilege_t aggregate_cols(); } GRANT_INFO; enum tmp_table_type @@ -1847,7 +1856,7 @@ struct TABLE static bool check_period_overlaps(const KEY &key, const uchar *lhs, const uchar *rhs); int delete_row(); /* Used in majority of DML (called from fill_record()) */ - void vers_update_fields(); + bool vers_update_fields(); /* Used in DELETE, DUP REPLACE and insert history row */ void vers_update_end(); void find_constraint_correlated_indexes(); diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc index a679304c40aff..854c11c1eea71 100644 --- a/sql/wsrep_utils.cc +++ b/sql/wsrep_utils.cc @@ -457,7 +457,13 @@ unsigned int wsrep_check_ip (const char* const addr, bool *is_ipv6) *is_ipv6= false; - int gai_ret= getaddrinfo(addr, NULL, &hints, &res); + char *end; + char address[INET6_ADDRSTRLEN]; + + end= strcend(addr, ','); + strmake(address, addr, (uint) (end - addr)); + + int gai_ret= getaddrinfo(address, NULL, &hints, &res); if (0 == gai_ret) { if (AF_INET == res->ai_family) /* IPv4 */ diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 49b363b76d359..848855b41e551 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -1,6 +1,6 @@ # Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2014, 2022, MariaDB Corporation. +# Copyright (c) 2014, 2023, MariaDB Corporation. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -270,7 +270,6 @@ SET(INNOBASE_SOURCES include/handler0alter.h include/hash0hash.h include/ibuf0ibuf.h - include/ibuf0ibuf.inl include/lock0iter.h include/lock0lock.h include/lock0lock.inl diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 73d88596743f9..99cb135e019b7 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2022, MariaDB Corporation. +Copyright (c) 2014, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -37,7 +37,6 @@ Created 6/2/1994 Heikki Tuuri #include "btr0defragment.h" #include "rem0cmp.h" #include "lock0lock.h" -#include "ibuf0ibuf.h" #include "trx0trx.h" #include "srv0mon.h" #include "gis0geo.h" @@ -181,9 +180,8 @@ we allocate pages for the non-leaf levels of the tree. @param block B-tree root page @param space tablespace @return whether the segment header is valid */ -static bool btr_root_fseg_validate(ulint offset, - const buf_block_t &block, - const fil_space_t &space) +bool btr_root_fseg_validate(ulint offset, const buf_block_t &block, + const fil_space_t &space) { ut_ad(block.page.id().space() == space.id); const uint16_t hdr= mach_read_from_2(offset + FSEG_HDR_OFFSET + @@ -213,12 +211,11 @@ ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index) @param[in] index index tree @param[in] page page number @param[in] mode latch mode -@param[in] merge whether change buffer merge should be attempted @param[in,out] mtr mini-transaction @param[out] err error code @return block */ buf_block_t *btr_block_get(const dict_index_t &index, - uint32_t page, ulint mode, bool merge, + uint32_t page, ulint mode, mtr_t *mtr, dberr_t *err) { dberr_t local_err; @@ -227,7 +224,7 @@ buf_block_t *btr_block_get(const dict_index_t &index, buf_block_t *block= buf_page_get_gen(page_id_t{index.table->space->id, page}, index.table->space->zip_size(), mode, nullptr, BUF_GET, - mtr, err, merge && !index.is_clust()); + mtr, err); ut_ad(!block == (*err != DB_SUCCESS)); if (UNIV_LIKELY(block != nullptr)) @@ -266,15 +263,13 @@ btr_root_block_get( return nullptr; } - buf_block_t *block = btr_block_get(*index, index->page, mode, false, mtr, - err); + buf_block_t *block = btr_block_get(*index, index->page, mode, mtr, err); if (block) { - if (index->is_ibuf()); - else if (!btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF, - *block, *index->table->space) || - !btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP, - *block, *index->table->space)) + if (!btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF, + *block, *index->table->space) || + !btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP, + *block, *index->table->space)) { *err= DB_CORRUPTION; block= nullptr; @@ -460,46 +455,13 @@ btr_page_create( } } -/**************************************************************//** -Allocates a new file page to be used in an ibuf tree. Takes the page from -the free list of the tree, which must contain pages! -@return new allocated block, x-latched */ -static -buf_block_t* -btr_page_alloc_for_ibuf( -/*====================*/ - dict_index_t* index, /*!< in: index tree */ - mtr_t* mtr, /*!< in: mtr */ - dberr_t* err) /*!< out: error code */ -{ - buf_block_t *root= btr_root_block_get(index, RW_SX_LATCH, mtr, err); - if (UNIV_UNLIKELY(!root)) - return root; - - buf_block_t *new_block= - buf_page_get_gen(page_id_t(index->table->space_id, - mach_read_from_4(PAGE_HEADER + - PAGE_BTR_IBUF_FREE_LIST + - FLST_FIRST + FIL_ADDR_PAGE + - root->page.frame)), - index->table->space->zip_size(), RW_X_LATCH, nullptr, - BUF_GET, mtr, err); - if (new_block) - *err= flst_remove(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, new_block, - PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr); - ut_d(if (*err == DB_SUCCESS) - flst_validate(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr)); - return new_block; -} - /**************************************************************//** Allocates a new file page to be used in an index tree. NOTE: we assume that the caller has made the reservation for free extents! @retval NULL if no page could be allocated */ -static MY_ATTRIBUTE((nonnull, warn_unused_result)) +MY_ATTRIBUTE((nonnull, warn_unused_result)) buf_block_t* -btr_page_alloc_low( -/*===============*/ +btr_page_alloc( dict_index_t* index, /*!< in: index */ uint32_t hint_page_no, /*!< in: hint of a good page */ byte file_direction, /*!< in: direction where a possible @@ -513,6 +475,8 @@ btr_page_alloc_low( page should be initialized. */ dberr_t* err) /*!< out: error code */ { + ut_ad(level < BTR_MAX_NODE_LEVEL); + const auto savepoint= mtr->get_savepoint(); buf_block_t *root= btr_root_block_get(index, RW_NO_LATCH, mtr, err); if (UNIV_UNLIKELY(!root)) @@ -540,57 +504,6 @@ btr_page_alloc_low( true, mtr, init_mtr, err); } -/**************************************************************//** -Allocates a new file page to be used in an index tree. NOTE: we assume -that the caller has made the reservation for free extents! -@retval NULL if no page could be allocated */ -buf_block_t* -btr_page_alloc( -/*===========*/ - dict_index_t* index, /*!< in: index */ - uint32_t hint_page_no, /*!< in: hint of a good page */ - byte file_direction, /*!< in: direction where a possible - page split is made */ - ulint level, /*!< in: level where the page is placed - in the tree */ - mtr_t* mtr, /*!< in/out: mini-transaction - for the allocation */ - mtr_t* init_mtr, /*!< in/out: mini-transaction - for x-latching and initializing - the page */ - dberr_t* err) /*!< out: error code */ -{ - ut_ad(level < BTR_MAX_NODE_LEVEL); - return index->is_ibuf() - ? btr_page_alloc_for_ibuf(index, mtr, err) - : btr_page_alloc_low(index, hint_page_no, file_direction, level, - mtr, init_mtr, err); -} - -/**************************************************************//** -Frees a page used in an ibuf tree. Puts the page to the free list of the -ibuf tree. */ -static -dberr_t -btr_page_free_for_ibuf( -/*===================*/ - dict_index_t* index, /*!< in: index tree */ - buf_block_t* block, /*!< in: block to be freed, x-latched */ - mtr_t* mtr) /*!< in: mtr */ -{ - ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); - - dberr_t err; - if (buf_block_t *root= btr_root_block_get(index, RW_SX_LATCH, mtr, &err)) - { - err= flst_add_first(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, - block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr); - ut_d(if (err == DB_SUCCESS) - flst_validate(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr)); - } - return err; -} - /** Free an index page. @param[in,out] index index tree @param[in,out] block block to be freed @@ -623,9 +536,6 @@ dberr_t btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr, The page will be freed, so previous changes to it by this mini-transaction should not matter. */ - if (index->is_ibuf()) - return btr_page_free_for_ibuf(index, block, mtr); - fil_space_t *space= index->table->space; dberr_t err; @@ -708,8 +618,7 @@ btr_node_ptr_get_child( return btr_block_get( *index, btr_node_ptr_get_child_page_no(node_ptr, offsets), - RW_SX_LATCH, btr_page_get_level(page_align(node_ptr)) == 1, - mtr, err); + RW_SX_LATCH, mtr, err); } MY_ATTRIBUTE((nonnull(2,3,5), warn_unused_result)) @@ -930,77 +839,32 @@ btr_create( mtr_t* mtr, dberr_t* err) { - buf_block_t* block; - ut_ad(mtr->is_named_space(space)); ut_ad(index_id != BTR_FREED_INDEX_ID); ut_ad(index || space == fil_system.sys_space); - /* Create the two new segments (one, in the case of an ibuf tree) for - the index tree; the segment headers are put on the allocated root page - (for an ibuf tree, not in the root, but on a separate ibuf header - page) */ + /* Create the two new segments for the index tree; + the segment headers are put on the allocated root page */ - if (UNIV_UNLIKELY(type & DICT_IBUF)) { - /* Allocate first the ibuf header page */ - buf_block_t* ibuf_hdr_block = fseg_create( - space, IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr, err); + buf_block_t *block = fseg_create(space, PAGE_HEADER + PAGE_BTR_SEG_TOP, + mtr, err); - if (ibuf_hdr_block == NULL) { - return(FIL_NULL); - } - - ut_ad(ibuf_hdr_block->page.id().page_no() - == IBUF_HEADER_PAGE_NO); - /* Allocate then the next page to the segment: it will be the - tree root page */ - - block = fseg_alloc_free_page_general( - buf_block_get_frame(ibuf_hdr_block) - + IBUF_HEADER + IBUF_TREE_SEG_HEADER, - IBUF_TREE_ROOT_PAGE_NO, - FSP_UP, false, mtr, mtr, err); - - if (block == NULL) { - return(FIL_NULL); - } - - ut_ad(block->page.id() == page_id_t(0,IBUF_TREE_ROOT_PAGE_NO)); - - flst_init(block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr); - } else { - block = fseg_create(space, PAGE_HEADER + PAGE_BTR_SEG_TOP, - mtr, err); - - if (block == NULL) { - return(FIL_NULL); - } + if (!block) { + return FIL_NULL; + } - if (!fseg_create(space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, mtr, - err, false, block)) { - /* Not enough space for new segment, free root - segment before return. */ - btr_free_root(block, *space, mtr); - return(FIL_NULL); - } + if (!fseg_create(space, PAGE_HEADER + PAGE_BTR_SEG_LEAF, mtr, + err, false, block)) { + /* Not enough space for new segment, free root + segment before return. */ + btr_free_root(block, *space, mtr); + return FIL_NULL; } ut_ad(!page_has_siblings(block->page.frame)); btr_root_page_init(block, index_id, index, mtr); - /* We reset the free bits for the page in a separate - mini-transaction to allow creation of several trees in the - same mtr, otherwise the latch on a bitmap page would prevent - it because of the latching order. - - Note: Insert Buffering is disabled for temporary tables given that - most temporary tables are smaller in size and short-lived. */ - if (!(type & DICT_CLUSTERED) - && (!index || !index->table->is_temporary())) { - ibuf_reset_free_bits(block); - } - /* In the following assertion we test that two records of maximum allowed size fit on the root page: this fact is needed to ensure correctness of split algorithms */ @@ -1152,7 +1016,7 @@ void btr_drop_temporary_table(const dict_table_t &table) { if (buf_block_t *block= buf_page_get_low({SRV_TMP_SPACE_ID, index->page}, 0, RW_X_LATCH, nullptr, BUF_GET, &mtr, - nullptr, false)) + nullptr)) { btr_free_but_not_root(block, MTR_LOG_NO_REDO); mtr.set_log_mode(MTR_LOG_NO_REDO); @@ -1323,18 +1187,18 @@ static dberr_t btr_page_reorganize_low(page_cur_t *cursor, mtr_t *mtr) if (page_get_max_trx_id(block->page.frame)) /* PAGE_MAX_TRX_ID must be zero on non-leaf pages other than clustered index root pages. */ - ut_ad(dict_index_is_sec_or_ibuf(cursor->index) + ut_ad(!cursor->index->is_primary() ? page_is_leaf(block->page.frame) : block->page.id().page_no() == cursor->index->page); else /* PAGE_MAX_TRX_ID is unused in clustered index pages (other than the root where it is repurposed as PAGE_ROOT_AUTO_INC), non-leaf pages, and in temporary tables. It was always zero-initialized in - page_create(). PAGE_MAX_TRX_ID must be nonzero on - dict_index_is_sec_or_ibuf() leaf pages. */ + page_create(). PAGE_MAX_TRX_ID must be nonzero on secondary index + leaf pages. */ ut_ad(cursor->index->table->is_temporary() || !page_is_leaf(block->page.frame) || - !dict_index_is_sec_or_ibuf(cursor->index)); + cursor->index->is_primary()); #endif const uint16_t data_size1= page_get_data_size(old->page.frame); @@ -1534,15 +1398,7 @@ static dberr_t btr_page_reorganize_low(page_cur_t *cursor, mtr_t *mtr) return DB_SUCCESS; } -/*************************************************************//** -Reorganizes an index page. - -IMPORTANT: On success, the caller will have to update IBUF_BITMAP_FREE -if this is a compressed leaf page in a secondary index. This has to -be done either within the same mini-transaction, or by invoking -ibuf_reset_free_bits() before mtr_commit(). On uncompressed pages, -IBUF_BITMAP_FREE is unaffected by reorganization. - +/** Reorganize an index page. @return error code @retval DB_FAIL if reorganizing a ROW_FORMAT=COMPRESSED page failed */ dberr_t @@ -1561,15 +1417,7 @@ btr_page_reorganize_block( return btr_page_reorganize_low(&cur, mtr); } -/*************************************************************//** -Reorganizes an index page. - -IMPORTANT: On success, the caller will have to update IBUF_BITMAP_FREE -if this is a compressed leaf page in a secondary index. This has to -be done either within the same mini-transaction, or by invoking -ibuf_reset_free_bits() before mtr_commit(). On uncompressed pages, -IBUF_BITMAP_FREE is unaffected by reorganization. - +/** Reorganize an index page. @param cursor page cursor @param mtr mini-transaction @return error code @@ -1800,6 +1648,7 @@ btr_root_raise_and_insert( ut_ad(!page_is_empty(root->page.frame)); index = btr_cur_get_index(cursor); ut_ad(index->n_core_null_bytes <= UT_BITS_IN_BYTES(index->n_nullable)); + ut_ad(!index->is_spatial()); #ifdef UNIV_ZIP_DEBUG ut_a(!root_page_zip || page_zip_validate(root_page_zip, root->page.frame, index)); @@ -1815,12 +1664,11 @@ btr_root_raise_and_insert( return nullptr; } - if (index->is_ibuf()) { - } else if (!btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF, - *root, *index->table->space) - || !btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP, - *root, *index->table->space)) { - return nullptr; + if (!btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF, + *root, *index->table->space) + || !btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP, + *root, *index->table->space)) { + return nullptr; } /* Allocate a new page to the tree. Root splitting is done by first @@ -1891,18 +1739,12 @@ btr_root_raise_and_insert( page_get_infimum_rec(root->page.frame)); } - /* Move any existing predicate locks */ - if (dict_index_is_spatial(index)) { - lock_prdt_rec_move(new_block, root_id); - } else { - btr_search_move_or_delete_hash_entries( - new_block, root); - } + btr_search_move_or_delete_hash_entries(new_block, root); } constexpr uint16_t max_trx_id = PAGE_HEADER + PAGE_MAX_TRX_ID; - if (dict_index_is_sec_or_ibuf(index)) { - /* In secondary indexes and the change buffer, + if (!index->is_primary()) { + /* In secondary indexes, PAGE_MAX_TRX_ID can be reset on the root page, because the field only matters on leaf pages, and the root no longer is a leaf page. (Older versions of InnoDB did @@ -1952,16 +1794,8 @@ btr_root_raise_and_insert( /* Build the node pointer (= node key and page address) for the child */ - if (dict_index_is_spatial(index)) { - rtr_mbr_t new_mbr; - - rtr_page_cal_mbr(index, new_block, &new_mbr, *heap); - node_ptr = rtr_index_build_node_ptr( - index, &new_mbr, rec, new_page_no, *heap); - } else { - node_ptr = dict_index_build_node_ptr( - index, rec, new_page_no, *heap, level); - } + node_ptr = dict_index_build_node_ptr(index, rec, new_page_no, *heap, + level); /* The node pointer must be marked as the predefined minimum record, as there is no lower alphabetical limit to records in the leftmost node of a level: */ @@ -1994,13 +1828,6 @@ btr_root_raise_and_insert( to new_block at this point. Thus, the data should fit. */ ut_a(node_ptr_rec); - /* We play safe and reset the free bits for the new page */ - - if (!dict_index_is_clust(index) - && !index->table->is_temporary()) { - ibuf_reset_free_bits(new_block); - } - page_cursor->block = new_block; page_cursor->index = index; @@ -2479,11 +2306,11 @@ btr_attach_half_pages( /* for consistency, both blocks should be locked, before change */ if (prev_page_no != FIL_NULL && direction == FSP_DOWN) { prev_block = btr_block_get(*index, prev_page_no, RW_X_LATCH, - !level, mtr); + mtr); } if (next_page_no != FIL_NULL && direction != FSP_DOWN) { next_block = btr_block_get(*index, next_page_no, RW_X_LATCH, - !level, mtr); + mtr); } /* Build the node pointer (= node key and page address) for the upper @@ -2629,10 +2456,9 @@ btr_insert_into_right_sibling( page_t* next_page; btr_cur_t next_father_cursor; rec_t* rec = nullptr; - ulint max_size; next_block = btr_block_get(*cursor->index(), next_page_no, RW_X_LATCH, - page_is_leaf(page), mtr); + mtr); if (UNIV_UNLIKELY(!next_block)) { return nullptr; } @@ -2655,8 +2481,6 @@ btr_insert_into_right_sibling( return nullptr; } - max_size = page_get_max_insert_size_after_reorganize(next_page, 1); - /* Extends gap lock for the next page */ if (is_leaf && cursor->index()->has_locking()) { lock_update_node_pointer(block, next_block); @@ -2666,15 +2490,6 @@ btr_insert_into_right_sibling( n_ext, mtr); if (!rec) { - if (is_leaf - && next_block->page.zip.ssize - && !dict_index_is_clust(cursor->index()) - && !cursor->index()->table->is_temporary()) { - /* Reset the IBUF_BITMAP_FREE bits, because - page_cur_tuple_insert() will have attempted page - reorganize before failing. */ - ibuf_reset_free_bits(next_block); - } return nullptr; } @@ -2712,34 +2527,12 @@ btr_insert_into_right_sibling( } ut_ad(rec_offs_validate(rec, cursor->index(), *offsets)); - - if (is_leaf - && !dict_index_is_clust(cursor->index()) - && !cursor->index()->table->is_temporary()) { - /* Update the free bits of the B-tree page in the - insert buffer bitmap. */ - - if (next_block->page.zip.ssize) { - ibuf_update_free_bits_zip(next_block, mtr); - } else { - ibuf_update_free_bits_if_full( - next_block, max_size, - rec_offs_size(*offsets) + PAGE_DIR_SLOT_SIZE); - } - } - return(rec); } /*************************************************************//** Moves record list end to another page. Moved records include split_rec. - -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return error code */ static dberr_t @@ -2795,12 +2588,6 @@ page_move_rec_list_end( /*************************************************************//** Moves record list start to another page. Moved records do not include split_rec. - -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return error code */ static dberr_t @@ -2858,12 +2645,7 @@ btr_page_split_and_insert( ut_ad(*err == DB_SUCCESS); ut_ad(dtuple_check_typed(tuple)); - - if (cursor->index()->is_spatial()) { - /* Split rtree page and update parent */ - return rtr_page_split_and_insert(flags, cursor, offsets, heap, - tuple, n_ext, mtr, err); - } + ut_ad(!cursor->index()->is_spatial()); if (!*heap) { *heap = mem_heap_create(1024); @@ -3228,13 +3010,6 @@ btr_page_split_and_insert( /* The insert did not fit on the page: loop back to the start of the function for a new split */ insert_failed: - /* We play safe and reset the free bits for new_page */ - if (!dict_index_is_clust(page_cursor->index) - && !page_cursor->index->table->is_temporary()) { - ibuf_reset_free_bits(new_block); - ibuf_reset_free_bits(block); - } - n_iterations++; ut_ad(n_iterations < 2 || buf_block_get_page_zip(insert_block)); @@ -3244,17 +3019,6 @@ btr_page_split_and_insert( } func_exit: - /* Insert fit on the page: update the free bits for the - left and right pages in the same mtr */ - - if (!dict_index_is_clust(page_cursor->index) - && !page_cursor->index->table->is_temporary() - && page_is_leaf(page)) { - - ibuf_update_free_bits_for_two_pages_low( - left_block, right_block, mtr); - } - MONITOR_INC(MONITOR_INDEX_SPLIT); ut_ad(page_validate(buf_block_get_frame(left_block), @@ -3287,8 +3051,7 @@ dberr_t btr_level_list_remove(const buf_block_t& block, if (prev_page_no != FIL_NULL) { buf_block_t* prev_block = btr_block_get( - index, prev_page_no, RW_X_LATCH, page_is_leaf(page), - mtr, &err); + index, prev_page_no, RW_X_LATCH, mtr, &err); if (UNIV_UNLIKELY(!prev_block)) { return err; } @@ -3303,8 +3066,7 @@ dberr_t btr_level_list_remove(const buf_block_t& block, if (next_page_no != FIL_NULL) { buf_block_t* next_block = btr_block_get( - index, next_page_no, RW_X_LATCH, page_is_leaf(page), - mtr, &err); + index, next_page_no, RW_X_LATCH, mtr, &err); if (UNIV_UNLIKELY(!next_block)) { return err; @@ -3332,6 +3094,7 @@ btr_lift_page_up( must not be empty: use btr_discard_only_page_on_level if the last record from the page should be removed */ + que_thr_t* thr, /*!< in/out: query thread */ mtr_t* mtr, /*!< in/out: mini-transaction */ dberr_t* err) /*!< out: error code */ { @@ -3366,7 +3129,8 @@ btr_lift_page_up( if (index->is_spatial()) { offsets = rtr_page_get_father_block( - nullptr, heap, mtr, nullptr, &cursor); + nullptr, heap, nullptr, &cursor, + thr, mtr); } else { offsets = btr_page_get_father_block(offsets, heap, mtr, &cursor); @@ -3387,7 +3151,8 @@ btr_lift_page_up( if (index->is_spatial()) { offsets = rtr_page_get_father_block( - nullptr, heap, mtr, nullptr, &cursor); + nullptr, heap, nullptr, &cursor, thr, + mtr); } else { offsets = btr_page_get_father_block(offsets, heap, @@ -3518,13 +3283,8 @@ btr_lift_page_up( /* Free the file page */ btr_page_free(index, block, mtr); - /* We play it safe and reset the free bits for the father */ - if (!dict_index_is_clust(index) - && !index->table->is_temporary()) { - ibuf_reset_free_bits(father_block); - } ut_ad(page_validate(father_block->page.frame, index)); - ut_ad(btr_check_node_ptr(index, father_block, mtr)); + ut_ad(btr_check_node_ptr(index, father_block, thr, mtr)); return(lift_father_up ? block_orig : father_block); } @@ -3591,8 +3351,10 @@ btr_compress( father_cursor.page_cur.block = block; if (index->is_spatial()) { + ut_ad(cursor->rtr_info); offsets = rtr_page_get_father_block( - NULL, heap, mtr, cursor, &father_cursor); + nullptr, heap, cursor, &father_cursor, + cursor->rtr_info->thr, mtr); ut_ad(cursor->page_cur.block->page.id() == block->page.id()); rec_t* my_rec = father_cursor.page_cur.rec; @@ -3602,10 +3364,10 @@ btr_compress( ib::info() << "father positioned on page " << page_no << "instead of " << block->page.id().page_no(); - offsets = btr_page_get_father_block( - NULL, heap, mtr, &father_cursor); + goto get_offsets; } } else { +get_offsets: offsets = btr_page_get_father_block( NULL, heap, mtr, &father_cursor); } @@ -3615,14 +3377,7 @@ btr_compress( if (UNIV_UNLIKELY(!nth_rec || nth_rec == ULINT_UNDEFINED)) { corrupted: err = DB_CORRUPTION; - err_exit: - /* We play it safe and reset the free bits. */ - if (merge_block && merge_block->zip_size() - && page_is_leaf(merge_block->page.frame) - && !index->is_clust()) { - ibuf_reset_free_bits(merge_block); - } - goto func_exit; + goto err_exit; } } @@ -3630,7 +3385,10 @@ btr_compress( /* The page is the only one on the level, lift the records to the father */ - merge_block = btr_lift_page_up(index, block, mtr, &err); + merge_block = btr_lift_page_up(index, block, + cursor->rtr_info + ? cursor->rtr_info->thr + : nullptr, mtr, &err); success: if (adjust) { ut_ad(nth_rec > 0); @@ -3645,7 +3403,7 @@ btr_compress( } MONITOR_INC(MONITOR_INDEX_MERGE_SUCCESSFUL); -func_exit: +err_exit: mem_heap_free(heap); DBUG_RETURN(err); } @@ -3945,49 +3703,6 @@ btr_compress( } } - if (!dict_index_is_clust(index) - && !index->table->is_temporary() - && page_is_leaf(merge_page)) { - /* Update the free bits of the B-tree page in the - insert buffer bitmap. This has to be done in a - separate mini-transaction that is committed before the - main mini-transaction. We cannot update the insert - buffer bitmap in this mini-transaction, because - btr_compress() can be invoked recursively without - committing the mini-transaction in between. Since - insert buffer bitmap pages have a lower rank than - B-tree pages, we must not access other pages in the - same mini-transaction after accessing an insert buffer - bitmap page. */ - - /* The free bits in the insert buffer bitmap must - never exceed the free space on a page. It is safe to - decrement or reset the bits in the bitmap in a - mini-transaction that is committed before the - mini-transaction that affects the free space. */ - - /* It is unsafe to increment the bits in a separately - committed mini-transaction, because in crash recovery, - the free bits could momentarily be set too high. */ - - if (merge_block->zip_size()) { - /* Because the free bits may be incremented - and we cannot update the insert buffer bitmap - in the same mini-transaction, the only safe - thing we can do here is the pessimistic - approach: reset the free bits. */ - ibuf_reset_free_bits(merge_block); - } else { - /* On uncompressed pages, the free bits will - never increase here. Thus, it is safe to - write the bits accurately in a separate - mini-transaction. */ - ibuf_update_free_bits_if_full(merge_block, - srv_page_size, - ULINT_UNDEFINED); - } - } - ut_ad(page_validate(merge_page, index)); #ifdef UNIV_ZIP_DEBUG ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page, @@ -4002,7 +3717,10 @@ btr_compress( err = btr_page_free(index, block, mtr); if (err == DB_SUCCESS) { ut_ad(leftmost_child - || btr_check_node_ptr(index, merge_block, mtr)); + || btr_check_node_ptr(index, merge_block, + cursor->rtr_info + ? cursor->rtr_info->thr + : nullptr, mtr)); goto success; } else { goto err_exit; @@ -4019,11 +3737,13 @@ static void btr_discard_only_page_on_level( /*===========================*/ - dict_index_t* index, /*!< in: index tree */ - buf_block_t* block, /*!< in: page which is the only on its level */ + btr_cur_t* cur, /*!< in: cursor on a page which is the + only on its level */ mtr_t* mtr) /*!< in: mtr */ { - ulint page_level = 0; + dict_index_t* index = cur->index(); + buf_block_t* block = btr_cur_get_block(cur); + ulint page_level = 0; ut_ad(!index->is_dummy); @@ -4054,7 +3774,8 @@ btr_discard_only_page_on_level( if (index->is_spatial()) { /* Check any concurrent search having this page */ rtr_check_discard_page(index, NULL, block); - if (!rtr_page_get_father(mtr, nullptr, &cursor)) { + if (!rtr_page_get_father(mtr, nullptr, &cursor, + cur->rtr_info->thr)) { return; } } else { @@ -4120,9 +3841,6 @@ btr_discard_only_page_on_level( index->clear_instant_add(); } } else if (!index->table->is_temporary()) { - /* We play it safe and reset the free bits for the root */ - ibuf_reset_free_bits(block); - ut_a(max_trx_id); page_set_max_trx_id(block, buf_block_get_page_zip(block), @@ -4159,7 +3877,8 @@ btr_discard_page( MONITOR_INC(MONITOR_INDEX_DISCARD); if (index->is_spatial() - ? !rtr_page_get_father(mtr, cursor, &parent_cursor) + ? !rtr_page_get_father(mtr, cursor, &parent_cursor, + cursor->rtr_info->thr) : !btr_page_get_father(mtr, &parent_cursor)) { return DB_CORRUPTION; } @@ -4173,7 +3892,7 @@ btr_discard_page( if (left_page_no != FIL_NULL) { dberr_t err; merge_block = btr_block_get(*index, left_page_no, RW_X_LATCH, - true, mtr, &err); + mtr, &err); if (UNIV_UNLIKELY(!merge_block)) { return err; } @@ -4194,7 +3913,7 @@ btr_discard_page( } else if (right_page_no != FIL_NULL) { dberr_t err; merge_block = btr_block_get(*index, right_page_no, RW_X_LATCH, - true, mtr, &err); + mtr, &err); if (UNIV_UNLIKELY(!merge_block)) { return err; } @@ -4220,7 +3939,7 @@ btr_discard_page( return DB_CORRUPTION; } } else { - btr_discard_only_page_on_level(index, block, mtr); + btr_discard_only_page_on_level(cursor, mtr); return DB_SUCCESS; } @@ -4278,14 +3997,20 @@ btr_discard_page( If the merge_block's parent block is not same, we cannot use btr_check_node_ptr() */ ut_ad(parent_is_different - || btr_check_node_ptr(index, merge_block, mtr)); + || btr_check_node_ptr(index, merge_block, + cursor->rtr_info + ? cursor->rtr_info->thr + : nullptr, mtr)); if (btr_cur_get_block(&parent_cursor)->page.id().page_no() == index->page && !page_has_siblings(btr_cur_get_page(&parent_cursor)) && page_get_n_recs(btr_cur_get_page(&parent_cursor)) == 1) { - btr_lift_page_up(index, merge_block, mtr, &err); + btr_lift_page_up(index, merge_block, + cursor->rtr_info + ? cursor->rtr_info->thr + : nullptr, mtr, &err); } } @@ -4304,13 +4029,6 @@ btr_print_size( fseg_header_t* seg; mtr_t mtr; - if (dict_index_is_ibuf(index)) { - fputs("Sorry, cannot print info of an ibuf tree:" - " use ibuf functions\n", stderr); - - return; - } - mtr_start(&mtr); root = btr_root_get(index, &mtr); @@ -4320,13 +4038,10 @@ btr_print_size( fputs("INFO OF THE NON-LEAF PAGE SEGMENT\n", stderr); fseg_print(seg, &mtr); - if (!dict_index_is_ibuf(index)) { - - seg = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF; + seg = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF; - fputs("INFO OF THE LEAF PAGE SEGMENT\n", stderr); - fseg_print(seg, &mtr); - } + fputs("INFO OF THE LEAF PAGE SEGMENT\n", stderr); + fseg_print(seg, &mtr); mtr_commit(&mtr); } @@ -4437,6 +4152,7 @@ btr_check_node_ptr( /*===============*/ dict_index_t* index, /*!< in: index tree */ buf_block_t* block, /*!< in: index page */ + que_thr_t* thr, /*!< in/out: query thread */ mtr_t* mtr) /*!< in: mtr */ { mem_heap_t* heap; @@ -4458,8 +4174,8 @@ btr_check_node_ptr( heap = mem_heap_create(256); if (dict_index_is_spatial(index)) { - offsets = rtr_page_get_father_block(NULL, heap, mtr, - NULL, &cursor); + offsets = rtr_page_get_father_block(NULL, heap, + NULL, &cursor, thr, mtr); } else { offsets = btr_page_get_father_block(NULL, heap, mtr, &cursor); } @@ -4532,14 +4248,6 @@ btr_index_rec_validate( ut_ad(index->n_core_fields); - if (index->is_ibuf()) { - /* The insert buffer index tree can contain records from any - other index: we cannot check the number of fields or - their length */ - - return(TRUE); - } - #ifdef VIRTUAL_INDEX_DEBUG if (dict_index_has_virtual(index)) { fprintf(stderr, "index name is %s\n", index->name()); @@ -4882,8 +4590,7 @@ btr_validate_level( savepoint2 = mtr_set_savepoint(&mtr); block = btr_block_get(*index, left_page_no, - RW_SX_LATCH, false, - &mtr, &err); + RW_SX_LATCH, &mtr, &err); if (!block) { goto invalid_page; } @@ -4961,7 +4668,7 @@ btr_validate_level( savepoint = mtr_set_savepoint(&mtr); right_block = btr_block_get(*index, right_page_no, RW_SX_LATCH, - !level, &mtr, &err); + &mtr, &err); if (!right_block) { btr_validate_report1(index, level, block); fputs("InnoDB: broken FIL_PAGE_NEXT link\n", stderr); @@ -5158,15 +4865,13 @@ btr_validate_level( if (parent_right_page_no != FIL_NULL) { btr_block_get(*index, parent_right_page_no, - RW_SX_LATCH, false, - &mtr); + RW_SX_LATCH, &mtr); } right_block = btr_block_get(*index, right_page_no, RW_SX_LATCH, - !level, &mtr, - &err); + &mtr, &err); if (!right_block) { btr_validate_report1(index, level, block); @@ -5252,17 +4957,16 @@ btr_validate_level( if (parent_right_page_no != FIL_NULL) { btr_block_get(*index, parent_right_page_no, - RW_SX_LATCH, false, - &mtr); + RW_SX_LATCH, &mtr); } } else if (parent_page_no != FIL_NULL) { btr_block_get(*index, parent_page_no, - RW_SX_LATCH, false, &mtr); + RW_SX_LATCH, &mtr); } } block = btr_block_get(*index, right_page_no, RW_SX_LATCH, - !level, &mtr, &err); + &mtr, &err); goto loop; } @@ -5334,8 +5038,7 @@ btr_can_merge_with_page( index = btr_cur_get_index(cursor); page = btr_cur_get_page(cursor); - mblock = btr_block_get(*index, page_no, RW_X_LATCH, page_is_leaf(page), - mtr); + mblock = btr_block_get(*index, page_no, RW_X_LATCH, mtr); if (!mblock) { goto error; } diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index 013cd13102cd8..3c5b4b293f20c 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -28,7 +28,6 @@ Created 03/11/2014 Shaohua Wang #include "btr0btr.h" #include "btr0cur.h" #include "btr0pcur.h" -#include "ibuf0ibuf.h" #include "page0page.h" #include "trx0trx.h" @@ -107,7 +106,7 @@ PageBulk::init() } } else { new_block = btr_block_get(*m_index, m_page_no, RW_X_LATCH, - false, &m_mtr); + &m_mtr); if (!new_block) { m_mtr.commit(); return(DB_CORRUPTION); @@ -122,7 +121,7 @@ PageBulk::init() m_page_zip = buf_block_get_page_zip(new_block); - if (!m_level && dict_index_is_sec_or_ibuf(m_index)) { + if (!m_level && !m_index->is_primary()) { page_update_max_trx_id(new_block, m_page_zip, m_trx_id, &m_mtr); } @@ -563,9 +562,6 @@ inline void PageBulk::finish() void PageBulk::commit(bool success) { finish(); - if (success && !m_index->is_clust() && page_is_leaf(m_page)) - ibuf_set_bitmap_for_bulk_load(m_block, &m_mtr, - innobase_fill_factor == 100); m_mtr.commit(); } @@ -1194,7 +1190,7 @@ BtrBulk::finish(dberr_t err) ut_ad(last_page_no != FIL_NULL); last_block = btr_block_get(*m_index, last_page_no, RW_X_LATCH, - false, &mtr); + &mtr); if (!last_block) { err = DB_CORRUPTION; err_exit: diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 2f237bb595725..9a25892ab529a 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3,7 +3,7 @@ Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -61,7 +61,6 @@ Created 10/16/1994 Heikki Tuuri #include "que0que.h" #include "row0row.h" #include "srv0srv.h" -#include "ibuf0ibuf.h" #include "lock0lock.h" #include "zlib.h" #include "srv0start.h" @@ -73,15 +72,6 @@ Created 10/16/1994 Heikki Tuuri #endif /* WITH_WSREP */ #include "log.h" -/** Buffered B-tree operation types, introduced as part of delete buffering. */ -enum btr_op_t { - BTR_NO_OP = 0, /*!< Not buffered */ - BTR_INSERT_OP, /*!< Insert, do not ignore UNIQUE */ - BTR_INSERT_IGNORE_UNIQUE_OP, /*!< Insert, ignoring UNIQUE */ - BTR_DELETE_OP, /*!< Purge a delete-marked record */ - BTR_DELMARK_OP /*!< Mark a record for deletion */ -}; - /** Modification types for the B-tree operation. Note that the order must be DELETE, BOTH, INSERT !! */ @@ -259,7 +249,7 @@ btr_cur_latch_leaves( if (left_page_no != FIL_NULL) { buf_block_t *b = btr_block_get( *cursor->index(), left_page_no, RW_X_LATCH, - true, mtr); + mtr); if (latch_leaves) { latch_leaves->savepoints[0] = save; @@ -300,7 +290,7 @@ btr_cur_latch_leaves( buf_block_t* b = btr_block_get( *cursor->index(), right_page_no, RW_X_LATCH, - true, mtr); + mtr); if (latch_leaves) { latch_leaves->savepoints[2] = save; latch_leaves->blocks[2] = b; @@ -331,8 +321,7 @@ btr_cur_latch_leaves( if (left_page_no != FIL_NULL) { save = mtr->get_savepoint(); cursor->left_block = btr_block_get( - *cursor->index(), left_page_no, - mode, true, mtr); + *cursor->index(), left_page_no, mode, mtr); if (latch_leaves) { latch_leaves->savepoints[0] = save; latch_leaves->blocks[0] = cursor->left_block; @@ -341,7 +330,8 @@ btr_cur_latch_leaves( goto latch_block; case BTR_CONT_MODIFY_TREE: - ut_ad(cursor->index()->is_spatial()); + ut_ad(cursor->index()->is_dummy + || cursor->index()->is_spatial()); return; } @@ -358,10 +348,14 @@ when loading a table definition. static dberr_t btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr) { ut_ad(index->is_primary()); - ut_ad(index->n_core_null_bytes == dict_index_t::NO_CORE_NULL_BYTES); - ut_ad(index->table->supports_instant()); ut_ad(index->table->is_readable()); + if (!index->table->supports_instant()) { + return DB_SUCCESS; + } + + ut_ad(index->n_core_null_bytes == dict_index_t::NO_CORE_NULL_BYTES); + dberr_t err; const fil_space_t* space = index->table->space; if (!space) { @@ -628,17 +622,25 @@ when loading a table definition. @param[in,out] table table definition from the data dictionary @return error code @retval DB_SUCCESS if no error occurred */ -dberr_t -btr_cur_instant_init(dict_table_t* table) +dberr_t btr_cur_instant_init(dict_table_t *table) { - mtr_t mtr; - dict_index_t* index = dict_table_get_first_index(table); - mtr.start(); - dberr_t err = index - ? btr_cur_instant_init_low(index, &mtr) - : DB_CORRUPTION; - mtr.commit(); - return(err); + mtr_t mtr; + dict_index_t *index= dict_table_get_first_index(table); + mtr.start(); + dberr_t err = index ? btr_cur_instant_init_low(index, &mtr) : DB_CORRUPTION; + mtr.commit(); + if (err == DB_SUCCESS && index->is_gen_clust()) + { + btr_cur_t cur; + mtr.start(); + err= cur.open_leaf(false, index, BTR_SEARCH_LEAF, &mtr); + if (err != DB_SUCCESS); + else if (const rec_t *rec= page_rec_get_prev(btr_cur_get_rec(&cur))) + if (page_rec_is_user_rec(rec)) + table->row_id= mach_read_from_6(rec); + mtr.commit(); + } + return(err); } /** Initialize the n_core_null_bytes on first access to a clustered @@ -758,7 +760,7 @@ btr_cur_optimistic_latch_leaves( return(buf_page_optimistic_get(*latch_mode, block, modify_clock, mtr)); case BTR_SEARCH_PREV: /* btr_pcur_move_backward_from_page() */ - case BTR_MODIFY_PREV: /* Ditto, or ibuf_insert() */ + case BTR_MODIFY_PREV: /* Ditto */ uint32_t curr_page_no, left_page_no; { transactional_shared_lock_guard g{ @@ -1063,20 +1065,6 @@ btr_cur_need_opposite_intention( @return maximum size of a node pointer record in bytes */ static ulint btr_node_ptr_max_size(const dict_index_t* index) { - if (dict_index_is_ibuf(index)) { - /* cannot estimate accurately */ - /* This is universal index for change buffer. - The max size of the entry is about max key length * 2. - (index key + primary key to be inserted to the index) - (The max key length is UNIV_PAGE_SIZE / 16 * 3 at - ha_innobase::max_supported_key_length(), - considering MAX_KEY_LENGTH = 3072 at MySQL imposes - the 3500 historical InnoDB value for 16K page size case.) - For the universal index, node_ptr contains most of the entry. - And 512 is enough to contain ibuf columns and meta-data */ - return srv_page_size / 8 * 3 + 512; - } - /* Each record has page_no, length of page_no and header. */ ulint comp = dict_table_is_comp(index->table); ulint rec_max_size = comp @@ -1245,10 +1233,8 @@ dberr_t btr_cur_search_to_nth_level(ulint level, ulint rw_latch; page_cur_mode_t page_mode; page_cur_mode_t search_mode = PAGE_CUR_UNSUPP; - ulint buf_mode; ulint node_ptr_max_size = srv_page_size / 2; page_cur_t* page_cursor; - btr_op_t btr_op; ulint root_height = 0; /* remove warning */ btr_intention_t lock_intention; @@ -1287,7 +1273,6 @@ dberr_t btr_cur_search_to_nth_level(ulint level, ut_ad(level == 0 || mode == PAGE_CUR_LE || RTREE_SEARCH_MODE(mode)); ut_ad(dict_index_check_search_tuple(index, tuple)); - ut_ad(!dict_index_is_ibuf(index) || ibuf_inside(mtr)); ut_ad(dtuple_check_typed(tuple)); ut_ad(!(index->type & DICT_FTS)); ut_ad(index->page != FIL_NULL); @@ -1308,36 +1293,6 @@ dberr_t btr_cur_search_to_nth_level(ulint level, || mtr->memo_contains_flagged(&index->lock, MTR_MEMO_S_LOCK | MTR_MEMO_SX_LOCK)); - /* These flags are mutually exclusive, they are lumped together - with the latch mode for historical reasons. It's possible for - none of the flags to be set. */ - switch (UNIV_EXPECT(latch_mode & BTR_DELETE, 0)) { - default: - btr_op = BTR_NO_OP; - break; - case BTR_INSERT: - btr_op = (latch_mode & BTR_IGNORE_SEC_UNIQUE) - ? BTR_INSERT_IGNORE_UNIQUE_OP - : BTR_INSERT_OP; - break; - case BTR_DELETE: - btr_op = BTR_DELETE_OP; - ut_a(cursor->purge_node); - break; - case BTR_DELETE_MARK: - btr_op = BTR_DELMARK_OP; - break; - } - - /* Operations on the insert buffer tree cannot be buffered. */ - ut_ad(btr_op == BTR_NO_OP || !dict_index_is_ibuf(index)); - /* Operations on the clustered index cannot be buffered. */ - ut_ad(btr_op == BTR_NO_OP || !dict_index_is_clust(index)); - /* Operations on the temporary table(indexes) cannot be buffered. */ - ut_ad(btr_op == BTR_NO_OP || !index->table->is_temporary()); - /* Operation on the spatial index cannot be buffered. */ - ut_ad(btr_op == BTR_NO_OP || !dict_index_is_spatial(index)); - lock_intention = btr_cur_get_and_clear_intention(&latch_mode); /* Turn the flags unrelated to the latch mode off. */ @@ -1512,7 +1467,6 @@ dberr_t btr_cur_search_to_nth_level(ulint level, btr_latch_leaves_t latch_leaves = {{NULL, NULL, NULL}, {0, 0, 0}}; search_loop: - buf_mode = BUF_GET; rw_latch = RW_NO_LATCH; rtree_parent_modified = false; @@ -1534,108 +1488,16 @@ dberr_t btr_cur_search_to_nth_level(ulint level, } } else if (latch_mode <= BTR_MODIFY_LEAF) { rw_latch = latch_mode; - - if (btr_op != BTR_NO_OP - && ibuf_should_try(index, btr_op != BTR_INSERT_OP)) { - - /* Try to buffer the operation if the leaf - page is not in the buffer pool. */ - - buf_mode = btr_op == BTR_DELETE_OP - ? BUF_GET_IF_IN_POOL_OR_WATCH - : BUF_GET_IF_IN_POOL; - } } -retry_page_get: ut_ad(n_blocks < BTR_MAX_LEVELS); tree_savepoints[n_blocks] = mtr_set_savepoint(mtr); dberr_t err; block = buf_page_get_gen(page_id, zip_size, rw_latch, guess, - buf_mode, mtr, &err, - height == 0 && !index->is_clust()); - if (!block) { - switch (err) { - case DB_SUCCESS: - /* change buffering */ - break; - case DB_DECRYPTION_FAILED: - btr_decryption_failed(*index); - /* fall through */ - default: - goto func_exit; - } - - /* This must be a search to perform an insert/delete - mark/ delete; try using the insert/delete buffer */ + BUF_GET, mtr, &err); - ut_ad(height == 0); - ut_ad(cursor->thr); - - switch (btr_op) { - default: - MY_ASSERT_UNREACHABLE(); - break; - case BTR_INSERT_OP: - case BTR_INSERT_IGNORE_UNIQUE_OP: - ut_ad(buf_mode == BUF_GET_IF_IN_POOL); - - if (ibuf_insert(IBUF_OP_INSERT, tuple, index, - page_id, zip_size, cursor->thr)) { - - cursor->flag = BTR_CUR_INSERT_TO_IBUF; - - goto func_exit; - } - break; - - case BTR_DELMARK_OP: - ut_ad(buf_mode == BUF_GET_IF_IN_POOL); - - if (ibuf_insert(IBUF_OP_DELETE_MARK, tuple, - index, page_id, zip_size, - cursor->thr)) { - - cursor->flag = BTR_CUR_DEL_MARK_IBUF; - - goto func_exit; - } - - break; - - case BTR_DELETE_OP: - ut_ad(buf_mode == BUF_GET_IF_IN_POOL_OR_WATCH); - ut_ad(index->is_btree()); - auto& chain = buf_pool.page_hash.cell_get( - page_id.fold()); - - if (!row_purge_poss_sec(cursor->purge_node, - index, tuple)) { - - /* The record cannot be purged yet. */ - cursor->flag = BTR_CUR_DELETE_REF; - } else if (ibuf_insert(IBUF_OP_DELETE, tuple, - index, page_id, zip_size, - cursor->thr)) { - - /* The purge was buffered. */ - cursor->flag = BTR_CUR_DELETE_IBUF; - } else { - /* The purge could not be buffered. */ - buf_pool.watch_unset(page_id, chain); - break; - } - - buf_pool.watch_unset(page_id, chain); - goto func_exit; - } - - /* Insert to the insert/delete buffer did not succeed, we - must read the page from disk. */ - - buf_mode = BUF_GET; - - goto retry_page_get; + if (!block) { + goto func_exit; } tree_blocks[n_blocks] = block; @@ -1658,7 +1520,7 @@ dberr_t btr_cur_search_to_nth_level(ulint level, = mtr_set_savepoint(mtr); buf_block_t* get_block = buf_page_get_gen( page_id_t(page_id.space(), left_page_no), - zip_size, rw_latch, NULL, buf_mode, + zip_size, rw_latch, NULL, BUF_GET, mtr, &err); if (!get_block) { if (err == DB_DECRYPTION_FAILED) { @@ -1729,7 +1591,6 @@ dberr_t btr_cur_search_to_nth_level(ulint level, } /* Save the MBR */ - cursor->rtr_info->thr = cursor->thr; rtr_get_mbr_from_tuple(tuple, &cursor->rtr_info->mbr); } @@ -1902,15 +1763,16 @@ dberr_t btr_cur_search_to_nth_level(ulint level, /* Add Predicate lock if it is serializable isolation and only if it is in the search case */ - if (dict_index_is_spatial(index) + if (index->is_spatial() && cursor->rtr_info->need_prdt_lock + && mode >= PAGE_CUR_CONTAIN && mode != PAGE_CUR_RTREE_INSERT - && mode != PAGE_CUR_RTREE_LOCATE - && mode >= PAGE_CUR_CONTAIN) { + && mode != PAGE_CUR_RTREE_LOCATE) { lock_prdt_t prdt; + que_thr_t* thr = cursor->rtr_info->thr; { - trx_t* trx = thr_get_trx(cursor->thr); + trx_t* trx = thr_get_trx(thr); TMLockTrxGuard g{TMLockTrxArgs(*trx)}; lock_init_prdt_from_mbr( &prdt, &cursor->rtr_info->mbr, mode, @@ -1922,7 +1784,7 @@ dberr_t btr_cur_search_to_nth_level(ulint level, } lock_prdt_lock(block, &prdt, index, LOCK_S, - LOCK_PREDICATE, cursor->thr); + LOCK_PREDICATE, thr); if (rw_latch == RW_NO_LATCH && height != 0) { block->page.lock.s_unlock(); @@ -2230,17 +2092,6 @@ dberr_t btr_cur_search_to_nth_level(ulint level, n_blocks++; - if (UNIV_UNLIKELY(height == 0 && dict_index_is_ibuf(index))) { - /* We're doing a search on an ibuf tree and we're one - level above the leaf page. */ - - ut_ad(level == 0); - - buf_mode = BUF_GET; - rw_latch = RW_NO_LATCH; - goto retry_page_get; - } - if (dict_index_is_spatial(index) && page_mode >= PAGE_CUR_CONTAIN && page_mode != PAGE_CUR_RTREE_INSERT) { @@ -2311,7 +2162,7 @@ dberr_t btr_cur_search_to_nth_level(ulint level, btr_block_get( *index, page_id.page_no(), latch_mode == BTR_CONT_MODIFY_TREE - ? RW_X_LATCH : RW_SX_LATCH, false, mtr, &err); + ? RW_X_LATCH : RW_SX_LATCH, mtr, &err); } else { ut_ad(mtr->memo_contains_flagged(block, upper_rw_latch)); @@ -2440,10 +2291,12 @@ dberr_t btr_cur_t::open_leaf(bool first, dict_index_t *index, rw_lock_type_t upper_rw_latch= RW_X_LATCH; switch (latch_mode) { - case BTR_CONT_MODIFY_TREE: case BTR_CONT_SEARCH_TREE: - abort(); - break; + ut_ad("invalid mode" == 0); + /* fall through */ + case BTR_CONT_MODIFY_TREE: + ut_ad(index->is_dummy); + /* fall through */ case BTR_MODIFY_TREE: /* Most of delete-intended operations are purging. Free blocks and read IO bandwidth should be prioritized for them, when the @@ -2489,9 +2342,7 @@ dberr_t btr_cur_t::open_leaf(bool first, dict_index_t *index, const rw_lock_type_t rw_latch= height && latch_mode != BTR_MODIFY_TREE ? upper_rw_latch : RW_NO_LATCH; - buf_block_t* block= - btr_block_get(*index, page, rw_latch, !height && !index->is_clust(), mtr, - &err); + buf_block_t* block= btr_block_get(*index, page, rw_latch, mtr, &err); ut_ad(!block == (err != DB_SUCCESS)); @@ -2514,7 +2365,9 @@ dberr_t btr_cur_t::open_leaf(bool first, dict_index_t *index, /* We are in the root node */ height= l; if (height); - else if (upper_rw_latch != root_leaf_rw_latch) + else if (upper_rw_latch != root_leaf_rw_latch && + /* ibuf_upgrade() needs the following condition */ + UNIV_LIKELY(root_leaf_rw_latch != RW_NO_LATCH)) { /* We should retry to get the page, because the root page is latched with different level as a leaf page. */ @@ -2635,11 +2488,6 @@ be freed by reorganizing. Differs from btr_cur_optimistic_insert because no heuristics is applied to whether it pays to use CPU time for reorganizing the page or not. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if this is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return pointer to inserted record if succeed, else NULL */ static MY_ATTRIBUTE((nonnull, warn_unused_result)) rec_t* @@ -2808,9 +2656,6 @@ static void btr_cur_prefetch_siblings(const buf_block_t *block, { ut_ad(page_is_leaf(block->page.frame)); - if (index->is_ibuf()) - return; - const page_t *page= block->page.frame; uint32_t prev= mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_PREV)); uint32_t next= mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_NEXT)); @@ -3046,14 +2891,6 @@ btr_cur_optimistic_insert( if (*rec) { } else if (block->page.zip.data) { ut_ad(!index->table->is_temporary()); - /* Reset the IBUF_BITMAP_FREE bits, because - page_cur_tuple_insert() will have attempted page - reorganize before failing. */ - if (leaf - && !dict_index_is_clust(index)) { - ibuf_reset_free_bits(block); - } - goto fail; } else { ut_ad(!reorg); @@ -3094,34 +2931,6 @@ btr_cur_optimistic_insert( lock_update_insert(block, *rec); } - if (leaf - && !dict_index_is_clust(index) - && !index->table->is_temporary()) { - /* Update the free bits of the B-tree page in the - insert buffer bitmap. */ - - /* The free bits in the insert buffer bitmap must - never exceed the free space on a page. It is safe to - decrement or reset the bits in the bitmap in a - mini-transaction that is committed before the - mini-transaction that affects the free space. */ - - /* It is unsafe to increment the bits in a separately - committed mini-transaction, because in crash recovery, - the free bits could momentarily be set too high. */ - - if (block->page.zip.data) { - /* Update the bits in the same mini-transaction. */ - ibuf_update_free_bits_zip(block, mtr); - } else { - /* Decrement the bits in a separate - mini-transaction. */ - ibuf_update_free_bits_if_full( - block, max_size, - rec_size + PAGE_DIR_SLOT_SIZE); - } - } - *big_rec = big_rec_vec; return(DB_SUCCESS); @@ -3192,12 +3001,10 @@ btr_cur_pessimistic_insert( the index tree, so that the insert will not fail because of lack of space */ - if (!index->is_ibuf() - && (err = fsp_reserve_free_extents(&n_reserved, index->table->space, - uint32_t(cursor->tree_height / 16 - + 3), - FSP_NORMAL, mtr)) - != DB_SUCCESS) { + err = fsp_reserve_free_extents(&n_reserved, index->table->space, + uint32_t(cursor->tree_height / 16 + 3), + FSP_NORMAL, mtr); + if (err != DB_SUCCESS) { return err; } @@ -3229,11 +3036,21 @@ btr_cur_pessimistic_insert( } } - *rec = index->page == btr_cur_get_block(cursor)->page.id().page_no() - ? btr_root_raise_and_insert(flags, cursor, offsets, heap, - entry, n_ext, mtr, &err) - : btr_page_split_and_insert(flags, cursor, offsets, heap, - entry, n_ext, mtr, &err); + if (index->page == btr_cur_get_block(cursor)->page.id().page_no()) { + *rec = index->is_spatial() + ? rtr_root_raise_and_insert(flags, cursor, offsets, + heap, entry, n_ext, mtr, + &err, thr) + : btr_root_raise_and_insert(flags, cursor, offsets, + heap, entry, n_ext, mtr, + &err); + } else if (index->is_spatial()) { + *rec = rtr_page_split_and_insert(flags, cursor, offsets, heap, + entry, n_ext, mtr, &err, thr); + } else { + *rec = btr_page_split_and_insert(flags, cursor, offsets, heap, + entry, n_ext, mtr, &err); + } if (!*rec) { goto func_exit; @@ -3477,14 +3294,8 @@ static dberr_t btr_cur_upd_rec_sys(buf_block_t *block, rec_t *rec, See if there is enough place in the page modification log to log an update-in-place. -@retval false if out of space; IBUF_BITMAP_FREE will be reset -outside mtr if the page was recompressed -@retval true if enough place; - -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if this is -a secondary index leaf page. This has to be done either within the -same mini-transaction, or by invoking ibuf_reset_free_bits() before -mtr_commit(mtr). */ +@retval false if out of space +@retval true if enough place */ bool btr_cur_update_alloc_zip_func( /*==========================*/ @@ -3505,7 +3316,6 @@ btr_cur_update_alloc_zip_func( const page_t* page = page_cur_get_page(cursor); ut_ad(page_zip == page_cur_get_page_zip(cursor)); - ut_ad(!dict_index_is_ibuf(index)); ut_ad(rec_offs_validate(page_cur_get_rec(cursor), index, offsets)); if (page_zip_available(page_zip, dict_index_is_clust(index), @@ -3529,26 +3339,8 @@ btr_cur_update_alloc_zip_func( rec_offs_make_valid(page_cur_get_rec(cursor), index, page_is_leaf(page), offsets); - /* After recompressing a page, we must make sure that the free - bits in the insert buffer bitmap will not exceed the free - space on the page. Because this function will not attempt - recompression unless page_zip_available() fails above, it is - safe to reset the free bits if page_zip_available() fails - again, below. The free bits can safely be reset in a separate - mini-transaction. If page_zip_available() succeeds below, we - can be sure that the btr_page_reorganize() above did not reduce - the free space available on the page. */ - - if (page_zip_available(page_zip, dict_index_is_clust(index), - length, create)) { - return true; - } - } - - if (!dict_index_is_clust(index) - && !index->table->is_temporary() - && page_is_leaf(page)) { - ibuf_reset_free_bits(page_cur_get_block(cursor)); + return page_zip_available(page_zip, dict_index_is_clust(index), + length, create); } return(false); @@ -3697,7 +3489,7 @@ We assume here that the ordering fields of the record do not change. @return locking or undo log related error code, or @retval DB_SUCCESS on success @retval DB_ZIP_OVERFLOW if there is not enough space left -on the compressed page (IBUF_BITMAP_FREE was reset outside mtr) */ +on a ROW_FORMAT=COMPRESSED page */ dberr_t btr_cur_update_in_place( /*====================*/ @@ -3717,7 +3509,6 @@ btr_cur_update_in_place( further pages */ { dict_index_t* index; - dberr_t err; rec_t* rec; roll_ptr_t roll_ptr = 0; ulint was_delete_marked; @@ -3725,17 +3516,14 @@ btr_cur_update_in_place( ut_ad(page_is_leaf(cursor->page_cur.block->page.frame)); rec = btr_cur_get_rec(cursor); index = cursor->index(); - ut_ad(!index->is_ibuf()); ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); ut_ad(trx_id > 0 || (flags & BTR_KEEP_SYS_FLAG) || index->table->is_temporary()); - /* The insert buffer tree should never be updated in place. */ - ut_ad(!dict_index_is_ibuf(index)); ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG) - || dict_index_is_clust(index)); + || index->is_primary()); ut_ad(thr_get_trx(thr)->id == trx_id - || (flags & ulint(~(BTR_KEEP_POS_FLAG | BTR_KEEP_IBUF_BITMAP))) + || (flags & ulint(~BTR_KEEP_POS_FLAG)) == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG)); ut_ad(fil_page_index_page_check(btr_cur_get_page(cursor))); @@ -3765,22 +3553,17 @@ btr_cur_update_in_place( } /* Do lock checking and undo logging */ - err = btr_cur_upd_lock_and_undo(flags, cursor, offsets, - update, cmpl_info, - thr, mtr, &roll_ptr); - if (UNIV_UNLIKELY(err != DB_SUCCESS)) { - /* We may need to update the IBUF_BITMAP_FREE - bits after a reorganize that was done in - btr_cur_update_alloc_zip(). */ - goto func_exit; + if (dberr_t err = btr_cur_upd_lock_and_undo(flags, cursor, offsets, + update, cmpl_info, + thr, mtr, &roll_ptr)) { + return err; } - if (!(flags & BTR_KEEP_SYS_FLAG)) { - err = btr_cur_upd_rec_sys(block, rec, index, offsets, - thr_get_trx(thr), roll_ptr, mtr); - if (UNIV_UNLIKELY(err != DB_SUCCESS)) { - goto func_exit; - } + if (flags & BTR_KEEP_SYS_FLAG) { + } else if (dberr_t err = btr_cur_upd_rec_sys(block, rec, index, offsets, + thr_get_trx(thr), + roll_ptr, mtr)) { + return err; } was_delete_marked = rec_get_deleted_flag( @@ -3838,19 +3621,7 @@ btr_cur_update_in_place( btr_cur_unmark_extern_fields(block, rec, index, offsets, mtr); } - ut_ad(err == DB_SUCCESS); - -func_exit: - if (page_zip - && !(flags & BTR_KEEP_IBUF_BITMAP) - && !dict_index_is_clust(index) - && page_is_leaf(buf_block_get_frame(block))) { - /* Update the free bits in the insert buffer. */ - ut_ad(!index->table->is_temporary()); - ibuf_update_free_bits_zip(block, mtr); - } - - return(err); + return DB_SUCCESS; } /** Trim a metadata record during the rollback of instant ALTER TABLE. @@ -3994,7 +3765,7 @@ fields of the record do not change. @retval DB_OVERFLOW if the updated record does not fit @retval DB_UNDERFLOW if the page would become too empty @retval DB_ZIP_OVERFLOW if there is not enough space left -on the compressed page (IBUF_BITMAP_FREE was reset outside mtr) */ +on a ROW_FORMAT=COMPRESSED page */ dberr_t btr_cur_optimistic_update( /*======================*/ @@ -4025,7 +3796,6 @@ btr_cur_optimistic_update( ulint max_size; ulint new_rec_size; ulint old_rec_size; - ulint max_ins_size = 0; dtuple_t* new_entry; roll_ptr_t roll_ptr; ulint i; @@ -4034,19 +3804,16 @@ btr_cur_optimistic_update( page = buf_block_get_frame(block); rec = btr_cur_get_rec(cursor); index = cursor->index(); - ut_ad(index->has_locking()); ut_ad(trx_id > 0 || (flags & BTR_KEEP_SYS_FLAG) || index->table->is_temporary()); ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); /* This is intended only for leaf page updates */ ut_ad(page_is_leaf(page)); - /* The insert buffer tree should never be updated in place. */ - ut_ad(!dict_index_is_ibuf(index)); ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG) || dict_index_is_clust(index)); ut_ad(thr_get_trx(thr)->id == trx_id - || (flags & ulint(~(BTR_KEEP_POS_FLAG | BTR_KEEP_IBUF_BITMAP))) + || (flags & ulint(~BTR_KEEP_POS_FLAG)) == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG)); ut_ad(fil_page_index_page_check(page)); @@ -4075,7 +3842,6 @@ btr_cur_optimistic_update( if (rec_offs_any_extern(*offsets)) { any_extern: - ut_ad(!index->is_ibuf()); /* Externally stored fields are treated in pessimistic update */ @@ -4156,9 +3922,6 @@ btr_cur_optimistic_update( if (UNIV_UNLIKELY(new_rec_size >= (page_get_free_space_of_empty(page_is_comp(page)) / 2))) { - /* We may need to update the IBUF_BITMAP_FREE - bits after a reorganize that was done in - btr_cur_update_alloc_zip(). */ err = DB_OVERFLOW; goto func_exit; } @@ -4166,10 +3929,6 @@ btr_cur_optimistic_update( if (UNIV_UNLIKELY(page_get_data_size(page) - old_rec_size + new_rec_size < BTR_CUR_PAGE_COMPRESS_LIMIT(index))) { - /* We may need to update the IBUF_BITMAP_FREE - bits after a reorganize that was done in - btr_cur_update_alloc_zip(). */ - /* The page would become too empty */ err = DB_UNDERFLOW; goto func_exit; @@ -4182,19 +3941,9 @@ btr_cur_optimistic_update( : (old_rec_size + page_get_max_insert_size_after_reorganize(page, 1)); - if (!page_zip) { - max_ins_size = page_get_max_insert_size_after_reorganize( - page, 1); - } - if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT) && (max_size >= new_rec_size)) || (page_get_n_recs(page) <= 1))) { - - /* We may need to update the IBUF_BITMAP_FREE - bits after a reorganize that was done in - btr_cur_update_alloc_zip(). */ - /* There was not enough space, or it did not pay to reorganize: for simplicity, we decide what to do assuming a reorganization is needed, though it might not be necessary */ @@ -4208,9 +3957,6 @@ btr_cur_optimistic_update( update, cmpl_info, thr, mtr, &roll_ptr); if (err != DB_SUCCESS) { - /* We may need to update the IBUF_BITMAP_FREE - bits after a reorganize that was done in - btr_cur_update_alloc_zip(). */ goto func_exit; } @@ -4266,22 +4012,11 @@ btr_cur_optimistic_update( ut_ad(err == DB_SUCCESS); if (!page_cur_move_to_next(page_cursor)) { corrupted: - err = DB_CORRUPTION; - } - -func_exit: - if (!(flags & BTR_KEEP_IBUF_BITMAP) - && !dict_index_is_clust(index)) { - /* Update the free bits in the insert buffer. */ - if (page_zip) { - ut_ad(!index->table->is_temporary()); - ibuf_update_free_bits_zip(block, mtr); - } else if (!index->table->is_temporary()) { - ibuf_update_free_bits_low(block, max_ins_size, mtr); - } + return DB_CORRUPTION; } if (err != DB_SUCCESS) { +func_exit: /* prefetch siblings of the leaf for the pessimistic operation. */ btr_cur_prefetch_siblings(block, index); @@ -4378,7 +4113,6 @@ btr_cur_pessimistic_update( big_rec_t* dummy_big_rec; dict_index_t* index; buf_block_t* block; - page_zip_des_t* page_zip; rec_t* rec; page_cur_t* page_cursor; dberr_t err; @@ -4391,20 +4125,19 @@ btr_cur_pessimistic_update( *big_rec = NULL; block = btr_cur_get_block(cursor); - page_zip = buf_block_get_page_zip(block); index = cursor->index(); - ut_ad(index->has_locking()); ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK)); ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); +#if defined UNIV_ZIP_DEBUG || defined UNIV_DEBUG + page_zip_des_t* page_zip = buf_block_get_page_zip(block); +#endif #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, block->page.frame, index)); #endif /* UNIV_ZIP_DEBUG */ ut_ad(!page_zip || !index->table->is_temporary()); - /* The insert buffer tree should never be updated in place. */ - ut_ad(!dict_index_is_ibuf(index)); ut_ad(trx_id > 0 || (flags & BTR_KEEP_SYS_FLAG) || index->table->is_temporary()); ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG) @@ -4415,7 +4148,7 @@ btr_cur_pessimistic_update( | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG)); err = optim_err = btr_cur_optimistic_update( - flags | BTR_KEEP_IBUF_BITMAP, + flags, cursor, offsets, offsets_heap, update, cmpl_info, thr, trx_id, mtr); @@ -4426,18 +4159,6 @@ btr_cur_pessimistic_update( break; default: err_exit: - /* We suppressed this with BTR_KEEP_IBUF_BITMAP. - For DB_ZIP_OVERFLOW, the IBUF_BITMAP_FREE bits were - already reset by btr_cur_update_alloc_zip() if the - page was recompressed. */ - if (page_zip - && optim_err != DB_ZIP_OVERFLOW - && !dict_index_is_clust(index) - && page_is_leaf(block->page.frame)) { - ut_ad(!index->table->is_temporary()); - ibuf_update_free_bits_zip(block, mtr); - } - if (big_rec_vec != NULL) { dtuple_big_rec_free(big_rec_vec); } @@ -4515,11 +4236,6 @@ btr_cur_pessimistic_update( index->first_user_field())))) { big_rec_vec = dtuple_convert_big_rec(index, update, new_entry, &n_ext); if (UNIV_UNLIKELY(big_rec_vec == NULL)) { - - /* We cannot goto return_after_reservations, - because we may need to update the - IBUF_BITMAP_FREE bits, which was suppressed by - BTR_KEEP_IBUF_BITMAP. */ #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, block->page.frame, @@ -4564,11 +4280,6 @@ btr_cur_pessimistic_update( btr_cur_write_sys(new_entry, index, trx_id, roll_ptr); } - const ulint max_ins_size = page_zip - ? 0 - : page_get_max_insert_size_after_reorganize(block->page.frame, - 1); - if (UNIV_UNLIKELY(is_metadata)) { ut_ad(new_entry->is_metadata()); ut_ad(index->is_instant()); @@ -4653,18 +4364,6 @@ btr_cur_pessimistic_update( rec_offs_make_valid(page_cursor->rec, index, true, *offsets); } - } else if (!dict_index_is_clust(index) - && page_is_leaf(block->page.frame)) { - /* Update the free bits in the insert buffer. - This is the same block which was skipped by - BTR_KEEP_IBUF_BITMAP. */ - if (page_zip) { - ut_ad(!index->table->is_temporary()); - ibuf_update_free_bits_zip(block, mtr); - } else if (!index->table->is_temporary()) { - ibuf_update_free_bits_low(block, max_ins_size, - mtr); - } } if (!srv_read_only_mode @@ -4686,16 +4385,7 @@ btr_cur_pessimistic_update( of a badly-compressing record, it is possible for btr_cur_optimistic_update() to return DB_UNDERFLOW and btr_cur_insert_if_possible() to return FALSE. */ - ut_a(page_zip || optim_err != DB_UNDERFLOW); - - /* Out of space: reset the free bits. - This is the same block which was skipped by - BTR_KEEP_IBUF_BITMAP. */ - if (!dict_index_is_clust(index) - && !index->table->is_temporary() - && page_is_leaf(block->page.frame)) { - ibuf_reset_free_bits(block); - } + ut_ad(page_zip || optim_err != DB_UNDERFLOW); } if (big_rec_vec != NULL) { @@ -4740,8 +4430,7 @@ btr_cur_pessimistic_update( same temp-table in parallel. max_trx_id is ignored for temp tables because it not required for MVCC. */ - if (dict_index_is_sec_or_ibuf(index) - && !index->table->is_temporary()) { + if (!index->is_primary() && !index->table->is_temporary()) { /* Update PAGE_MAX_TRX_ID in the index page header. It was not updated by btr_cur_pessimistic_insert() because of BTR_NO_LOCKING_FLAG. */ @@ -5052,9 +4741,6 @@ btr_cur_optimistic_delete( } { - page_t* page = buf_block_get_frame(block); - page_zip_des_t* page_zip= buf_block_get_page_zip(block); - if (UNIV_UNLIKELY(rec_get_info_bits(rec, page_rec_is_comp(rec)) & REC_INFO_MIN_REC_FLAG)) { /* This should be rolling back instant ADD COLUMN. @@ -5063,7 +4749,7 @@ btr_cur_optimistic_delete( insert into SYS_COLUMNS is rolled back. */ ut_ad(cursor->index()->table->supports_instant()); ut_ad(cursor->index()->is_primary()); - ut_ad(!page_zip); + ut_ad(!buf_block_get_page_zip(block)); page_cur_delete_rec(btr_cur_get_page_cur(cursor), offsets, mtr); /* We must empty the PAGE_FREE list, because @@ -5081,40 +4767,8 @@ btr_cur_optimistic_delete( btr_search_update_hash_on_delete(cursor); } - if (page_zip) { -#ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page, - cursor->index())); -#endif /* UNIV_ZIP_DEBUG */ - page_cur_delete_rec(btr_cur_get_page_cur(cursor), - offsets, mtr); -#ifdef UNIV_ZIP_DEBUG - ut_a(page_zip_validate(page_zip, page, - cursor->index())); -#endif /* UNIV_ZIP_DEBUG */ - - /* On compressed pages, the IBUF_BITMAP_FREE - space is not affected by deleting (purging) - records, because it is defined as the minimum - of space available *without* reorganize, and - space available in the modification log. */ - } else { - const ulint max_ins - = page_get_max_insert_size_after_reorganize( - page, 1); - - page_cur_delete_rec(btr_cur_get_page_cur(cursor), - offsets, mtr); - - /* The change buffer does not handle inserts - into non-leaf pages, into clustered indexes, - or into the change buffer. */ - if (!cursor->index()->is_clust() - && !cursor->index()->table->is_temporary() - && !dict_index_is_ibuf(cursor->index())) { - ibuf_update_free_bits_low(block, max_ins, mtr); - } - } + page_cur_delete_rec(btr_cur_get_page_cur(cursor), + offsets, mtr); } func_exit: @@ -5310,9 +4964,9 @@ btr_cur_pessimistic_delete( goto err_exit; } - btr_cur_t cursor; - cursor.page_cur.index = index; - cursor.page_cur.block = block; + btr_cur_t cur; + cur.page_cur.index = index; + cur.page_cur.block = block; if (!page_has_prev(page)) { /* If we delete the leftmost node pointer on a @@ -5328,16 +4982,17 @@ btr_cur_pessimistic_delete( rec_offs* offsets; ulint len; - rtr_page_get_father_block(NULL, heap, mtr, NULL, - &cursor); - father_rec = btr_cur_get_rec(&cursor); + rtr_page_get_father_block(nullptr, heap, nullptr, + &cur, + cursor->rtr_info->thr, mtr); + father_rec = btr_cur_get_rec(&cur); offsets = rec_get_offsets(father_rec, index, NULL, 0, ULINT_UNDEFINED, &heap); rtr_read_mbr(rec_get_nth_field( father_rec, offsets, 0, &len), &father_mbr); - rtr_update_mbr_field(&cursor, offsets, NULL, + rtr_update_mbr_field(&cur, offsets, NULL, page, &father_mbr, next_rec, mtr); ut_d(parent_latched = true); } else { @@ -5345,12 +5000,12 @@ btr_cur_pessimistic_delete( on a page, we have to change the parent node pointer so that it is equal to the new leftmost node pointer on the page */ - ret = btr_page_get_father(mtr, &cursor); + ret = btr_page_get_father(mtr, &cur); if (!ret) { *err = DB_CORRUPTION; goto err_exit; } - *err = btr_cur_node_ptr_delete(&cursor, mtr); + *err = btr_cur_node_ptr_delete(&cur, mtr); if (*err != DB_SUCCESS) { got_err: ret = FALSE; @@ -5397,7 +5052,10 @@ btr_cur_pessimistic_delete( #endif /* UNIV_ZIP_DEBUG */ ut_ad(!parent_latched - || btr_check_node_ptr(index, block, mtr)); + || btr_check_node_ptr(index, block, + cursor->rtr_info + ? cursor->rtr_info->thr + : nullptr, mtr)); if (!ret && btr_cur_compress_recommendation(cursor, mtr)) { if (UNIV_LIKELY(allow_merge)) { @@ -5544,7 +5202,7 @@ class btr_est_cur_t ulint parent_savepoint= m_savepoint; m_savepoint= mtr_set_savepoint(&mtr); - m_block= btr_block_get(*index(), m_page_id.page_no(), RW_S_LATCH, !level, + m_block= btr_block_get(*index(), m_page_id.page_no(), RW_S_LATCH, &mtr, nullptr); if (parent_block && parent_block != right_parent) @@ -5762,8 +5420,7 @@ static ha_rows btr_estimate_n_rows_in_range_on_level( savepoint= mtr_set_savepoint(&mtr); /* Fetch the page. */ - block= btr_block_get(*index, page_id.page_no(), RW_S_LATCH, !level, &mtr, - nullptr); + block= btr_block_get(*index, page_id.page_no(), RW_S_LATCH, &mtr, nullptr); if (prev_block) mtr_release_block_at_savepoint(&mtr, prev_savepoint, prev_block); @@ -6378,7 +6035,7 @@ struct btr_blob_log_check_t { if (UNIV_UNLIKELY(page_no != FIL_NULL)) { m_pcur->btr_cur.page_cur.block = btr_block_get( - *index, page_no, RW_X_LATCH, false, m_mtr); + *index, page_no, RW_X_LATCH, m_mtr); /* The page should not be evicted or corrupted while we are holding a buffer-fix on it. */ m_pcur->btr_cur.page_cur.block->page.unfix(); diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index 76b173359dacd..bd2f4e0cbfc71 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2012, 2014 Facebook, Inc. All Rights Reserved. -Copyright (C) 2014, 2022, MariaDB Corporation. +Copyright (C) 2014, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -33,7 +33,6 @@ Modified 30/07/2014 Jan Lindström jan.lindstrom@mariadb.com #include "dict0stats.h" #include "dict0stats_bg.h" #include "dict0defrag_bg.h" -#include "ibuf0ibuf.h" #include "lock0lock.h" #include "srv0start.h" #include "mysqld.h" @@ -330,20 +329,16 @@ btr_defragment_merge_pages( // If max_ins_size >= move_size, we can move the records without // reorganizing the page, otherwise we need to reorganize the page // first to release more space. - if (move_size > max_ins_size) { - dberr_t err = btr_page_reorganize_block(page_zip_level, - to_block, index, mtr); - if (err != DB_SUCCESS) { - if (!dict_index_is_clust(index) - && page_is_leaf(to_page)) { - ibuf_reset_free_bits(to_block); - } - // If reorganization fails, that means page is - // not compressable. There's no point to try - // merging into this page. Continue to the - // next page. - return err == DB_FAIL ? from_block : nullptr; - } + if (move_size <= max_ins_size) { + } else if (dberr_t err = btr_page_reorganize_block(page_zip_level, + to_block, index, + mtr)) { + // If reorganization fails, that means page is + // not compressable. There's no point to try + // merging into this page. Continue to the + // next page. + return err == DB_FAIL ? from_block : nullptr; + } else { ut_ad(page_validate(to_page, index)); max_ins_size = page_get_max_insert_size(to_page, n_recs); if (max_ins_size < move_size) { @@ -392,18 +387,6 @@ btr_defragment_merge_pages( && *max_data_size > new_data_size + move_size) { *max_data_size = new_data_size + move_size; } - // Set ibuf free bits if necessary. - if (!dict_index_is_clust(index) - && page_is_leaf(to_page)) { - if (zip_size) { - ibuf_reset_free_bits(to_block); - } else { - ibuf_update_free_bits_if_full( - to_block, - srv_page_size, - ULINT_UNDEFINED); - } - } btr_cur_t parent; parent.page_cur.index = index; parent.page_cur.block = from_block; @@ -526,8 +509,7 @@ btr_defragment_n_pages( break; } - blocks[i] = btr_block_get(*index, page_no, RW_X_LATCH, true, - mtr); + blocks[i] = btr_block_get(*index, page_no, RW_X_LATCH, mtr); if (!blocks[i]) { return nullptr; } @@ -542,7 +524,7 @@ btr_defragment_n_pages( /* given page is the last page. Lift the records to father. */ dberr_t err; - btr_lift_page_up(index, block, mtr, &err); + btr_lift_page_up(index, block, nullptr, mtr, &err); } return NULL; } diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 46b8d48785005..640b1b4ea2ab7 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2022, MariaDB Corporation. +Copyright (c) 2016, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -157,20 +157,14 @@ btr_pcur_store_position( cursor->rel_pos = BTR_PCUR_ON; } - if (index->is_ibuf()) { - ut_ad(!index->table->not_redundant()); - cursor->old_n_fields = uint16_t(rec_get_n_fields_old(rec)); - } else { - cursor->old_n_fields = static_cast( - dict_index_get_n_unique_in_tree(index)); - if (index->is_spatial() && !page_rec_is_leaf(rec)) { - ut_ad(dict_index_get_n_unique_in_tree_nonleaf(index) - == DICT_INDEX_SPATIAL_NODEPTR_SIZE); - /* For R-tree, we have to compare - the child page numbers as well. */ - cursor->old_n_fields - = DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1; - } + cursor->old_n_fields = static_cast( + dict_index_get_n_unique_in_tree(index)); + if (index->is_spatial() && !page_rec_is_leaf(rec)) { + ut_ad(dict_index_get_n_unique_in_tree_nonleaf(index) + == DICT_INDEX_SPATIAL_NODEPTR_SIZE); + /* For R-tree, we have to compare + the child page numbers as well. */ + cursor->old_n_fields = DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1; } cursor->old_n_core_fields = index->n_core_fields; @@ -476,8 +470,7 @@ btr_pcur_move_to_next_page( dberr_t err; buf_block_t* next_block = btr_block_get( - *cursor->index(), next_page_no, mode, - page_is_leaf(page), mtr, &err); + *cursor->index(), next_page_no, mode, mtr, &err); if (UNIV_UNLIKELY(!next_block)) { return err; diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index c61cdd9f6042d..93bb4825a3d25 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -305,13 +305,6 @@ static void btr_search_info_update_hash(btr_search_t *info, btr_cur_t *cursor) dict_index_t* index = cursor->index(); int cmp; - if (dict_index_is_ibuf(index)) { - /* So many deletes are performed on an insert buffer tree - that we do not consider a hash index useful on it: */ - - return; - } - uint16_t n_unique = dict_index_get_n_unique_in_tree(index); if (info->n_hash_potential == 0) { @@ -712,7 +705,6 @@ btr_search_update_hash_ref( ut_ad(block->page.id().space() == index->table->space_id); ut_ad(index == cursor->index()); - ut_ad(!dict_index_is_ibuf(index)); auto part = btr_search_sys.get_part(*index); part->latch.wr_lock(SRW_LOCK_CALL); ut_ad(!block->index || block->index == index); @@ -1062,7 +1054,6 @@ btr_search_guess_on_hash( return false; } - ut_ad(!index->is_ibuf()); ut_ad(latch_mode == BTR_SEARCH_LEAF || latch_mode == BTR_MODIFY_LEAF); compile_time_assert(ulint{BTR_SEARCH_LEAF} == ulint{RW_S_LATCH}); compile_time_assert(ulint{BTR_MODIFY_LEAF} == ulint{RW_X_LATCH}); @@ -1269,7 +1260,6 @@ void btr_search_drop_page_hash_index(buf_block_t* block, ut_ad(block->page.id().space() == index->table->space_id); ut_a(index_id == index->id); - ut_ad(!dict_index_is_ibuf(index)); n_fields = block->curr_n_fields; n_bytes = block->curr_n_bytes; @@ -1472,7 +1462,6 @@ btr_search_build_page_hash_index( ut_ad(ahi_latch == &btr_search_sys.get_part(*index)->latch); ut_ad(index); ut_ad(block->page.id().space() == index->table->space_id); - ut_ad(!dict_index_is_ibuf(index)); ut_ad(page_is_leaf(block->page.frame)); ut_ad(block->page.lock.have_x() || block->page.lock.have_s()); @@ -1798,7 +1787,6 @@ void btr_search_update_hash_on_delete(btr_cur_t *cursor) ut_ad(block->page.id().space() == index->table->space_id); ut_a(index == cursor->index()); ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0); - ut_ad(!dict_index_is_ibuf(index)); rec = btr_cur_get_rec(cursor); @@ -1871,7 +1859,6 @@ void btr_search_update_hash_node_on_insert(btr_cur_t *cursor, } ut_a(cursor->index() == index); - ut_ad(!dict_index_is_ibuf(index)); ahi_latch->wr_lock(SRW_LOCK_CALL); if (!block->index || !btr_search_enabled) { @@ -1964,7 +1951,6 @@ void btr_search_update_hash_on_insert(btr_cur_t *cursor, } ut_a(index == cursor->index()); - ut_ad(!dict_index_is_ibuf(index)); n_fields = block->curr_n_fields; n_bytes = block->curr_n_bytes; @@ -2213,7 +2199,6 @@ btr_search_hash_table_validate(ulint hash_table_id) invokes btr_search_drop_page_hash_index(). */ ut_a(block->page.state() == buf_page_t::REMOVE_HASH); state_ok: - ut_ad(!dict_index_is_ibuf(block->index)); ut_ad(block->page.id().space() == block->index->table->space_id); diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 9b8e843eab7ce..c22a4cb1b5f2e 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -50,7 +50,6 @@ Created 11/5/1995 Heikki Tuuri #include "buf0dblwr.h" #include "lock0lock.h" #include "btr0sea.h" -#include "ibuf0ibuf.h" #include "trx0undo.h" #include "trx0purge.h" #include "log0log.h" @@ -589,7 +588,7 @@ bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf, DBUG_EXECUTE_IF( "page_intermittent_checksum_mismatch", { static int page_counter; - if (page_counter++ == 3) { + if (page_counter++ == 6) { crc32++; } }); @@ -724,7 +723,8 @@ bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf, DBUG_EXECUTE_IF( "page_intermittent_checksum_mismatch", { static int page_counter; - if (page_counter++ == 3) return true; + if (page_counter++ == 6) + return true; }); if ((checksum_field1 != crc32 @@ -1820,9 +1820,6 @@ inline void buf_pool_t::resize() " and dictionary."; } - /* normalize ibuf.max_size */ - ibuf_max_size_update(srv_change_buffer_max_size); - if (srv_buf_pool_old_size != srv_buf_pool_size) { buf_resize_status("Completed resizing buffer pool from %zu to %zu bytes." @@ -1896,7 +1893,6 @@ static void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) mysql_mutex_assert_owner(&buf_pool.mutex); ut_ad(buf_pool.page_hash.lock_get(chain).is_write_locked()); ut_ad(bpage == buf_pool.page_hash.get(id, chain)); - ut_ad(!buf_pool.watch_is_sentinel(*bpage)); ut_d(const auto state= bpage->state()); ut_ad(state >= buf_page_t::FREED); ut_ad(state <= buf_page_t::READ_FIX); @@ -1940,135 +1936,6 @@ static void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) buf_pool.page_hash.replace(chain, bpage, dpage); } -/** Register a watch for a page identifier. The caller must hold an -exclusive page hash latch. The *hash_lock may be released, -relocated, and reacquired. -@param id page identifier -@param chain hash table chain with exclusively held page_hash -@return a buffer pool block corresponding to id -@retval nullptr if the block was not present, and a watch was installed */ -inline buf_page_t *buf_pool_t::watch_set(const page_id_t id, - buf_pool_t::hash_chain &chain) -{ - ut_ad(&chain == &page_hash.cell_get(id.fold())); - ut_ad(page_hash.lock_get(chain).is_write_locked()); - -retry: - if (buf_page_t *bpage= page_hash.get(id, chain)) - { - if (!watch_is_sentinel(*bpage)) - /* The page was loaded meanwhile. */ - return bpage; - /* Add to an existing watch. */ - bpage->fix(); - return nullptr; - } - - page_hash.lock_get(chain).unlock(); - /* Allocate a watch[] and then try to insert it into the page_hash. */ - mysql_mutex_lock(&mutex); - - /* The maximum number of purge tasks should never exceed - the UT_ARR_SIZE(watch) - 1, and there is no way for a purge task to hold a - watch when setting another watch. */ - for (buf_page_t *w= &watch[UT_ARR_SIZE(watch)]; w-- >= watch; ) - { - ut_ad(w->access_time == 0); - ut_ad(!w->oldest_modification()); - ut_ad(!w->zip.data); - ut_ad(!w->in_zip_hash); - static_assert(buf_page_t::NOT_USED == 0, "efficiency"); - if (ut_d(auto s=) w->state()) - { - /* This watch may be in use for some other page. */ - ut_ad(s >= buf_page_t::UNFIXED); - continue; - } - /* w is pointing to watch[], which is protected by mutex. - Normally, buf_page_t::id for objects that are reachable by - page_hash.get(id, chain) are protected by hash_lock. */ - w->set_state(buf_page_t::UNFIXED + 1); - w->id_= id; - - buf_page_t *bpage= page_hash.get(id, chain); - if (UNIV_LIKELY_NULL(bpage)) - { - w->set_state(buf_page_t::NOT_USED); - page_hash.lock_get(chain).lock(); - mysql_mutex_unlock(&mutex); - goto retry; - } - - page_hash.lock_get(chain).lock(); - ut_ad(w->state() == buf_page_t::UNFIXED + 1); - buf_pool.page_hash.append(chain, w); - mysql_mutex_unlock(&mutex); - return nullptr; - } - - ut_error; - mysql_mutex_unlock(&mutex); - return nullptr; -} - -/** Stop watching whether a page has been read in. -watch_set(id) must have returned nullptr before. -@param id page identifier -@param chain unlocked hash table chain */ -TRANSACTIONAL_TARGET -void buf_pool_t::watch_unset(const page_id_t id, buf_pool_t::hash_chain &chain) -{ - mysql_mutex_assert_not_owner(&mutex); - buf_page_t *w; - { - transactional_lock_guard g{page_hash.lock_get(chain)}; - /* The page must exist because watch_set() did fix(). */ - w= page_hash.get(id, chain); - ut_ad(w->in_page_hash); - if (!watch_is_sentinel(*w)) - { - no_watch: - w->unfix(); - w= nullptr; - } - else - { - const auto state= w->state(); - ut_ad(~buf_page_t::LRU_MASK & state); - ut_ad(state >= buf_page_t::UNFIXED + 1); - if (state != buf_page_t::UNFIXED + 1) - goto no_watch; - } - } - - if (!w) - return; - - const auto old= w; - /* The following is based on buf_pool_t::watch_remove(). */ - mysql_mutex_lock(&mutex); - w= page_hash.get(id, chain); - - { - transactional_lock_guard g - {buf_pool.page_hash.lock_get(chain)}; - auto f= w->unfix(); - ut_ad(f < buf_page_t::READ_FIX || w != old); - - if (f == buf_page_t::UNFIXED && w == old) - { - page_hash.remove(chain, w); - // Now that w is detached from page_hash, release it to watch[]. - ut_ad(w->id_ == id); - ut_ad(!w->frame); - ut_ad(!w->zip.data); - w->set_state(buf_page_t::NOT_USED); - } - } - - mysql_mutex_unlock(&mutex); -} - /** Mark the page status as FREED for the given tablespace and page number. @param[in,out] space tablespace @param[in] page page number @@ -2150,7 +2017,7 @@ buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size) if (hash_lock.is_locked()) xabort(); bpage= buf_pool.page_hash.get(page_id, chain); - if (!bpage || buf_pool.watch_is_sentinel(*bpage)) + if (!bpage) { xend(); goto must_read_page; @@ -2175,7 +2042,7 @@ buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size) { hash_lock.lock_shared(); bpage= buf_pool.page_hash.get(page_id, chain); - if (!bpage || buf_pool.watch_is_sentinel(*bpage)) + if (!bpage) { hash_lock.unlock_shared(); goto must_read_page; @@ -2348,13 +2215,9 @@ buf_zip_decompress( @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, -BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH +or BUF_PEEK_IF_IN_POOL @param[in] mtr mini-transaction @param[out] err DB_SUCCESS or error code -@param[in] allow_ibuf_merge Allow change buffer merge to happen -while reading the page from file -then it makes sure that it does merging of change buffer changes while -reading the page from file. @return pointer to the block or NULL */ TRANSACTIONAL_TARGET buf_block_t* @@ -2365,10 +2228,8 @@ buf_page_get_low( buf_block_t* guess, ulint mode, mtr_t* mtr, - dberr_t* err, - bool allow_ibuf_merge) + dberr_t* err) { - unsigned access_time; ulint retries = 0; ut_ad(!mtr || mtr->is_active()); @@ -2377,11 +2238,6 @@ buf_page_get_low( || (rw_latch == RW_X_LATCH) || (rw_latch == RW_SX_LATCH) || (rw_latch == RW_NO_LATCH)); - ut_ad(!allow_ibuf_merge - || mode == BUF_GET - || mode == BUF_GET_POSSIBLY_FREED - || mode == BUF_GET_IF_IN_POOL - || mode == BUF_GET_IF_IN_POOL_OR_WATCH); if (err) { *err = DB_SUCCESS; @@ -2399,7 +2255,6 @@ buf_page_get_low( case BUF_GET_POSSIBLY_FREED: break; case BUF_GET: - case BUF_GET_IF_IN_POOL_OR_WATCH: ut_ad(!mtr->is_freeing_tree()); fil_space_t* s = fil_space_get(page_id.space()); ut_ad(s); @@ -2407,9 +2262,6 @@ buf_page_get_low( } #endif /* UNIV_DEBUG */ - ut_ad(!mtr || !ibuf_inside(mtr) - || ibuf_page_low(page_id, zip_size, FALSE, NULL)); - ++buf_pool.stat.n_page_gets; auto& chain= buf_pool.page_hash.cell_get(page_id.fold()); @@ -2442,8 +2294,7 @@ buf_page_get_low( hash_lock.lock_shared(); block = reinterpret_cast( buf_pool.page_hash.get(page_id, chain)); - if (UNIV_LIKELY(block - && !buf_pool.watch_is_sentinel(block->page))) { + if (UNIV_LIKELY(block != nullptr)) { state = block->page.fix(); hash_lock.unlock_shared(); goto got_block; @@ -2454,20 +2305,6 @@ buf_page_get_low( switch (mode) { case BUF_GET_IF_IN_POOL: case BUF_PEEK_IF_IN_POOL: - return nullptr; - case BUF_GET_IF_IN_POOL_OR_WATCH: - /* We cannot easily use a memory transaction here. */ - hash_lock.lock(); - block = reinterpret_cast - (buf_pool.watch_set(page_id, chain)); - /* buffer-fixing will prevent eviction */ - state = block ? block->page.fix() : 0; - hash_lock.unlock(); - - if (block) { - goto got_block; - } - return nullptr; } @@ -2495,7 +2332,7 @@ buf_page_get_low( return nullptr; } } else { - buf_read_ahead_random(page_id, zip_size, ibuf_inside(mtr)); + buf_read_ahead_random(page_id, zip_size); } ut_d(if (!(++buf_dbg_counter % 5771)) buf_pool.validate()); @@ -2603,7 +2440,6 @@ buf_page_get_low( switch (state) { case buf_page_t::UNFIXED + 1: - case buf_page_t::IBUF_EXIST + 1: case buf_page_t::REINIT + 1: break; default: @@ -2657,13 +2493,6 @@ buf_page_get_low( buf_pool.n_pend_unzip++; - access_time = block->page.is_accessed(); - - if (!access_time && !recv_no_ibuf_operations - && ibuf_page_exists(block->page.id(), block->zip_size())) { - state = buf_page_t::IBUF_EXIST + 1; - } - /* Decompress the page while not holding buf_pool.mutex. */ auto ok = buf_zip_decompress(block, false); @@ -2683,55 +2512,6 @@ buf_page_get_low( } } -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG -re_evict: - if (mode != BUF_GET_IF_IN_POOL - && mode != BUF_GET_IF_IN_POOL_OR_WATCH) { - } else if (!ibuf_debug || recv_recovery_is_on()) { - } else if (fil_space_t* space = fil_space_t::get(page_id.space())) { - /* Try to evict the block from the buffer pool, to use the - insert buffer (change buffer) as much as possible. */ - - mysql_mutex_lock(&buf_pool.mutex); - - block->unfix(); - - /* Blocks cannot be relocated or enter or exit the - buf_pool while we are holding the buf_pool.mutex. */ - const bool evicted = buf_LRU_free_page(&block->page, true); - space->release(); - - if (evicted) { - page_hash_latch& hash_lock - = buf_pool.page_hash.lock_get(chain); - hash_lock.lock(); - mysql_mutex_unlock(&buf_pool.mutex); - /* We may set the watch, as it would have - been set if the page were not in the - buffer pool in the first place. */ - block= reinterpret_cast( - mode == BUF_GET_IF_IN_POOL_OR_WATCH - ? buf_pool.watch_set(page_id, chain) - : buf_pool.page_hash.get(page_id, chain)); - hash_lock.unlock(); - return(NULL); - } - - block->fix(); - mysql_mutex_unlock(&buf_pool.mutex); - buf_flush_sync(); - - state = block->page.state(); - - if (state == buf_page_t::UNFIXED + 1 - && !block->page.oldest_modification()) { - goto re_evict; - } - - /* Failed to evict the page; change it directly */ - } -#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - ut_ad(state > buf_page_t::FREED); if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) { goto ignore_block; @@ -2744,118 +2524,69 @@ buf_page_get_low( #endif /* UNIV_DEBUG */ ut_ad(block->page.frame); - if (state >= buf_page_t::UNFIXED - && allow_ibuf_merge - && fil_page_get_type(block->page.frame) == FIL_PAGE_INDEX - && page_is_leaf(block->page.frame)) { - block->page.lock.x_lock(); - ut_ad(block->page.id() == page_id - || (state >= buf_page_t::READ_FIX - && state < buf_page_t::WRITE_FIX)); - -#ifdef BTR_CUR_HASH_ADAPT - btr_search_drop_page_hash_index(block, true); -#endif /* BTR_CUR_HASH_ADAPT */ - - dberr_t e; + mtr_memo_type_t fix_type; + switch (rw_latch) { + case RW_NO_LATCH: + mtr->memo_push(block, MTR_MEMO_BUF_FIX); + return block; + case RW_S_LATCH: + fix_type = MTR_MEMO_PAGE_S_FIX; + block->page.lock.s_lock(); + ut_ad(!block->page.is_read_fixed()); if (UNIV_UNLIKELY(block->page.id() != page_id)) { + block->page.lock.s_unlock(); + block->page.lock.x_lock(); page_id_mismatch: - state = block->page.state(); - e = DB_CORRUPTION; -ibuf_merge_corrupted: - if (err) { - *err = e; - } - if (block->page.id().is_corrupted()) { - buf_pool.corrupted_evict(&block->page, state); + buf_pool.corrupted_evict(&block->page, + block->page.state()); } - return nullptr; - } - - state = block->page.state(); - ut_ad(state < buf_page_t::READ_FIX); - - if (state >= buf_page_t::IBUF_EXIST - && state < buf_page_t::REINIT) { - block->page.clear_ibuf_exist(); - e = ibuf_merge_or_delete_for_page(block, page_id, - block->zip_size()); - if (UNIV_UNLIKELY(e != DB_SUCCESS)) { - goto ibuf_merge_corrupted; + if (err) { + *err = DB_CORRUPTION; } + return nullptr; } - - if (rw_latch == RW_X_LATCH) { - mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); - goto got_latch; - } else { - block->page.lock.x_unlock(); - goto get_latch; + break; + case RW_SX_LATCH: + fix_type = MTR_MEMO_PAGE_SX_FIX; + block->page.lock.u_lock(); + ut_ad(!block->page.is_io_fixed()); + if (UNIV_UNLIKELY(block->page.id() != page_id)) { + block->page.lock.u_x_upgrade(); + goto page_id_mismatch; } - } else { -get_latch: - switch (rw_latch) { - mtr_memo_type_t fix_type; - case RW_NO_LATCH: - mtr->memo_push(block, MTR_MEMO_BUF_FIX); + break; + default: + ut_ad(rw_latch == RW_X_LATCH); + fix_type = MTR_MEMO_PAGE_X_FIX; + if (block->page.lock.x_lock_upgraded()) { + ut_ad(block->page.id() == page_id); + block->unfix(); + mtr->page_lock_upgrade(*block); return block; - case RW_S_LATCH: - fix_type = MTR_MEMO_PAGE_S_FIX; - block->page.lock.s_lock(); - ut_ad(!block->page.is_read_fixed()); - if (UNIV_UNLIKELY(block->page.id() != page_id)) { - block->page.lock.s_unlock(); - block->page.lock.x_lock(); - goto page_id_mismatch; - } -get_latch_valid: - mtr->memo_push(block, fix_type); + } + if (UNIV_UNLIKELY(block->page.id() != page_id)) { + goto page_id_mismatch; + } + } + + mtr->memo_push(block, fix_type); #ifdef BTR_CUR_HASH_ADAPT - btr_search_drop_page_hash_index(block, true); + btr_search_drop_page_hash_index(block, true); #endif /* BTR_CUR_HASH_ADAPT */ - break; - case RW_SX_LATCH: - fix_type = MTR_MEMO_PAGE_SX_FIX; - block->page.lock.u_lock(); - ut_ad(!block->page.is_io_fixed()); - if (UNIV_UNLIKELY(block->page.id() != page_id)) { - block->page.lock.u_x_upgrade(); - goto page_id_mismatch; - } - goto get_latch_valid; - default: - ut_ad(rw_latch == RW_X_LATCH); - fix_type = MTR_MEMO_PAGE_X_FIX; - if (block->page.lock.x_lock_upgraded()) { - ut_ad(block->page.id() == page_id); - block->unfix(); - mtr->page_lock_upgrade(*block); - return block; - } - if (UNIV_UNLIKELY(block->page.id() != page_id)) { - goto page_id_mismatch; - } - goto get_latch_valid; - } -got_latch: - ut_ad(page_id_t(page_get_space_id(block->page.frame), - page_get_page_no(block->page.frame)) - == page_id); + ut_ad(page_id_t(page_get_space_id(block->page.frame), + page_get_page_no(block->page.frame)) == page_id); - if (mode == BUF_GET_POSSIBLY_FREED - || mode == BUF_PEEK_IF_IN_POOL) { - return block; - } + if (mode == BUF_GET_POSSIBLY_FREED || mode == BUF_PEEK_IF_IN_POOL) { + return block; + } - const bool not_first_access{block->page.set_accessed()}; - buf_page_make_young_if_needed(&block->page); - if (!not_first_access) { - buf_read_ahead_linear(page_id, block->zip_size(), - ibuf_inside(mtr)); - } + const bool not_first_access{block->page.set_accessed()}; + buf_page_make_young_if_needed(&block->page); + if (!not_first_access) { + buf_read_ahead_linear(page_id, block->zip_size()); } return block; @@ -2867,11 +2598,9 @@ buf_page_get_low( @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, -BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH +or BUF_PEEK_IF_IN_POOL @param[in,out] mtr mini-transaction, or NULL @param[out] err DB_SUCCESS or error code -@param[in] allow_ibuf_merge Allow change buffer merge while -reading the pages from file. @return pointer to the block or NULL */ buf_block_t* buf_page_get_gen( @@ -2881,8 +2610,7 @@ buf_page_get_gen( buf_block_t* guess, ulint mode, mtr_t* mtr, - dberr_t* err, - bool allow_ibuf_merge) + dberr_t* err) { if (buf_block_t *block= recv_sys.recover(page_id)) { @@ -2899,57 +2627,20 @@ buf_page_get_gen( /* The block may be write-fixed at this point because we are not holding a lock, but it must not be read-fixed. */ ut_ad(s < buf_page_t::READ_FIX || s >= buf_page_t::WRITE_FIX); - if (err) - *err= DB_SUCCESS; - const bool must_merge= allow_ibuf_merge && - ibuf_page_exists(page_id, block->zip_size()); if (s < buf_page_t::UNFIXED) { - got_freed_page: ut_ad(mode == BUF_GET_POSSIBLY_FREED || mode == BUF_PEEK_IF_IN_POOL); block->page.unfix(); goto corrupted; } - else if (must_merge && - fil_page_get_type(block->page.frame) == FIL_PAGE_INDEX && - page_is_leaf(block->page.frame)) - { - block->page.lock.x_lock(); - s= block->page.state(); - ut_ad(s > buf_page_t::FREED); - ut_ad(s < buf_page_t::READ_FIX); - if (s < buf_page_t::UNFIXED) - { - block->page.lock.x_unlock(); - goto got_freed_page; - } - else - { - if (block->page.is_ibuf_exist()) - block->page.clear_ibuf_exist(); - if (dberr_t e= - ibuf_merge_or_delete_for_page(block, page_id, block->zip_size())) - { - if (err) - *err= e; - buf_pool.corrupted_evict(&block->page, s); - return nullptr; - } - } - - if (rw_latch == RW_X_LATCH) - { - mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); - return block; - } - block->page.lock.x_unlock(); - } + if (err) + *err= DB_SUCCESS; mtr->page_lock(block, rw_latch); return block; } return buf_page_get_low(page_id, zip_size, rw_latch, - guess, mode, mtr, err, allow_ibuf_merge); + guess, mode, mtr, err); } /********************************************************************//** @@ -3014,7 +2705,6 @@ bool buf_page_optimistic_get(ulint rw_latch, buf_block_t *block, { ut_ad(rw_latch == RW_S_LATCH || !block->page.is_io_fixed()); ut_ad(id == block->page.id()); - ut_ad(!ibuf_inside(mtr) || ibuf_page(id, block->zip_size(), nullptr)); if (modify_clock != block->modify_clock || block->page.is_freed()) { @@ -3091,6 +2781,7 @@ void buf_block_t::initialise(const page_id_t page_id, ulint zip_size, ut_ad(!page.in_file()); buf_block_init_low(this); page.init(fix, page_id); + page.set_os_used(); page_zip_set_size(&page.zip, zip_size); } @@ -3109,12 +2800,11 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, buf_page_t *bpage= buf_pool.page_hash.get(page_id, chain); - if (bpage && !buf_pool.watch_is_sentinel(*bpage)) + if (bpage) { #ifdef BTR_CUR_HASH_ADAPT const dict_index_t *drop_hash_entry= nullptr; #endif - bool ibuf_exist= false; if (!mtr->have_x_latch(reinterpret_cast(*bpage))) { @@ -3140,10 +2830,7 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, if (state < buf_page_t::UNFIXED) bpage->set_reinit(buf_page_t::FREED); else - { bpage->set_reinit(state & buf_page_t::LRU_MASK); - ibuf_exist= (state & buf_page_t::LRU_MASK) == buf_page_t::IBUF_EXIST; - } if (UNIV_LIKELY(bpage->frame != nullptr)) { @@ -3169,10 +2856,7 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, if (state < buf_page_t::UNFIXED) bpage->set_reinit(buf_page_t::FREED); else - { bpage->set_reinit(state & buf_page_t::LRU_MASK); - ibuf_exist= (state & buf_page_t::LRU_MASK) == buf_page_t::IBUF_EXIST; - } mysql_mutex_lock(&buf_pool.flush_list_mutex); buf_relocate(bpage, &free_block->page); @@ -3212,9 +2896,6 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, false); #endif /* BTR_CUR_HASH_ADAPT */ - if (ibuf_exist && !recv_recovery_is_on()) - ibuf_merge_or_delete_for_page(nullptr, page_id, zip_size); - return reinterpret_cast(bpage); } @@ -3255,13 +2936,6 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size, bpage->set_accessed(); buf_pool.stat.n_pages_created++; - /* Delete possible entries for the page from the insert buffer: - such can exist if the page belonged to an index which was dropped */ - if (page_id < page_id_t{SRV_SPACE_ID_UPPER_BOUND, 0} && - !srv_is_undo_tablespace(page_id.space()) && - !recv_recovery_is_on()) - ibuf_merge_or_delete_for_page(nullptr, page_id, zip_size); - static_assert(FIL_PAGE_PREV + 4 == FIL_PAGE_NEXT, "adjacent"); memset_aligned<8>(bpage->frame + FIL_PAGE_PREV, 0xff, 8); mach_write_to_2(bpage->frame + FIL_PAGE_TYPE, FIL_PAGE_TYPE_ALLOCATED); @@ -3325,32 +2999,15 @@ ATTRIBUTE_COLD void buf_page_monitor(const buf_page_t &bpage, bool read) const byte* frame = bpage.zip.data ? bpage.zip.data : bpage.frame; switch (fil_page_get_type(frame)) { - ulint level; case FIL_PAGE_TYPE_INSTANT: case FIL_PAGE_INDEX: case FIL_PAGE_RTREE: - level = btr_page_get_level(frame); - - /* Check if it is an index page for insert buffer */ - if (fil_page_get_type(frame) == FIL_PAGE_INDEX - && btr_page_get_index_id(frame) - == (index_id_t)(DICT_IBUF_ID_MIN + IBUF_SPACE_ID)) { - if (level == 0) { - counter = MONITOR_RW_COUNTER( - read, MONITOR_INDEX_IBUF_LEAF_PAGE); - } else { - counter = MONITOR_RW_COUNTER( - read, - MONITOR_INDEX_IBUF_NON_LEAF_PAGE); - } + if (page_is_leaf(frame)) { + counter = MONITOR_RW_COUNTER( + read, MONITOR_INDEX_LEAF_PAGE); } else { - if (level == 0) { - counter = MONITOR_RW_COUNTER( - read, MONITOR_INDEX_LEAF_PAGE); - } else { - counter = MONITOR_RW_COUNTER( - read, MONITOR_INDEX_NON_LEAF_PAGE); - } + counter = MONITOR_RW_COUNTER( + read, MONITOR_INDEX_NON_LEAF_PAGE); } break; @@ -3362,14 +3019,6 @@ ATTRIBUTE_COLD void buf_page_monitor(const buf_page_t &bpage, bool read) counter = MONITOR_RW_COUNTER(read, MONITOR_INODE_PAGE); break; - case FIL_PAGE_IBUF_FREE_LIST: - counter = MONITOR_RW_COUNTER(read, MONITOR_IBUF_FREELIST_PAGE); - break; - - case FIL_PAGE_IBUF_BITMAP: - counter = MONITOR_RW_COUNTER(read, MONITOR_IBUF_BITMAP_PAGE); - break; - case FIL_PAGE_TYPE_SYS: counter = MONITOR_RW_COUNTER(read, MONITOR_SYSTEM_PAGE); break; @@ -3602,25 +3251,16 @@ dberr_t buf_page_t::read_complete(const fil_node_t &node) if (recovery && !recv_recover_page(node.space, this)) return DB_PAGE_CORRUPTED; - const bool ibuf_may_exist= frame && !recv_no_ibuf_operations && - (!expected_id.space() || !is_predefined_tablespace(expected_id.space())) && - fil_page_get_type(read_frame) == FIL_PAGE_INDEX && - page_is_leaf(read_frame); - if (UNIV_UNLIKELY(MONITOR_IS_ON(MONITOR_MODULE_BUF_PAGE))) buf_page_monitor(*this, true); DBUG_PRINT("ib_buf", ("read page %u:%u", id().space(), id().page_no())); if (!recovery) { - ut_d(auto f=) zip.fix.fetch_sub(ibuf_may_exist - ? READ_FIX - IBUF_EXIST - : READ_FIX - UNFIXED); + ut_d(auto f=) zip.fix.fetch_sub(READ_FIX - UNFIXED); ut_ad(f >= READ_FIX); ut_ad(f < WRITE_FIX); } - else if (ibuf_may_exist) - set_ibuf_exist(); lock.x_unlock(true); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 6bf03d3e72a48..99b44c0d06e36 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. Copyright (c) 2013, 2014, Fusion-io This program is free software; you can redistribute it and/or modify it under @@ -889,7 +889,7 @@ static bool buf_flush_check_neighbor(const page_id_t id, ulint fold, bool lru) const buf_page_t *bpage= buf_pool.page_hash.get(id, buf_pool.page_hash.cell_get(fold)); - if (!bpage || buf_pool.watch_is_sentinel(*bpage)) + if (!bpage) return false; /* We avoid flushing 'non-old' blocks in an LRU flush, because the @@ -1066,8 +1066,7 @@ static ulint buf_flush_try_neighbors(fil_space_t *space, because the flushed blocks are soon freed */ if (!lru || id == page_id || bpage->is_old()) { - if (!buf_pool.watch_is_sentinel(*bpage) && - bpage->oldest_modification() > 1 && bpage->ready_for_flush() && + if (bpage->oldest_modification() > 1 && bpage->ready_for_flush() && bpage->flush(lru, space)) { ++count; @@ -1174,7 +1173,7 @@ static void buf_flush_discard_page(buf_page_t *bpage) ut_d(const auto state= bpage->state()); ut_ad(state == buf_page_t::FREED || state == buf_page_t::UNFIXED || - state == buf_page_t::IBUF_EXIST || state == buf_page_t::REINIT); + state == buf_page_t::REINIT); bpage->lock.u_unlock(); buf_LRU_free_page(bpage, true); @@ -1724,7 +1723,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept resize_log.write(CHECKPOINT_1, {c, get_block_size()}); } - if (srv_file_flush_method != SRV_O_DSYNC) + if (!log_write_through) ut_a(log.flush()); latch.wr_lock(SRW_LOCK_CALL); ut_ad(checkpoint_pending); @@ -1756,7 +1755,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept if (!is_pmem()) { - if (srv_file_flush_method != SRV_O_DSYNC) + if (!log_write_through) ut_a(resize_log.flush()); IF_WIN(log.close(),); } @@ -1902,13 +1901,7 @@ static bool log_checkpoint() if (recv_recovery_is_on()) recv_sys.apply(true); - switch (srv_file_flush_method) { - case SRV_NOSYNC: - case SRV_O_DIRECT_NO_FSYNC: - break; - default: - fil_flush_file_spaces(); - } + fil_flush_file_spaces(); log_sys.latch.wr_lock(SRW_LOCK_CALL); const lsn_t end_lsn= log_sys.get_lsn(); @@ -2060,13 +2053,7 @@ ATTRIBUTE_COLD static void buf_flush_sync_for_checkpoint(lsn_t lsn) MONITOR_FLUSH_SYNC_PAGES, n_flushed); } - switch (srv_file_flush_method) { - case SRV_NOSYNC: - case SRV_O_DIRECT_NO_FSYNC: - break; - default: - fil_flush_file_spaces(); - } + fil_flush_file_spaces(); log_sys.latch.wr_lock(SRW_LOCK_CALL); const lsn_t newest_lsn= log_sys.get_lsn(); diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 20f7544466f12..e60aa75281d74 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -295,7 +295,7 @@ buf_block_t* buf_LRU_get_free_only() assert_block_ahi_empty(block); block->page.set_state(buf_page_t::MEMORY); - MEM_MAKE_ADDRESSABLE(block->page.frame, srv_page_size); + block->page.set_os_used(); break; } @@ -987,13 +987,6 @@ buf_LRU_block_free_non_file_page( block->page.set_state(buf_page_t::NOT_USED); MEM_UNDEFINED(block->page.frame, srv_page_size); - /* Wipe page_no and space_id */ - static_assert(FIL_PAGE_OFFSET % 4 == 0, "alignment"); - memset_aligned<4>(block->page.frame + FIL_PAGE_OFFSET, 0xfe, 4); - static_assert(FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID % 4 == 2, - "not perfect alignment"); - memset_aligned<2>(block->page.frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, - 0xfe, 4); data = block->page.zip.data; if (data != NULL) { @@ -1022,7 +1015,7 @@ buf_LRU_block_free_non_file_page( pthread_cond_signal(&buf_pool.done_free); } - MEM_NOACCESS(block->page.frame, srv_page_size); + block->page.set_os_unused(); } /** Release a memory block to the buffer pool. */ diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 4a2ac88d97c0e..731f8a6c7e7ba 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -35,7 +35,7 @@ Created 11/5/1995 Heikki Tuuri #include "buf0lru.h" #include "buf0buddy.h" #include "buf0dblwr.h" -#include "ibuf0ibuf.h" +#include "page0zip.h" #include "log0recv.h" #include "trx0sys.h" #include "os0file.h" @@ -48,74 +48,24 @@ read-ahead is not done: this is to prevent flooding the buffer pool with i/o-fixed buffer blocks */ #define BUF_READ_AHEAD_PEND_LIMIT 2 -/** Remove the sentinel block for the watch before replacing it with a -real block. watch_unset() or watch_occurred() will notice -that the block has been replaced with the real block. -@param w sentinel -@param chain locked hash table chain -@return w->state() */ -inline uint32_t buf_pool_t::watch_remove(buf_page_t *w, - buf_pool_t::hash_chain &chain) -{ - mysql_mutex_assert_owner(&buf_pool.mutex); - ut_ad(xtest() || page_hash.lock_get(chain).is_write_locked()); - ut_ad(w >= &watch[0]); - ut_ad(w < &watch[array_elements(watch)]); - ut_ad(!w->in_zip_hash); - ut_ad(!w->zip.data); - - uint32_t s{w->state()}; - w->set_state(buf_page_t::NOT_USED); - ut_ad(s >= buf_page_t::UNFIXED); - ut_ad(s < buf_page_t::READ_FIX); - - if (~buf_page_t::LRU_MASK & s) - page_hash.remove(chain, w); - - ut_ad(!w->in_page_hash); - w->id_= page_id_t(~0ULL); - return s; -} - /** Initialize a page for read to the buffer buf_pool. If the page is (1) already in buf_pool, or -(2) if we specify to read only ibuf pages and the page is not an ibuf page, or -(3) if the space is deleted or being deleted, +(2) if the tablespace has been or is being deleted, then this function does nothing. Sets the io_fix flag to BUF_IO_READ and sets a non-recursive exclusive lock on the buffer frame. The io-handler must take care that the flag is cleared and the lock released later. -@param[in] mode BUF_READ_IBUF_PAGES_ONLY, ... @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] unzip whether the uncompressed page is - requested (for ROW_FORMAT=COMPRESSED) @return pointer to the block @retval NULL in case of an error */ TRANSACTIONAL_TARGET -static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id, - ulint zip_size, bool unzip) +static buf_page_t* buf_page_init_for_read(const page_id_t page_id, + ulint zip_size) { - mtr_t mtr; - - if (mode == BUF_READ_IBUF_PAGES_ONLY) - { - /* It is a read-ahead within an ibuf routine */ - ut_ad(!ibuf_bitmap_page(page_id, zip_size)); - ibuf_mtr_start(&mtr); - - if (!recv_no_ibuf_operations && !ibuf_page(page_id, zip_size, &mtr)) - { - ibuf_mtr_commit(&mtr); - return nullptr; - } - } - else - ut_ad(mode == BUF_READ_ANY_PAGE); - buf_page_t *bpage= nullptr; buf_block_t *block= nullptr; - if (!zip_size || unzip || recv_recovery_is_on()) + if (!zip_size || recv_recovery_is_on()) { block= buf_LRU_get_free_block(false); block->initialise(page_id, zip_size, buf_page_t::READ_FIX); @@ -128,8 +78,7 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id, mysql_mutex_lock(&buf_pool.mutex); - buf_page_t *hash_page= buf_pool.page_hash.get(page_id, chain); - if (hash_page && !buf_pool.watch_is_sentinel(*hash_page)) + if (buf_pool.page_hash.get(page_id, chain)) { /* The page is already in the buffer pool. */ if (block) @@ -149,11 +98,6 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id, { transactional_lock_guard g {buf_pool.page_hash.lock_get(chain)}; - - if (hash_page) - bpage->set_state(buf_pool.watch_remove(hash_page, chain) + - (buf_page_t::READ_FIX - buf_page_t::UNFIXED)); - buf_pool.page_hash.append(chain, &block->page); } @@ -191,9 +135,7 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id, check the page_hash again, as it may have been modified. */ if (UNIV_UNLIKELY(lru)) { - hash_page= buf_pool.page_hash.get(page_id, chain); - - if (UNIV_UNLIKELY(hash_page && !buf_pool.watch_is_sentinel(*hash_page))) + if (UNIV_LIKELY_NULL(buf_pool.page_hash.get(page_id, chain))) { /* The block was added by some other thread. */ buf_buddy_free(data, zip_size); @@ -213,11 +155,6 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id, { transactional_lock_guard g {buf_pool.page_hash.lock_get(chain)}; - - if (hash_page) - bpage->set_state(buf_pool.watch_remove(hash_page, chain) + - (buf_page_t::READ_FIX - buf_page_t::UNFIXED)); - buf_pool.page_hash.append(chain, bpage); } @@ -228,13 +165,9 @@ static buf_page_t* buf_page_init_for_read(ulint mode, const page_id_t page_id, mysql_mutex_unlock(&buf_pool.mutex); buf_pool.n_pend_reads++; - goto func_exit_no_mutex; + return bpage; func_exit: mysql_mutex_unlock(&buf_pool.mutex); -func_exit_no_mutex: - if (mode == BUF_READ_IBUF_PAGES_ONLY) - ibuf_mtr_commit(&mtr); - ut_ad(!bpage || bpage->in_file()); return bpage; @@ -250,10 +183,8 @@ flag is cleared and the x-lock released by an i/o-handler thread. to read from a non-existent tablespace @param[in,out] space tablespace @param[in] sync true if synchronous aio is desired -@param[in] mode BUF_READ_IBUF_PAGES_ONLY, ..., @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] unzip true=request uncompressed page @return whether a read request was queued */ static bool @@ -261,10 +192,8 @@ buf_read_page_low( dberr_t* err, fil_space_t* space, bool sync, - ulint mode, const page_id_t page_id, - ulint zip_size, - bool unzip) + ulint zip_size) { buf_page_t* bpage; @@ -279,25 +208,11 @@ buf_read_page_low( return false; } - if (sync) { - } else if (trx_sys_hdr_page(page_id) - || ibuf_bitmap_page(page_id, zip_size) - || (!recv_no_ibuf_operations - && ibuf_page(page_id, zip_size, nullptr))) { - - /* Trx sys header is so low in the latching order that we play - safe and do not leave the i/o-completion to an asynchronous - i/o-thread. Change buffer pages must always be read with - synchronous i/o, to make sure they do not get involved in - thread deadlocks. */ - sync = true; - } - /* The following call will also check if the tablespace does not exist or is being dropped; if we succeed in initing the page in the buffer pool for read, then DISCARD cannot proceed until the read has completed */ - bpage = buf_page_init_for_read(mode, page_id, zip_size, unzip); + bpage = buf_page_init_for_read(page_id, zip_size); if (bpage == NULL) { goto nothing_read; @@ -311,7 +226,7 @@ buf_read_page_low( DBUG_LOG("ib_buf", "read page " << page_id << " zip_size=" << zip_size - << " unzip=" << unzip << ',' << (sync ? "sync" : "async")); + << (sync ? " sync" : " async")); void* dst = zip_size ? bpage->zip.data : bpage->frame; const ulint len = zip_size ? zip_size : srv_page_size; @@ -339,22 +254,15 @@ buf_read_page_low( /** Applies a random read-ahead in buf_pool if there are at least a threshold value of accessed pages from the random read-ahead area. Does not read any page, not even the one at the position (space, offset), if the read-ahead -mechanism is not activated. NOTE 1: the calling thread may own latches on +mechanism is not activated. NOTE: the calling thread may own latches on pages: to avoid deadlocks this function must be written such that it cannot -end up waiting for these latches! NOTE 2: the calling thread must want -access to the page given: this rule is set to prevent unintended read-aheads -performed by ibuf routines, a situation which could result in a deadlock if -the OS does not support asynchronous i/o. +end up waiting for these latches! @param[in] page_id page id of a page which the current thread wants to access @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] ibuf whether we are inside ibuf routine -@return number of page read requests issued; NOTE that if we read ibuf -pages, it may happen that the page at the given page number does not -get read even if we return a positive value! */ +@return number of page read requests issued */ TRANSACTIONAL_TARGET -ulint -buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf) +ulint buf_read_ahead_random(const page_id_t page_id, ulint zip_size) { if (!srv_random_read_ahead) return 0; @@ -363,11 +271,6 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf) /* No read-ahead to avoid thread deadlocks */ return 0; - if (ibuf_bitmap_page(page_id, zip_size) || trx_sys_hdr_page(page_id)) - /* If it is an ibuf bitmap page or trx sys hdr, we do no - read-ahead, as that could break the ibuf page access order */ - return 0; - if (buf_pool.n_pend_reads > buf_pool.curr_size / BUF_READ_AHEAD_PEND_LIMIT) return 0; @@ -403,17 +306,14 @@ buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf) goto no_read_ahead; /* Read all the suitable blocks within the area */ - const ulint ibuf_mode= ibuf ? BUF_READ_IBUF_PAGES_ONLY : BUF_READ_ANY_PAGE; for (page_id_t i= low; i < high; ++i) { - if (ibuf_bitmap_page(i, zip_size)) - continue; if (space->is_stopping()) break; dberr_t err; space->reacquire(); - if (buf_read_page_low(&err, space, false, ibuf_mode, i, zip_size, false)) + if (buf_read_page_low(&err, space, false, i, zip_size)) count++; } @@ -454,8 +354,7 @@ dberr_t buf_read_page(const page_id_t page_id, ulint zip_size) } dberr_t err; - if (buf_read_page_low(&err, space, true, BUF_READ_ANY_PAGE, - page_id, zip_size, false)) + if (buf_read_page_low(&err, space, true, page_id, zip_size)) srv_stats.buf_pool_reads.add(1); buf_LRU_stat_inc_io(); @@ -474,8 +373,7 @@ void buf_read_page_background(fil_space_t *space, const page_id_t page_id, { dberr_t err; - if (buf_read_page_low(&err, space, false, BUF_READ_ANY_PAGE, - page_id, zip_size, false)) { + if (buf_read_page_low(&err, space, false, page_id, zip_size)) { srv_stats.buf_pool_reads.add(1); } @@ -506,16 +404,11 @@ only very improbably. NOTE 2: the calling thread may own latches on pages: to avoid deadlocks this function must be written such that it cannot end up waiting for these latches! -NOTE 3: the calling thread must want access to the page given: this rule is -set to prevent unintended read-aheads performed by ibuf routines, a situation -which could result in a deadlock if the OS does not support asynchronous io. @param[in] page_id page id; see NOTE 3 above @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] ibuf whether if we are inside ibuf routine @return number of page read requests issued */ TRANSACTIONAL_TARGET -ulint -buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf) +ulint buf_read_ahead_linear(const page_id_t page_id, ulint zip_size) { /* check if readahead is disabled */ if (!srv_read_ahead_threshold) @@ -540,11 +433,6 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf) /* This is not a border page of the area */ return 0; - if (ibuf_bitmap_page(page_id, zip_size) || trx_sys_hdr_page(page_id)) - /* If it is an ibuf bitmap page or trx sys hdr, we do no - read-ahead, as that could break the ibuf page access order */ - return 0; - fil_space_t *space= fil_space_t::get(page_id.space()); if (!space) return 0; @@ -628,17 +516,13 @@ buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf) /* If we got this far, read-ahead can be sensible: do it */ count= 0; - for (ulint ibuf_mode= ibuf ? BUF_READ_IBUF_PAGES_ONLY : BUF_READ_ANY_PAGE; - new_low != new_high_1; ++new_low) + for (; new_low != new_high_1; ++new_low) { - if (ibuf_bitmap_page(new_low, zip_size)) - continue; if (space->is_stopping()) break; dberr_t err; space->reacquire(); - count+= buf_read_page_low(&err, space, false, ibuf_mode, new_low, zip_size, - false); + count+= buf_read_page_low(&err, space, false, new_low, zip_size); } if (count) @@ -706,9 +590,7 @@ void buf_read_recv_pages(uint32_t space_id, st_::span page_nos) dberr_t err; space->reacquire(); - buf_read_page_low(&err, space, false, - BUF_READ_ANY_PAGE, cur_page_id, zip_size, - true); + buf_read_page_low(&err, space, false, cur_page_id, zip_size); if (err != DB_SUCCESS) { sql_print_error("InnoDB: Recovery failed to read page " diff --git a/storage/innobase/data/data0type.cc b/storage/innobase/data/data0type.cc index b1952bcc2a4a4..dc1c4b9a04add 100644 --- a/storage/innobase/data/data0type.cc +++ b/storage/innobase/data/data0type.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -33,13 +33,6 @@ const byte reset_trx_id[DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN] = { 0x80, 0, 0, 0, 0, 0, 0 }; -/* At the database startup we store the default-charset collation number of -this MySQL installation to this global variable. If we have < 4.1.2 format -column definitions, or records in the insert buffer, we use this -charset-collation code for them. */ - -ulint data_mysql_default_charset_coll; - /*********************************************************************//** Determine how many bytes the first n characters of the given string occupy. If the string is shorter than n characters, returns the number of bytes diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc index 5516bce920bca..316d0f0132255 100644 --- a/storage/innobase/dict/dict0boot.cc +++ b/storage/innobase/dict/dict0boot.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2022, MariaDB Corporation. +Copyright (c) 2016, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -30,7 +30,6 @@ Created 4/18/1996 Heikki Tuuri #include "dict0load.h" #include "trx0trx.h" #include "srv0srv.h" -#include "ibuf0ibuf.h" #include "buf0flu.h" #include "log0recv.h" #include "os0file.h" @@ -94,18 +93,6 @@ dict_hdr_get_new_id( mtr.commit(); } -/** Update dict_sys.row_id in the dictionary header file page. */ -void dict_hdr_flush_row_id(row_id_t id) -{ - mtr_t mtr; - mtr.start(); - buf_block_t* d= dict_hdr_get(&mtr); - byte *row_id= DICT_HDR + DICT_HDR_ROW_ID + d->page.frame; - if (mach_read_from_8(row_id) < id) - mtr.write<8>(*d, row_id, id); - mtr.commit(); -} - /** Create the DICT_HDR page on database initialization. @return error code */ dberr_t dict_create() @@ -127,10 +114,8 @@ dberr_t dict_create() } ut_a(d->page.id() == hdr_page_id); - /* Start counting row, table, index, and tree ids from + /* Start counting table, index, and tree ids from DICT_HDR_FIRST_ID */ - mtr.write<8>(*d, DICT_HDR + DICT_HDR_ROW_ID + d->page.frame, - DICT_HDR_FIRST_ID); mtr.write<8>(*d, DICT_HDR + DICT_HDR_TABLE_ID + d->page.frame, DICT_HDR_FIRST_ID); mtr.write<8>(*d, DICT_HDR + DICT_HDR_INDEX_ID + d->page.frame, @@ -233,12 +218,12 @@ dberr_t dict_boot() dict_sys.create(); dberr_t err; - const buf_block_t *d = buf_page_get_gen(hdr_page_id, 0, RW_X_LATCH, + const buf_block_t *d = buf_page_get_gen(hdr_page_id, 0, RW_S_LATCH, nullptr, BUF_GET, &mtr, &err); - if (!d) { + if (!d) { mtr.commit(); return err; - } + } heap = mem_heap_create(450); @@ -246,17 +231,6 @@ dberr_t dict_boot() const byte* dict_hdr = &d->page.frame[DICT_HDR]; - /* Because we only write new row ids to disk-based data structure - (dictionary header) when it is divisible by - DICT_HDR_ROW_ID_WRITE_MARGIN, in recovery we will not recover - the latest value of the row id counter. Therefore we advance - the counter at the database startup to avoid overlapping values. - Note that when a user after database startup first time asks for - a new row id, then because the counter is now divisible by - ..._MARGIN, it will immediately be updated to the disk-based - header. */ - - dict_sys.recover_row_id(mach_read_from_8(dict_hdr + DICT_HDR_ROW_ID)); if (uint32_t max_space_id = mach_read_from_4(dict_hdr + DICT_HDR_MAX_SPACE_ID)) { max_space_id--; @@ -420,10 +394,7 @@ dberr_t dict_boot() mtr.commit(); - err = ibuf_init_at_db_start(); - - if (err == DB_SUCCESS || srv_force_recovery >= SRV_FORCE_NO_DDL_UNDO) { - err = DB_SUCCESS; + if (err == DB_SUCCESS) { /* Load definitions of other indexes on system tables */ dict_load_sys_table(dict_sys.sys_tables); diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc index ea2914e52dc52..964e75aacc143 100644 --- a/storage/innobase/dict/dict0defrag_bg.cc +++ b/storage/innobase/dict/dict0defrag_bg.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2016, 2022, MariaDB Corporation. +Copyright (c) 2016, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -214,9 +214,6 @@ Save defragmentation result. @return DB_SUCCESS or error code */ dberr_t dict_stats_save_defrag_summary(dict_index_t *index, THD *thd) { - if (index->is_ibuf()) - return DB_SUCCESS; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; dict_table_t *table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); @@ -336,8 +333,6 @@ dict_stats_save_defrag_stats( /*============================*/ dict_index_t* index) /*!< in: index */ { - if (index->is_ibuf()) - return DB_SUCCESS; if (!index->is_readable()) return dict_stats_report_error(index->table, true); diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index e90dff03e16a1..6c003c43b4f1e 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1180,6 +1180,7 @@ inline void dict_sys_t::add(dict_table_t* table) ulint fold = my_crc32c(0, table->name.m_name, strlen(table->name.m_name)); + table->row_id = 0; table->autoinc_mutex.init(); table->lock_mutex_init(); @@ -1999,7 +2000,6 @@ dict_index_add_to_cache( ut_ad(index->n_def == index->n_fields); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(!dict_index_is_online_ddl(index)); - ut_ad(!dict_index_is_ibuf(index)); ut_d(mem_heap_validate(index->heap)); ut_a(!dict_index_is_clust(index) @@ -2381,15 +2381,7 @@ dict_index_copy_types( ulint n_fields) /*!< in: number of field types to copy */ { - ulint i; - - if (dict_index_is_ibuf(index)) { - dtuple_set_types_binary(tuple, n_fields); - - return; - } - - for (i = 0; i < n_fields; i++) { + for (ulint i = 0; i < n_fields; i++) { const dict_field_t* ifield; dtype_t* dfield_type; @@ -2628,17 +2620,14 @@ dict_index_build_internal_non_clust( ulint i; ibool* indexed; - ut_ad(table && index); - ut_ad(!dict_index_is_clust(index)); - ut_ad(!dict_index_is_ibuf(index)); + ut_ad(!index->is_primary()); ut_ad(dict_sys.locked()); /* The clustered index should be the first in the list of indexes */ clust_index = UT_LIST_GET_FIRST(table->indexes); ut_ad(clust_index); - ut_ad(dict_index_is_clust(clust_index)); - ut_ad(!dict_index_is_ibuf(clust_index)); + ut_ad(clust_index->is_clust()); /* Create a new index */ new_index = dict_mem_index_create( @@ -3769,24 +3758,7 @@ dict_index_build_node_ptr( dtuple_t* tuple; dfield_t* field; byte* buf; - ulint n_unique; - - if (dict_index_is_ibuf(index)) { - /* In a universal index tree, we take the whole record as - the node pointer if the record is on the leaf level, - on non-leaf levels we remove the last field, which - contains the page number of the child page */ - - ut_a(!dict_table_is_comp(index->table)); - n_unique = rec_get_n_fields_old(rec); - - if (level > 0) { - ut_a(n_unique > 1); - n_unique--; - } - } else { - n_unique = dict_index_get_n_unique_in_tree_nonleaf(index); - } + ulint n_unique = dict_index_get_n_unique_in_tree_nonleaf(index); tuple = dtuple_create(heap, n_unique + 1); diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index 1ee10ec8232dd..cb81e4008df0d 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2022, MariaDB Corporation. +Copyright (c) 2016, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -865,9 +865,7 @@ dict_sys_tables_rec_read( return READ_OK; } -/** Check each tablespace found in the data dictionary. -Then look at each table defined in SYS_TABLES that has a space_id > 0 -to find all the file-per-table tablespaces. +/** Open each tablespace found in the data dictionary. In a crash recovery we already have some tablespace objects created from processing the REDO log. We will compare the @@ -876,14 +874,12 @@ tablespace file. In addition, more validation will be done if recovery was needed and force_recovery is not set. We also scan the biggest space id, and store it to fil_system. */ -void dict_check_tablespaces_and_store_max_id() +void dict_load_tablespaces() { uint32_t max_space_id = 0; btr_pcur_t pcur; mtr_t mtr; - DBUG_ENTER("dict_check_tablespaces_and_store_max_id"); - mtr.start(); dict_sys.lock(SRW_LOCK_CALL); @@ -976,8 +972,6 @@ void dict_check_tablespaces_and_store_max_id() fil_set_max_space_id_if_bigger(max_space_id); dict_sys.unlock(); - - DBUG_VOID_RETURN; } /** Error message for a delete-marked record in dict_load_column_low() */ @@ -1125,7 +1119,7 @@ static const char *dict_load_column_low(dict_table_t *table, prtype = dtype_form_prtype( prtype, - data_mysql_default_charset_coll); + default_charset_info->number); } } @@ -2477,9 +2471,7 @@ static dict_table_t *dict_load_table_one(const span &name, goto corrupted; } - if (table->supports_instant()) { - err = btr_cur_instant_init(table); - } + err = btr_cur_instant_init(table); } } else { ut_ad(ignore_err & DICT_ERR_IGNORE_INDEX); diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index 06d3051522971..ce02d9513d171 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2009, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -584,8 +584,6 @@ dict_stats_table_clone_create( continue; } - ut_ad(!dict_index_is_ibuf(index)); - ulint n_uniq = dict_index_get_n_unique(index); heap_size += sizeof(dict_index_t); @@ -634,8 +632,6 @@ dict_stats_table_clone_create( continue; } - ut_ad(!dict_index_is_ibuf(index)); - dict_index_t* idx; idx = (dict_index_t*) mem_heap_zalloc(heap, sizeof(*idx)); @@ -714,7 +710,6 @@ dict_stats_empty_index( /*!< in: whether to empty defrag stats */ { ut_ad(!(index->type & DICT_FTS)); - ut_ad(!dict_index_is_ibuf(index)); ut_ad(index->table->stats_mutex_is_owner()); ulint n_uniq = index->n_uniq; @@ -767,8 +762,6 @@ dict_stats_empty_table( continue; } - ut_ad(!dict_index_is_ibuf(index)); - dict_stats_empty_index(index, empty_defrag_stats); } @@ -901,8 +894,6 @@ dict_stats_copy( } } - ut_ad(!dict_index_is_ibuf(dst_idx)); - if (!INDEX_EQ(src_idx, dst_idx)) { for (src_idx = dict_table_get_first_index(src); src_idx != NULL; @@ -1094,11 +1085,10 @@ btr_cur_t::open_random_leaf(rec_offs *&offsets, mem_heap_t *&heap, mtr_t &mtr) dberr_t err; auto offset= index()->page; - bool merge= false; ulint height= ULINT_UNDEFINED; while (buf_block_t *block= - btr_block_get(*index(), offset, RW_S_LATCH, merge, &mtr, &err)) + btr_block_get(*index(), offset, RW_S_LATCH, &mtr, &err)) { page_cur.block= block; @@ -1120,8 +1110,7 @@ btr_cur_t::open_random_leaf(rec_offs *&offsets, mem_heap_t *&heap, mtr_t &mtr) return DB_SUCCESS; } - if (!--height) - merge= !index()->is_clust(); + height--; page_cur_open_on_rnd_user_rec(&page_cur); @@ -1462,10 +1451,6 @@ dict_stats_update_transient_for_index( dict_stats_empty_index(index, false); index->table->stats_mutex_unlock(); return err; -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG - } else if (ibuf_debug && !dict_index_is_clust(index)) { - goto dummy_empty; -#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ } else if (dict_index_is_online_ddl(index) || !index->is_committed() || !index->table->space) { goto dummy_empty; @@ -1571,9 +1556,6 @@ dict_stats_update_transient( } for (; index != NULL; index = dict_table_get_next_index(index)) { - - ut_ad(!dict_index_is_ibuf(index)); - if (!index->is_btree()) { continue; } @@ -1638,9 +1620,7 @@ static dberr_t page_cur_open_level(page_cur_t *page_cur, ulint level, for (ulint height = ULINT_UNDEFINED;; height--) { - buf_block_t* block= - btr_block_get(*index, page, RW_S_LATCH, - !height && !index->is_clust(), mtr, &err); + buf_block_t* block= btr_block_get(*index, page, RW_S_LATCH, mtr, &err); if (!block) break; @@ -2258,9 +2238,7 @@ dict_stats_analyze_index_below_cur( block = buf_page_get_gen(page_id, zip_size, RW_S_LATCH, NULL, BUF_GET, - &mtr, &err, - !index->is_clust() - && 1 == btr_page_get_level(page)); + &mtr, &err); if (!block) { goto func_exit; } @@ -2999,7 +2977,6 @@ dict_stats_update_persistent( return(DB_CORRUPTION); } - ut_ad(!dict_index_is_ibuf(index)); table->stats_mutex_lock(); dict_stats_empty_index(index, false); table->stats_mutex_unlock(); @@ -3373,8 +3350,6 @@ dict_stats_save( continue; } - ut_ad(!dict_index_is_ibuf(index)); - for (unsigned i = 0; i < index->n_uniq; i++) { char stat_name[16]; diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 481a2dbce5318..bde04c84de635 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2021, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2022, MariaDB Corporation. +Copyright (c) 2014, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -45,7 +45,6 @@ Created 10/25/1995 Heikki Tuuri #include "srv0start.h" #include "trx0purge.h" #include "buf0lru.h" -#include "ibuf0ibuf.h" #include "buf0flu.h" #include "log.h" #ifdef __linux__ @@ -499,6 +498,9 @@ void fil_space_t::flush_low() break; } + if (fil_system.is_write_through()) + goto skip_flush; + fil_n_pending_tablespace_flushes++; for (fil_node_t *node= UT_LIST_GET_FIRST(chain); node; node= UT_LIST_GET_NEXT(chain, node)) @@ -523,8 +525,9 @@ void fil_space_t::flush_low() mysql_mutex_unlock(&fil_system.mutex); } - clear_flush(); fil_n_pending_tablespace_flushes--; +skip_flush: + clear_flush(); } /** Try to extend a tablespace. @@ -753,7 +756,6 @@ inline pfs_os_file_t fil_node_t::close_to_free(bool detach_handle) { if (space->is_in_unflushed_spaces) { - ut_ad(srv_file_flush_method != SRV_O_DIRECT_NO_FSYNC); space->is_in_unflushed_spaces= false; fil_system.unflushed_spaces.remove(*space); } @@ -786,7 +788,6 @@ pfs_os_file_t fil_system_t::detach(fil_space_t *space, bool detach_handle) if (space->is_in_unflushed_spaces) { - ut_ad(srv_file_flush_method != SRV_O_DIRECT_NO_FSYNC); space->is_in_unflushed_spaces= false; unflushed_spaces.remove(*space); } @@ -1320,6 +1321,120 @@ ATTRIBUTE_COLD void fil_system_t::extend_to_recv_size() mysql_mutex_unlock(&mutex); } +ATTRIBUTE_COLD void fil_space_t::reopen_all() +{ + mysql_mutex_assert_owner(&fil_system.mutex); + fil_system.freeze_space_list++; + + for (fil_space_t &space : fil_system.space_list) + { + for (fil_node_t *node= UT_LIST_GET_FIRST(space.chain); node; + node= UT_LIST_GET_NEXT(chain, node)) + if (node->is_open()) + goto need_to_close; + continue; + + need_to_close: + uint32_t p= space.n_pending.fetch_or(CLOSING, std::memory_order_acquire); + if (p & (STOPPING | CLOSING)) + continue; + + for (fil_node_t *node= UT_LIST_GET_FIRST(space.chain); node; + node= UT_LIST_GET_NEXT(chain, node)) + { + if (!node->is_open()) + continue; + + ulint type= OS_DATA_FILE; + + switch (FSP_FLAGS_GET_ZIP_SSIZE(space.flags)) { + case 1: case 2: + type= OS_DATA_FILE_NO_O_DIRECT; + } + + for (ulint count= 10000; count--;) + { + p= space.pending(); + + if (!(p & CLOSING) || (p & STOPPING)) + break; + + if (!(p & PENDING) && !node->being_extended) + { + space.reacquire(); + mysql_mutex_unlock(&fil_system.mutex); + /* Unconditionally flush the file, because + fil_system.write_through was updated prematurely, + potentially causing some flushes to be lost. */ + os_file_flush(node->handle); + mysql_mutex_lock(&fil_system.mutex); + p= space.n_pending.fetch_sub(1, std::memory_order_relaxed) - 1; + + if (!(p & CLOSING) || (p & STOPPING)) + break; + + if (!(p & PENDING) && !node->being_extended) + { + ut_a(os_file_close(node->handle)); + bool success; + node->handle= os_file_create(innodb_data_file_key, node->name, + node->is_raw_disk + ? OS_FILE_OPEN_RAW : OS_FILE_OPEN, + OS_FILE_AIO, type, + srv_read_only_mode, &success); + ut_a(success); + goto next_file; + } + } + + space.reacquire(); + mysql_mutex_unlock(&fil_system.mutex); + std::this_thread::sleep_for(std::chrono::microseconds(100)); + mysql_mutex_lock(&fil_system.mutex); + space.release(); + + if (!node->is_open()) + goto next_file; + } + + if (!(p & CLOSING) || (p & STOPPING)) + next_file: + continue; + + sql_print_error("InnoDB: Failed to reopen file '%s' due to " UINT32PF + " operations", node->name, p & PENDING); + } + } + + fil_system.freeze_space_list--; +} + +void fil_system_t::set_write_through(bool write_through) +{ + mysql_mutex_lock(&mutex); + + if (write_through != is_write_through()) + { + this->write_through= write_through; + fil_space_t::reopen_all(); + } + + mysql_mutex_unlock(&mutex); +} + +void fil_system_t::set_buffered(bool buffered) +{ + mysql_mutex_lock(&mutex); + + if (buffered != is_buffered()) + { + this->buffered= buffered; + fil_space_t::reopen_all(); + } + + mysql_mutex_unlock(&mutex); +} + /** Close all tablespace files at shutdown */ void fil_space_t::close_all() { @@ -1340,12 +1455,9 @@ void fil_space_t::close_all() for (fil_node_t *node= UT_LIST_GET_FIRST(space.chain); node != NULL; node= UT_LIST_GET_NEXT(chain, node)) { - if (!node->is_open()) - { next: continue; - } for (ulint count= 10000; count--;) { @@ -1361,8 +1473,8 @@ void fil_space_t::close_all() goto next; } - ib::error() << "File '" << node->name << "' has " << space.referenced() - << " operations"; + sql_print_error("InnoDB: File '%s' has " UINT32PF " operations", + node->name, space.referenced()); } fil_system.detach(&space); @@ -1605,7 +1717,6 @@ pfs_os_file_t fil_delete_tablespace(uint32_t id) fil_space_free_low(space); } - ibuf_delete_for_discarded_space(id); return handle; } @@ -2598,7 +2709,7 @@ inline void fil_node_t::complete_write() mysql_mutex_assert_not_owner(&fil_system.mutex); if (space->purpose != FIL_TYPE_TEMPORARY && - srv_file_flush_method != SRV_O_DIRECT_NO_FSYNC && + (!fil_system.is_write_through() && !my_disable_sync) && space->set_needs_flush()) { mysql_mutex_lock(&fil_system.mutex); @@ -2746,10 +2857,6 @@ void fil_aio_callback(const IORequest &request) { ut_ad(request.is_read()); - /* IMPORTANT: since i/o handling for reads will read also the insert - buffer in fil_system.sys_space, we have to be very careful not to - introduce deadlocks. We never close fil_system.sys_space data - files and never issue asynchronous reads of change buffer pages. */ const page_id_t id(request.bpage->id()); if (dberr_t err= request.bpage->read_complete(*request.node)) @@ -2774,14 +2881,6 @@ void fil_aio_callback(const IORequest &request) possibly cached by the OS. */ void fil_flush_file_spaces() { - if (srv_file_flush_method == SRV_O_DIRECT_NO_FSYNC) - { - ut_d(mysql_mutex_lock(&fil_system.mutex)); - ut_ad(fil_system.unflushed_spaces.empty()); - ut_d(mysql_mutex_unlock(&fil_system.mutex)); - return; - } - rescan: mysql_mutex_lock(&fil_system.mutex); diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index b6971558201b9..bdc08b22f3abb 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (C) 2013, 2021, MariaDB Corporation. +Copyright (C) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -47,7 +47,6 @@ Updated 14/02/2015 #include "trx0sys.h" #include "row0mysql.h" #include "buf0lru.h" -#include "ibuf0ibuf.h" #include "zlib.h" #ifdef __linux__ #include diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 09583e157b7ec..a7b98e159cb2d 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -33,7 +33,6 @@ Created 11/29/1995 Heikki Tuuri #include "page0page.h" #include "srv0srv.h" #include "srv0start.h" -#include "ibuf0ibuf.h" #include "btr0btr.h" #include "btr0sea.h" #include "dict0boot.h" @@ -848,11 +847,17 @@ fsp_fill_free_list( { buf_block_t *f= buf_LRU_get_free_block(false); buf_block_t *block= - buf_page_create(space, - static_cast(i + FSP_IBUF_BITMAP_OFFSET), + buf_page_create(space, static_cast(i + 1), zip_size, mtr, f); if (UNIV_UNLIKELY(block != f)) buf_pool.free_block(f); + /* The zero-initialization will reset the change buffer bitmap bits + to safe values for possible import to an earlier version that + supports change buffering: + + IBUF_BITMAP_FREE = 0 (no space left for buffering inserts) + IBUF_BITMAP_BUFFERED = 0 (no changes have been buffered) + IBUF_BITMAP_IBUF = 0 (not part of the change buffer) */ fsp_init_file_page(space, block, mtr); mtr->write<2>(*block, FIL_PAGE_TYPE + block->page.frame, FIL_PAGE_IBUF_BITMAP); @@ -877,9 +882,9 @@ fsp_fill_free_list( if (UNIV_UNLIKELY(init_xdes)) { /* The first page in the extent is a descriptor page and the - second is an ibuf bitmap page: mark them used */ + second was reserved for change buffer bitmap: mark them used */ xdes_set_free(*xdes, descr, 0, mtr); - xdes_set_free(*xdes, descr, FSP_IBUF_BITMAP_OFFSET, mtr); + xdes_set_free(*xdes, descr, 1, mtr); xdes_set_state(*xdes, descr, XDES_FREE_FRAG, mtr); if (dberr_t err= flst_add_last(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, xdes, xoffset, mtr)) diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index 59d77c9c5fc12..28e8359cab43d 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2022, MariaDB Corporation. +Copyright (c) 2018, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -34,7 +34,6 @@ Created 2013/03/27 Allen Lai and Jimmy Yang #include "btr0pcur.h" #include "rem0cmp.h" #include "lock0lock.h" -#include "ibuf0ibuf.h" #include "trx0undo.h" #include "srv0mon.h" #include "gis0geo.h" @@ -538,7 +537,7 @@ rtr_update_mbr_field( mem_heap_free(heap); } -MY_ATTRIBUTE((nonnull, warn_unused_result)) +MY_ATTRIBUTE((nonnull(1,3,4,5,6,8), warn_unused_result)) /**************************************************************//** Update parent page's MBR and Predicate lock information during a split */ static @@ -552,6 +551,7 @@ rtr_adjust_upper_level( buf_block_t* new_block, /*!< in/out: the new half page */ rtr_mbr_t* mbr, /*!< in: MBR on the old page */ rtr_mbr_t* new_mbr, /*!< in: MBR on the new page */ + que_thr_t* thr, /*!< in/out: query thread */ mtr_t* mtr) /*!< in: mtr */ { ulint page_no; @@ -570,7 +570,6 @@ rtr_adjust_upper_level( /* Create a memory heap where the data tuple is stored */ heap = mem_heap_create(1024); - cursor.thr = sea_cur->thr; cursor.page_cur.index = sea_cur->index(); cursor.page_cur.block = block; @@ -584,7 +583,8 @@ rtr_adjust_upper_level( /* Set new mbr for the old page on the upper level. */ /* Look up the index for the node pointer to page */ - offsets = rtr_page_get_father_block(NULL, heap, mtr, sea_cur, &cursor); + offsets = rtr_page_get_father_block(nullptr, heap, sea_cur, &cursor, + thr, mtr); page_cursor = btr_cur_get_page_cur(&cursor); @@ -669,7 +669,7 @@ rtr_adjust_upper_level( if (next_page_no == FIL_NULL) { } else if (buf_block_t* next_block = btr_block_get(*sea_cur->index(), next_page_no, RW_X_LATCH, - false, mtr, &err)) { + mtr, &err)) { if (UNIV_UNLIKELY(memcmp_aligned<4>(next_block->page.frame + FIL_PAGE_PREV, block->page.frame @@ -691,11 +691,6 @@ rtr_adjust_upper_level( /*************************************************************//** Moves record list to another page for rtree splitting. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return error code @retval DB_FAIL on ROW_FORMAT=COMPRESSED compression failure */ static @@ -731,8 +726,7 @@ rtr_split_page_move_rec_list( ulint max_to_move = 0; rtr_rec_move_t* rec_move = NULL; - ut_ad(!dict_index_is_ibuf(index)); - ut_ad(dict_index_is_spatial(index)); + ut_ad(index->is_spatial()); rec_offs_init(offsets_); @@ -867,7 +861,8 @@ rtr_page_split_and_insert( const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ mtr_t* mtr, /*!< in: mtr */ - dberr_t* err) /*!< out: error code */ + dberr_t* err, /*!< out: error code */ + que_thr_t* thr) /*!< in: query thread */ { buf_block_t* block; page_t* page; @@ -1159,7 +1154,7 @@ rtr_page_split_and_insert( /* Adjust the upper level. */ *err = rtr_adjust_upper_level(cursor, flags, block, new_block, - &mbr, &new_mbr, mtr); + &mbr, &new_mbr, thr, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { return nullptr; } @@ -1179,13 +1174,6 @@ rtr_page_split_and_insert( /* If the new res insert fail, we need to do another split again. */ if (!rec) { - /* We play safe and reset the free bits for new_page */ - if (!dict_index_is_clust(cursor->index()) - && !cursor->index()->table->is_temporary()) { - ibuf_reset_free_bits(new_block); - ibuf_reset_free_bits(block); - } - /* We need to clean the parent path here and search father node later, otherwise, it's possible that find a wrong parent. */ @@ -1214,6 +1202,244 @@ rtr_page_split_and_insert( return(rec); } +/*************************************************************//** +Makes tree one level higher by splitting the root, and inserts the tuple. +NOTE that the operation of this function must always succeed, +we cannot reverse it: therefore enough free disk space must be +guaranteed to be available before this function is called. +@return inserted record */ +rec_t* +rtr_root_raise_and_insert( +/*======================*/ + ulint flags, /*!< in: undo logging and locking flags */ + btr_cur_t* cursor, /*!< in: cursor at which to insert: must be + on the root page; when the function returns, + the cursor is positioned on the predecessor + of the inserted record */ + rec_offs** offsets,/*!< out: offsets on inserted record */ + mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ + const dtuple_t* tuple, /*!< in: tuple to insert */ + ulint n_ext, /*!< in: number of externally stored columns */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err, /*!< out: error code */ + que_thr_t* thr) /*!< in: query thread */ +{ + dict_index_t* index; + rec_t* rec; + dtuple_t* node_ptr; + ulint level; + rec_t* node_ptr_rec; + page_cur_t* page_cursor; + page_zip_des_t* root_page_zip; + page_zip_des_t* new_page_zip; + buf_block_t* root; + buf_block_t* new_block; + + root = btr_cur_get_block(cursor); + root_page_zip = buf_block_get_page_zip(root); + ut_ad(!page_is_empty(root->page.frame)); + index = btr_cur_get_index(cursor); + ut_ad(index->is_spatial()); +#ifdef UNIV_ZIP_DEBUG + ut_a(!root_page_zip + || page_zip_validate(root_page_zip, root->page.frame, index)); +#endif /* UNIV_ZIP_DEBUG */ + + const page_id_t root_id{root->page.id()}; + + ut_ad(mtr->memo_contains_flagged(&index->lock, MTR_MEMO_X_LOCK + | MTR_MEMO_SX_LOCK)); + ut_ad(mtr->memo_contains_flagged(root, MTR_MEMO_PAGE_X_FIX)); + + if (index->page != root_id.page_no()) { + ut_ad("corrupted root page number" == 0); + return nullptr; + } + + if (!btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF, + *root, *index->table->space) + || !btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP, + *root, *index->table->space)) { + return nullptr; + } + + /* Allocate a new page to the tree. Root splitting is done by first + moving the root records to the new page, emptying the root, putting + a node pointer to the new page, and then splitting the new page. */ + + level = btr_page_get_level(root->page.frame); + + new_block = btr_page_alloc(index, 0, FSP_NO_DIR, level, mtr, mtr, err); + + if (!new_block) { + return nullptr; + } + + new_page_zip = buf_block_get_page_zip(new_block); + ut_a(!new_page_zip == !root_page_zip); + ut_a(!new_page_zip + || page_zip_get_size(new_page_zip) + == page_zip_get_size(root_page_zip)); + + btr_page_create(new_block, new_page_zip, index, level, mtr); + if (page_has_siblings(new_block->page.frame)) { + compile_time_assert(FIL_PAGE_NEXT == FIL_PAGE_PREV + 4); + compile_time_assert(FIL_NULL == 0xffffffff); + static_assert(FIL_PAGE_PREV % 8 == 0, "alignment"); + memset_aligned<8>(new_block->page.frame + FIL_PAGE_PREV, + 0xff, 8); + mtr->memset(new_block, FIL_PAGE_PREV, 8, 0xff); + if (UNIV_LIKELY_NULL(new_page_zip)) { + memset_aligned<8>(new_page_zip->data + FIL_PAGE_PREV, + 0xff, 8); + } + } + + /* Copy the records from root to the new page one by one. */ + dberr_t e; + if (!err) { + err = &e; + } + + if (0 +#ifdef UNIV_ZIP_COPY + || new_page_zip +#endif /* UNIV_ZIP_COPY */ + || !page_copy_rec_list_end(new_block, root, + page_get_infimum_rec(root->page.frame), + index, mtr, err)) { + switch (*err) { + case DB_SUCCESS: + break; + case DB_FAIL: + *err = DB_SUCCESS; + break; + default: + return nullptr; + } + + ut_a(new_page_zip); + + /* Copy the page byte for byte. */ + page_zip_copy_recs(new_block, root_page_zip, + root->page.frame, index, mtr); + + /* Update the lock table and possible hash index. */ + if (index->has_locking()) { + lock_move_rec_list_end( + new_block, root, + page_get_infimum_rec(root->page.frame)); + } + + /* Move any existing predicate locks */ + lock_prdt_rec_move(new_block, root_id); + } + + constexpr uint16_t max_trx_id = PAGE_HEADER + PAGE_MAX_TRX_ID; + if (!index->is_primary()) { + /* In secondary indexes, + PAGE_MAX_TRX_ID can be reset on the root page, because + the field only matters on leaf pages, and the root no + longer is a leaf page. (Older versions of InnoDB did + set PAGE_MAX_TRX_ID on all secondary index pages.) */ + byte* p = my_assume_aligned<8>( + PAGE_HEADER + PAGE_MAX_TRX_ID + root->page.frame); + if (mach_read_from_8(p)) { + mtr->memset(root, max_trx_id, 8, 0); + if (UNIV_LIKELY_NULL(root->page.zip.data)) { + memset_aligned<8>(max_trx_id + + root->page.zip.data, 0, 8); + } + } + } else { + /* PAGE_ROOT_AUTO_INC is only present in the clustered index + root page; on other clustered index pages, we want to reserve + the field PAGE_MAX_TRX_ID for future use. */ + byte* p = my_assume_aligned<8>( + PAGE_HEADER + PAGE_MAX_TRX_ID + new_block->page.frame); + if (mach_read_from_8(p)) { + mtr->memset(new_block, max_trx_id, 8, 0); + if (UNIV_LIKELY_NULL(new_block->page.zip.data)) { + memset_aligned<8>(max_trx_id + + new_block->page.zip.data, + 0, 8); + } + } + } + + /* If this is a pessimistic insert which is actually done to + perform a pessimistic update then we have stored the lock + information of the record to be inserted on the infimum of the + root page: we cannot discard the lock structs on the root page */ + + if (index->has_locking()) { + lock_update_root_raise(*new_block, root_id); + } + + /* Create a memory heap where the node pointer is stored */ + if (!*heap) { + *heap = mem_heap_create(1000); + } + + const uint32_t new_page_no = new_block->page.id().page_no(); + rec = page_rec_get_next(page_get_infimum_rec(new_block->page.frame)); + ut_ad(rec); /* We just created the page. */ + + /* Build the node pointer (= node key and page address) for the + child */ + rtr_mbr_t new_mbr; + rtr_page_cal_mbr(index, new_block, &new_mbr, *heap); + node_ptr = rtr_index_build_node_ptr(index, &new_mbr, rec, new_page_no, + *heap); + /* The node pointer must be marked as the predefined minimum record, + as there is no lower alphabetical limit to records in the leftmost + node of a level: */ + dtuple_set_info_bits(node_ptr, + dtuple_get_info_bits(node_ptr) + | REC_INFO_MIN_REC_FLAG); + + /* Rebuild the root page to get free space */ + btr_page_empty(root, root_page_zip, index, level + 1, mtr); + ut_ad(!page_has_siblings(root->page.frame)); + + page_cursor = btr_cur_get_page_cur(cursor); + + /* Insert node pointer to the root */ + + page_cur_set_before_first(root, page_cursor); + + node_ptr_rec = page_cur_tuple_insert(page_cursor, node_ptr, + offsets, heap, 0, mtr); + + /* The root page should only contain the node pointer + to new_block at this point. Thus, the data should fit. */ + ut_a(node_ptr_rec); + + page_cursor->block = new_block; + page_cursor->index = index; + + if (tuple) { + ut_ad(dtuple_check_typed(tuple)); + /* Reposition the cursor to the child node */ + ulint low_match = 0, up_match = 0; + + if (page_cur_search_with_match(tuple, PAGE_CUR_LE, + &up_match, &low_match, + page_cursor, nullptr)) { + if (err) { + *err = DB_CORRUPTION; + } + return nullptr; + } + } else { + page_cursor->rec = page_get_infimum_rec(new_block->page.frame); + } + + /* Split the child and insert tuple */ + return rtr_page_split_and_insert(flags, cursor, offsets, heap, + tuple, n_ext, mtr, err, thr); +} + /****************************************************************//** Following the right link to find the proper block for insert. @return the proper block.*/ @@ -1242,6 +1468,7 @@ rtr_ins_enlarge_mbr( /* Check path info is not empty. */ ut_ad(!btr_cur->rtr_info->parent_path->empty()); + ut_ad(btr_cur->rtr_info->thr || !btr_cur->index()->is_committed()); /* Create a memory heap. */ heap = mem_heap_create(1024); @@ -1267,7 +1494,8 @@ rtr_ins_enlarge_mbr( cursor.page_cur.index = page_cursor->index; cursor.page_cur.block = block; offsets = rtr_page_get_father_block( - NULL, heap, mtr, btr_cur, &cursor); + nullptr, heap, btr_cur, &cursor, + btr_cur->rtr_info->thr, mtr); page = buf_block_get_frame(block); diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 207d49abebaf5..d3f991bb67703 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2016, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -34,7 +34,6 @@ Created 2014/01/16 Jimmy Yang #include "btr0pcur.h" #include "rem0cmp.h" #include "lock0lock.h" -#include "ibuf0ibuf.h" #include "trx0trx.h" #include "srv0mon.h" #include "que0que.h" @@ -511,13 +510,13 @@ static void rtr_compare_cursor_rec(const rec_t *rec, dict_index_t *index, /**************************************************************//** Initializes and opens a persistent cursor to an index tree. It should be -closed with btr_pcur_close. Mainly called by row_search_index_entry() */ +closed with btr_pcur_close. */ bool rtr_pcur_open( - dict_index_t* index, /*!< in: index */ const dtuple_t* tuple, /*!< in: tuple on which search done */ btr_latch_mode latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ + que_thr_t* thr, /*!< in/out; query thread */ mtr_t* mtr) /*!< in: mtr */ { static_assert(BTR_MODIFY_TREE == (8 | BTR_MODIFY_LEAF), ""); @@ -534,15 +533,16 @@ rtr_pcur_open( /* Search with the tree cursor */ btr_cur_t* btr_cursor = btr_pcur_get_btr_cur(cursor); - btr_cursor->page_cur.index = index; + dict_index_t* const index = cursor->index(); - btr_cursor->rtr_info = rtr_create_rtr_info(false, false, - btr_cursor, index); + btr_cursor->rtr_info = rtr_create_rtr_info(false, false, thr, + btr_cursor); - /* Purge will SX lock the tree instead of take Page Locks */ - if (btr_cursor->thr) { + if (!thr) { + /* Purge will U lock the tree instead of take Page Locks */ + } else { btr_cursor->rtr_info->need_page_lock = true; - btr_cursor->rtr_info->thr = btr_cursor->thr; + btr_cursor->rtr_info->thr = thr; } if ((latch_mode & 8) && index->lock.have_u_not_x()) { @@ -607,12 +607,14 @@ rtr_pcur_open( about parent nodes in search @param[out] cursor cursor on node pointer record, its page x-latched +@param[in,out] thr query thread @return whether the cursor was successfully positioned */ -bool rtr_page_get_father(mtr_t *mtr, btr_cur_t *sea_cur, btr_cur_t *cursor) +bool rtr_page_get_father(mtr_t *mtr, btr_cur_t *sea_cur, btr_cur_t *cursor, + que_thr_t *thr) { mem_heap_t *heap = mem_heap_create(100); rec_offs *offsets= rtr_page_get_father_block(nullptr, heap, - mtr, sea_cur, cursor); + sea_cur, cursor, thr, mtr); mem_heap_free(heap); return offsets != nullptr; } @@ -629,12 +631,13 @@ static const rec_t* rtr_get_father_node( btr_cur_t* sea_cur,/*!< in: search cursor */ btr_cur_t* btr_cur,/*!< in/out: tree cursor; the cursor page is s- or x-latched, but see also above! */ + que_thr_t* thr, /*!< in/out: query thread */ ulint page_no,/*!< Current page no */ mtr_t* mtr) /*!< in: mtr */ { const rec_t* rec = nullptr; auto had_rtr = btr_cur->rtr_info; - dict_index_t* const index = btr_cur->index(); + ut_d(dict_index_t* const index = btr_cur->index()); /* Try to optimally locate the parent node. Level should always less than sea_cur->tree_height unless the root is splitting */ @@ -666,7 +669,7 @@ static const rec_t* rtr_get_father_node( rtr_clean_rtr_info(btr_cur->rtr_info, true); } - btr_cur->rtr_info = rtr_create_rtr_info(false, false, btr_cur, index); + btr_cur->rtr_info = rtr_create_rtr_info(false, false, thr, btr_cur); if (btr_cur_search_to_nth_level(level, tuple, PAGE_CUR_RTREE_LOCATE, @@ -718,6 +721,7 @@ rtr_page_get_father_node_ptr( btr_cur_t* cursor, /*!< in: cursor pointing to user record, out: cursor on node pointer record, its page x-latched */ + que_thr_t* thr, /*!< in/out: query thread */ mtr_t* mtr) /*!< in: mtr */ { dtuple_t* tuple; @@ -754,7 +758,7 @@ rtr_page_get_father_node_ptr( const rec_t* node_ptr = rtr_get_father_node(level + 1, tuple, sea_cur, cursor, - page_no, mtr); + thr, page_no, mtr); if (!node_ptr) { return nullptr; } @@ -780,18 +784,20 @@ rtr_page_get_father_block( /*======================*/ rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ - mtr_t* mtr, /*!< in: mtr */ btr_cur_t* sea_cur,/*!< in: search cursor, contains information about parent nodes in search */ - btr_cur_t* cursor) /*!< out: cursor on node pointer record, + btr_cur_t* cursor, /*!< out: cursor on node pointer record, its page x-latched */ + que_thr_t* thr, /*!< in/out: query thread */ + mtr_t* mtr) /*!< in/out: mtr */ { rec_t *rec= page_rec_get_next(page_get_infimum_rec(cursor->block()->page.frame)); if (!rec) return nullptr; cursor->page_cur.rec= rec; - return rtr_page_get_father_node_ptr(offsets, heap, sea_cur, cursor, mtr); + return rtr_page_get_father_node_ptr(offsets, heap, sea_cur, cursor, + thr, mtr); } /*******************************************************************//** @@ -804,12 +810,12 @@ rtr_create_rtr_info( bool init_matches, /*!< in: Whether to initiate the "matches" structure for collecting matched leaf records */ - btr_cur_t* cursor, /*!< in: tree search cursor */ - dict_index_t* index) /*!< in: index struct */ + que_thr_t* thr, /*!< in/out: query thread */ + btr_cur_t* cursor) /*!< in: tree search cursor */ { rtr_info_t* rtr_info; - index = index ? index : cursor->index(); + dict_index_t* index = cursor->index(); ut_ad(index); rtr_info = static_cast(ut_zalloc_nokey(sizeof(*rtr_info))); @@ -817,6 +823,7 @@ rtr_create_rtr_info( rtr_info->allocated = true; rtr_info->cursor = cursor; rtr_info->index = index; + rtr_info->thr = thr; if (init_matches) { rtr_info->heap = mem_heap_create(sizeof(*(rtr_info->matches))); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9f4400bbdb6dd..ea71fb1202677 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -87,7 +87,6 @@ this program; if not, write to the Free Software Foundation, Inc., #include "fts0plugin.h" #include "fts0priv.h" #include "fts0types.h" -#include "ibuf0ibuf.h" #include "lock0lock.h" #include "log0crypt.h" #include "mtr0mtr.h" @@ -366,6 +365,8 @@ const char* innodb_flush_method_names[] = { NullS }; +static constexpr ulong innodb_flush_method_default = IF_WIN(6,4); + /** Enumeration of innodb_flush_method */ TYPELIB innodb_flush_method_typelib = { array_elements(innodb_flush_method_names) - 1, @@ -374,6 +375,9 @@ TYPELIB innodb_flush_method_typelib = { NULL }; +/** Deprecated parameter */ +static ulong innodb_flush_method; + /** Names of allowed values of innodb_deadlock_report */ static const char *innodb_deadlock_report_names[]= { "off", /* Do not report any details of deadlocks */ @@ -394,25 +398,6 @@ static TYPELIB innodb_deadlock_report_typelib = { NULL }; -/** Allowed values of innodb_change_buffering */ -static const char* innodb_change_buffering_names[] = { - "none", /* IBUF_USE_NONE */ - "inserts", /* IBUF_USE_INSERT */ - "deletes", /* IBUF_USE_DELETE_MARK */ - "changes", /* IBUF_USE_INSERT_DELETE_MARK */ - "purges", /* IBUF_USE_DELETE */ - "all", /* IBUF_USE_ALL */ - NullS -}; - -/** Enumeration of innodb_change_buffering */ -static TYPELIB innodb_change_buffering_typelib = { - array_elements(innodb_change_buffering_names) - 1, - "innodb_change_buffering_typelib", - innodb_change_buffering_names, - NULL -}; - /** Allowed values of innodb_instant_alter_column_allowed */ const char* innodb_instant_alter_column_allowed_names[] = { "never", /* compatible with MariaDB 5.5 to 10.2 */ @@ -526,9 +511,6 @@ mysql_pfs_key_t fts_cache_mutex_key; mysql_pfs_key_t fts_cache_init_mutex_key; mysql_pfs_key_t fts_delete_mutex_key; mysql_pfs_key_t fts_doc_id_mutex_key; -mysql_pfs_key_t ibuf_bitmap_mutex_key; -mysql_pfs_key_t ibuf_mutex_key; -mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; mysql_pfs_key_t recalc_pool_mutex_key; mysql_pfs_key_t purge_sys_pq_mutex_key; mysql_pfs_key_t recv_sys_mutex_key; @@ -560,8 +542,6 @@ static PSI_mutex_info all_innodb_mutexes[] = { PSI_KEY(fts_cache_init_mutex), PSI_KEY(fts_delete_mutex), PSI_KEY(fts_doc_id_mutex), - PSI_KEY(ibuf_mutex), - PSI_KEY(ibuf_pessimistic_insert_mutex), PSI_KEY(index_online_log), PSI_KEY(page_zip_stat_per_index_mutex), PSI_KEY(purge_sys_pq_mutex), @@ -968,20 +948,6 @@ static SHOW_VAR innodb_status_variables[]= { {"dblwr_writes", &export_vars.innodb_dblwr_writes, SHOW_SIZE_T}, {"deadlocks", &lock_sys.deadlocks, SHOW_SIZE_T}, {"history_list_length", &export_vars.innodb_history_list_length,SHOW_SIZE_T}, - {"ibuf_discarded_delete_marks", &ibuf.n_discarded_ops[IBUF_OP_DELETE_MARK], - SHOW_SIZE_T}, - {"ibuf_discarded_deletes", &ibuf.n_discarded_ops[IBUF_OP_DELETE], - SHOW_SIZE_T}, - {"ibuf_discarded_inserts", &ibuf.n_discarded_ops[IBUF_OP_INSERT], - SHOW_SIZE_T}, - {"ibuf_free_list", &ibuf.free_list_len, SHOW_SIZE_T}, - {"ibuf_merged_delete_marks", &ibuf.n_merged_ops[IBUF_OP_DELETE_MARK], - SHOW_SIZE_T}, - {"ibuf_merged_deletes", &ibuf.n_merged_ops[IBUF_OP_DELETE], SHOW_SIZE_T}, - {"ibuf_merged_inserts", &ibuf.n_merged_ops[IBUF_OP_INSERT], SHOW_SIZE_T}, - {"ibuf_merges", &ibuf.n_merges, SHOW_SIZE_T}, - {"ibuf_segment_size", &ibuf.seg_size, SHOW_SIZE_T}, - {"ibuf_size", &ibuf.size, SHOW_SIZE_T}, {"log_waits", &log_sys.waits, SHOW_SIZE_T}, {"log_write_requests", &log_sys.write_to_buf, SHOW_SIZE_T}, {"log_writes", &log_sys.write_to_log, SHOW_SIZE_T}, @@ -3922,8 +3888,6 @@ static int innodb_init_params() DBUG_RETURN(HA_ERR_INITIALIZATION); } - DBUG_ASSERT(innodb_change_buffering <= IBUF_USE_ALL); - /* Check that interdependent parameters have sane values. */ if (srv_max_buf_pool_modified_pct < srv_max_dirty_pages_pct_lwm) { sql_print_warning("InnoDB: innodb_max_dirty_pages_pct_lwm" @@ -4000,27 +3964,27 @@ static int innodb_init_params() fts_sort_pll_degree = num_pll_degree; - /* Store the default charset-collation number of this MySQL - installation */ - - data_mysql_default_charset_coll = (ulint) default_charset_info->number; - + if (innodb_flush_method == 1 /* O_DSYNC */) { + log_sys.log_write_through = true; + fil_system.write_through = true; + fil_system.buffered = false; +#if defined __linux__ || defined _WIN32 + log_sys.log_buffered = false; + goto skip_buffering_tweak; +#endif + } else if (innodb_flush_method >= 4 /* O_DIRECT */ + IF_WIN(&& innodb_flush_method < 8 /* normal */,)) { + /* O_DIRECT and similar settings do nothing */ #ifndef _WIN32 - if (srv_use_atomic_writes && my_may_have_atomic_write) { - /* - Force O_DIRECT on Unixes (on Windows writes are always - unbuffered) - */ - switch (srv_file_flush_method) { - case SRV_O_DIRECT: - case SRV_O_DIRECT_NO_FSYNC: - break; - default: - srv_file_flush_method = SRV_O_DIRECT; - fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n"); - } - } + } else if (srv_use_atomic_writes && my_may_have_atomic_write) { + /* If atomic writes are enabled, do the same as with + innodb_flush_method=O_DIRECT: retain the default settings */ #endif + } else { + log_sys.log_write_through = false; + fil_system.write_through = false; + fil_system.buffered = true; + } #if defined __linux__ || defined _WIN32 if (srv_flush_log_at_trx_commit == 2) { @@ -4028,6 +3992,7 @@ static int innodb_init_params() innodb_flush_log_at_trx_commit=2. */ log_sys.log_buffered = true; } +skip_buffering_tweak: #endif if (srv_read_only_mode) { @@ -4035,12 +4000,6 @@ static int innodb_init_params() srv_use_doublewrite_buf = FALSE; } -#if !defined LINUX_NATIVE_AIO && !defined HAVE_URING && !defined _WIN32 - /* Currently native AIO is supported only on windows and linux - and that also when the support is compiled in. In all other - cases, we ignore the setting of innodb_use_native_aio. */ - srv_use_native_aio = FALSE; -#endif #ifdef HAVE_URING if (srv_use_native_aio && io_uring_may_be_unsafe) { sql_print_warning("innodb_use_native_aio may cause " @@ -4048,22 +4007,13 @@ static int innodb_init_params() "https://jira.mariadb.org/browse/MDEV-26674", io_uring_may_be_unsafe); } +#elif !defined LINUX_NATIVE_AIO && !defined _WIN32 + /* Currently native AIO is supported only on windows and linux + and that also when the support is compiled in. In all other + cases, we ignore the setting of innodb_use_native_aio. */ + srv_use_native_aio = FALSE; #endif -#ifndef _WIN32 - ut_ad(srv_file_flush_method <= SRV_O_DIRECT_NO_FSYNC); -#else - switch (srv_file_flush_method) { - case SRV_ALL_O_DIRECT_FSYNC + 1 /* "async_unbuffered"="unbuffered" */: - srv_file_flush_method = SRV_ALL_O_DIRECT_FSYNC; - break; - case SRV_ALL_O_DIRECT_FSYNC + 2 /* "normal"="fsync" */: - srv_file_flush_method = SRV_FSYNC; - break; - default: - ut_ad(srv_file_flush_method <= SRV_ALL_O_DIRECT_FSYNC); - } -#endif innodb_buffer_pool_size_init(); srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift); @@ -4217,8 +4167,6 @@ static int innodb_init(void* p) innobase_old_blocks_pct = buf_LRU_old_ratio_update( innobase_old_blocks_pct, true); - ibuf_max_size_update(srv_change_buffer_max_size); - mysql_mutex_init(pending_checkpoint_mutex_key, &log_requests.mutex, MY_MUTEX_INIT_FAST); @@ -4349,7 +4297,7 @@ innobase_start_trx_and_assign_read_view( Do this only if transaction is using REPEATABLE READ isolation level. */ trx->isolation_level = innobase_map_isolation_level( - thd_get_trx_isolation(thd)); + thd_get_trx_isolation(thd)) & 3; if (trx->isolation_level == TRX_ISO_REPEATABLE_READ) { trx->read_view.open(trx); @@ -6597,8 +6545,7 @@ uint8_t get_innobase_type_from_mysql_type(unsigned *unsigned_flag, const Field *field) { /* The following asserts try to check that the MySQL type code fits in - 8 bits: this is used in ibuf and also when DATA_NOT_NULL is ORed to - the type */ + 8 bits: this is used when DATA_NOT_NULL is ORed to the type */ static_assert(MYSQL_TYPE_STRING < 256, "compatibility"); static_assert(MYSQL_TYPE_VAR_STRING < 256, "compatibility"); @@ -15270,7 +15217,7 @@ ha_innobase::check( } /* Restore the original isolation level */ - m_prebuilt->trx->isolation_level = old_isolation_level; + m_prebuilt->trx->isolation_level = old_isolation_level & 3; #ifdef BTR_CUR_HASH_ADAPT # if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG /* We validate the whole adaptive hash index for all tables @@ -16303,7 +16250,7 @@ ha_innobase::store_lock( if (lock_type != TL_IGNORE && trx->n_mysql_tables_in_use == 0) { trx->isolation_level = innobase_map_isolation_level( - (enum_tx_isolation) thd_tx_isolation(thd)); + (enum_tx_isolation) thd_tx_isolation(thd)) & 3; if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) { @@ -17444,20 +17391,6 @@ innodb_old_blocks_pct_update(THD*, st_mysql_sys_var*, void*, const void* save) innobase_old_blocks_pct = ratio; } -/****************************************************************//** -Update the system variable innodb_old_blocks_pct using the "saved" -value. This function is registered as a callback with MySQL. */ -static -void -innodb_change_buffer_max_size_update(THD*, st_mysql_sys_var*, void*, - const void* save) -{ - srv_change_buffer_max_size = *static_cast(save); - mysql_mutex_unlock(&LOCK_global_system_variables); - ibuf_max_size_update(srv_change_buffer_max_size); - mysql_mutex_lock(&LOCK_global_system_variables); -} - #ifdef UNIV_DEBUG static uint srv_fil_make_page_dirty_debug = 0; static uint srv_saved_page_number_debug; @@ -18411,7 +18344,7 @@ buffer_pool_load_abort( } #if defined __linux__ || defined _WIN32 -static void innodb_log_file_buffering_update(THD *thd, st_mysql_sys_var*, +static void innodb_log_file_buffering_update(THD *, st_mysql_sys_var*, void *, const void *save) { mysql_mutex_unlock(&LOCK_global_system_variables); @@ -18420,6 +18353,30 @@ static void innodb_log_file_buffering_update(THD *thd, st_mysql_sys_var*, } #endif +static void innodb_log_file_write_through_update(THD *, st_mysql_sys_var*, + void *, const void *save) +{ + mysql_mutex_unlock(&LOCK_global_system_variables); + log_sys.set_write_through(*static_cast(save)); + mysql_mutex_lock(&LOCK_global_system_variables); +} + +static void innodb_data_file_buffering_update(THD *, st_mysql_sys_var*, + void *, const void *save) +{ + mysql_mutex_unlock(&LOCK_global_system_variables); + fil_system.set_buffered(*static_cast(save)); + mysql_mutex_lock(&LOCK_global_system_variables); +} + +static void innodb_data_file_write_through_update(THD *, st_mysql_sys_var*, + void *, const void *save) +{ + mysql_mutex_unlock(&LOCK_global_system_variables); + fil_system.set_write_through(*static_cast(save)); + mysql_mutex_lock(&LOCK_global_system_variables); +} + static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*, void *var, const void *save) { @@ -18848,7 +18805,7 @@ static MYSQL_SYSVAR_UINT(fast_shutdown, srv_fast_shutdown, fast_shutdown_validate, NULL, 1, 0, 3, 0); static MYSQL_SYSVAR_BOOL(file_per_table, srv_file_per_table, - PLUGIN_VAR_NOCMDARG, + PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_DEPRECATED, "Stores each InnoDB table to an .ibd file in the database dir.", NULL, NULL, TRUE); @@ -18878,11 +18835,10 @@ static MYSQL_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit, " guarantees in case of crash. 0 and 2 can be faster than 1 or 3.", NULL, NULL, 1, 0, 3, 0); -static MYSQL_SYSVAR_ENUM(flush_method, srv_file_flush_method, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, +static MYSQL_SYSVAR_ENUM(flush_method, innodb_flush_method, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_DEPRECATED, "With which method to flush data.", - NULL, NULL, IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_O_DIRECT), - &innodb_flush_method_typelib); + NULL, NULL, innodb_flush_method_default, &innodb_flush_method_typelib); static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, @@ -19252,15 +19208,44 @@ static MYSQL_SYSVAR_BOOL(optimize_fulltext_only, innodb_optimize_fulltext_only, "Only optimize the Fulltext index of the table", NULL, NULL, FALSE); +extern int os_aio_resize(ulint n_reader_threads, ulint n_writer_threads); +static void innodb_update_io_thread_count(THD *thd,ulint n_read, ulint n_write) +{ + int res = os_aio_resize(n_read, n_write); + if (res) + { +#ifndef __linux__ + ut_ad(0); +#else + ut_a(srv_use_native_aio); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_UNKNOWN_ERROR, + "Could not reserve max. number of concurrent ios." + "Increase the /proc/sys/fs/aio-max-nr to fix."); +#endif + } +} + +static void innodb_read_io_threads_update(THD* thd, struct st_mysql_sys_var*, void*, const void* save) +{ + srv_n_read_io_threads = *static_cast(save); + innodb_update_io_thread_count(thd, srv_n_read_io_threads, srv_n_write_io_threads); +} +static void innodb_write_io_threads_update(THD* thd, struct st_mysql_sys_var*, void*, const void* save) +{ + srv_n_write_io_threads = *static_cast(save); + innodb_update_io_thread_count(thd, srv_n_read_io_threads, srv_n_write_io_threads); +} + static MYSQL_SYSVAR_UINT(read_io_threads, srv_n_read_io_threads, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + PLUGIN_VAR_RQCMDARG, "Number of background read I/O threads in InnoDB.", - NULL, NULL, 4, 1, 64, 0); + NULL, innodb_read_io_threads_update , 4, 1, 64, 0); static MYSQL_SYSVAR_UINT(write_io_threads, srv_n_write_io_threads, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + PLUGIN_VAR_RQCMDARG, "Number of background write I/O threads in InnoDB.", - NULL, NULL, 4, 2, 64, 0); + NULL, innodb_write_io_threads_update, 4, 2, 64, 0); static MYSQL_SYSVAR_ULONG(force_recovery, srv_force_recovery, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, @@ -19285,6 +19270,21 @@ static MYSQL_SYSVAR_BOOL(log_file_buffering, log_sys.log_buffered, nullptr, innodb_log_file_buffering_update, FALSE); #endif +static MYSQL_SYSVAR_BOOL(log_file_write_through, log_sys.log_write_through, + PLUGIN_VAR_OPCMDARG, + "Whether each write to ib_logfile0 is write through", + nullptr, innodb_log_file_write_through_update, FALSE); + +static MYSQL_SYSVAR_BOOL(data_file_buffering, fil_system.buffered, + PLUGIN_VAR_OPCMDARG, + "Whether the file system cache for data files is enabled", + nullptr, innodb_data_file_buffering_update, FALSE); + +static MYSQL_SYSVAR_BOOL(data_file_write_through, fil_system.write_through, + PLUGIN_VAR_OPCMDARG, + "Whether each write to data files writes through", + nullptr, innodb_data_file_write_through_update, FALSE); + static MYSQL_SYSVAR_ULONGLONG(log_file_size, srv_log_file_size, PLUGIN_VAR_RQCMDARG, "Redo log size in bytes.", @@ -19345,7 +19345,7 @@ static MYSQL_SYSVAR_UINT(undo_tablespaces, srv_undo_tablespaces, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Number of undo tablespaces to use.", NULL, NULL, - 0L, /* Default seting */ + 3L, /* Default seting */ 0L, /* Minimum value */ TRX_SYS_MAX_UNDO_SPACES, 0); /* Maximum value */ @@ -19418,19 +19418,6 @@ static MYSQL_SYSVAR_BOOL(numa_interleave, srv_numa_interleave, NULL, NULL, FALSE); #endif /* HAVE_LIBNUMA */ -static MYSQL_SYSVAR_ENUM(change_buffering, innodb_change_buffering, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, - "Buffer changes to secondary indexes.", - nullptr, nullptr, IBUF_USE_NONE, &innodb_change_buffering_typelib); - -static MYSQL_SYSVAR_UINT(change_buffer_max_size, - srv_change_buffer_max_size, - PLUGIN_VAR_RQCMDARG, - "Maximum on-disk size of change buffer in terms of percentage" - " of the buffer pool.", - NULL, innodb_change_buffer_max_size_update, - CHANGE_BUFFER_DEFAULT_SIZE, 0, 50, 0); - static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method, PLUGIN_VAR_RQCMDARG, "Specifies how InnoDB index statistics collection code should" @@ -19438,18 +19425,6 @@ static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method, " NULLS_UNEQUAL and NULLS_IGNORED", NULL, NULL, SRV_STATS_NULLS_EQUAL, &innodb_stats_method_typelib); -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG -static MYSQL_SYSVAR_BOOL(change_buffer_dump, ibuf_dump, - PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, - "Dump the change buffer at startup.", - NULL, NULL, FALSE); - -static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug, - PLUGIN_VAR_RQCMDARG, - "Debug flags for InnoDB change buffering (0=none, 1=try to buffer)", - NULL, NULL, 0, 0, 1, 0); -#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - static MYSQL_SYSVAR_ULONG(buf_dump_status_frequency, srv_buf_dump_status_frequency, PLUGIN_VAR_RQCMDARG, "A number between [0, 100] that tells how oftern buffer pool dump status " @@ -19729,6 +19704,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { #if defined __linux__ || defined _WIN32 MYSQL_SYSVAR(log_file_buffering), #endif + MYSQL_SYSVAR(log_file_write_through), + MYSQL_SYSVAR(data_file_buffering), + MYSQL_SYSVAR(data_file_write_through), MYSQL_SYSVAR(log_file_size), MYSQL_SYSVAR(log_group_home_dir), MYSQL_SYSVAR(max_dirty_pages_pct), @@ -19776,12 +19754,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { #ifdef HAVE_LIBNUMA MYSQL_SYSVAR(numa_interleave), #endif /* HAVE_LIBNUMA */ - MYSQL_SYSVAR(change_buffering), - MYSQL_SYSVAR(change_buffer_max_size), -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG - MYSQL_SYSVAR(change_buffer_dump), - MYSQL_SYSVAR(change_buffering_debug), -#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ MYSQL_SYSVAR(random_read_ahead), MYSQL_SYSVAR(read_ahead_threshold), MYSQL_SYSVAR(read_only), diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 91c1ff53d2d3b..d0f1aa9c34252 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2154,8 +2154,7 @@ static bool innobase_table_is_empty(const dict_table_t *table, } next_page= false; - block= btr_block_get(*clust_index, next_page_no, BTR_SEARCH_LEAF, false, - &mtr); + block= btr_block_get(*clust_index, next_page_no, BTR_SEARCH_LEAF, &mtr); if (!block) goto non_empty; page_cur_set_before_first(block, cur); @@ -10220,6 +10219,7 @@ commit_try_rebuild( /* We must be still holding a table handle. */ DBUG_ASSERT(user_table->get_ref_count() == 1); + rebuilt_table->row_id = uint64_t{user_table->row_id}; DBUG_EXECUTE_IF("ib_rebuild_cannot_rename", error = DB_ERROR;); switch (error) { diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 9510a4a8bfcfd..2a26f4f5ac26c 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2022, MariaDB Corporation. +Copyright (c) 2014, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -39,7 +39,6 @@ Created July 18, 2007 Vasil Dimov #include "dict0load.h" #include "buf0buddy.h" #include "buf0buf.h" -#include "ibuf0ibuf.h" #include "dict0mem.h" #include "dict0types.h" #include "srv0start.h" @@ -80,10 +79,7 @@ in i_s_page_type[] array */ /** R-tree index page */ #define I_S_PAGE_TYPE_RTREE (FIL_PAGE_TYPE_LAST + 1) -/** Change buffer B-tree page */ -#define I_S_PAGE_TYPE_IBUF (FIL_PAGE_TYPE_LAST + 2) - -#define I_S_PAGE_TYPE_LAST I_S_PAGE_TYPE_IBUF +#define I_S_PAGE_TYPE_LAST I_S_PAGE_TYPE_RTREE #define I_S_PAGE_TYPE_BITS 4 @@ -104,9 +100,6 @@ static buf_page_desc_t i_s_page_type[] = { {"COMPRESSED_BLOB2", FIL_PAGE_TYPE_ZBLOB2}, {"UNKNOWN", I_S_PAGE_TYPE_UNKNOWN}, {"RTREE_INDEX", I_S_PAGE_TYPE_RTREE}, - {"IBUF_INDEX", I_S_PAGE_TYPE_IBUF}, - {"PAGE COMPRESSED", FIL_PAGE_PAGE_COMPRESSED}, - {"PAGE COMPRESSED AND ENCRYPTED", FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED}, }; /** This structure defines information we will fetch from pages @@ -3776,17 +3769,17 @@ i_s_innodb_buffer_page_fill( OK(fields[IDX_BUFFER_PAGE_STATE]->store( std::min(3, page_info->state) + 1, true)); - static_assert(buf_page_t::UNFIXED == 1U << 29, "comp."); + static_assert(buf_page_t::UNFIXED == 2U << 29, "comp."); static_assert(buf_page_t::READ_FIX == 4U << 29, "comp."); - static_assert(buf_page_t::WRITE_FIX == 5U << 29, "comp."); + static_assert(buf_page_t::WRITE_FIX == 6U << 29, "comp."); unsigned io_fix = page_info->state >> 29; if (io_fix < 4) { io_fix = 1; - } else if (io_fix > 5) { - io_fix = 3; + } else if (io_fix == 4) { + io_fix = 2; } else { - io_fix -= 2; + io_fix = 3; } OK(fields[IDX_BUFFER_PAGE_IO_FIX]->store(io_fix, true)); @@ -3824,14 +3817,9 @@ i_s_innodb_set_page_type( their values are defined as 17855 and 17854, so we cannot use them to index into i_s_page_type[] array, its array index in the i_s_page_type[] array is I_S_PAGE_TYPE_INDEX - (1) for index pages or I_S_PAGE_TYPE_IBUF for - change buffer index pages */ + (1) for index pages */ if (page_type == FIL_PAGE_RTREE) { page_info->page_type = I_S_PAGE_TYPE_RTREE; - } else if (page_info->index_id - == static_cast(DICT_IBUF_ID_MIN - + IBUF_SPACE_ID)) { - page_info->page_type = I_S_PAGE_TYPE_IBUF; } else { ut_ad(page_type == FIL_PAGE_INDEX || page_type == FIL_PAGE_TYPE_INSTANT); @@ -3876,9 +3864,9 @@ i_s_innodb_buffer_page_get_info( static_assert(buf_page_t::NOT_USED == 0, "compatibility"); static_assert(buf_page_t::MEMORY == 1, "compatibility"); static_assert(buf_page_t::REMOVE_HASH == 2, "compatibility"); - static_assert(buf_page_t::UNFIXED == 1U << 29, "compatibility"); + static_assert(buf_page_t::UNFIXED == 2U << 29, "compatibility"); static_assert(buf_page_t::READ_FIX == 4U << 29, "compatibility"); - static_assert(buf_page_t::WRITE_FIX == 5U << 29, "compatibility"); + static_assert(buf_page_t::WRITE_FIX == 6U << 29, "compatibility"); page_info->state = bpage->state(); @@ -4268,17 +4256,17 @@ i_s_innodb_buf_page_lru_fill( OK(fields[IDX_BUF_LRU_PAGE_STATE]->store( page_info->compressed_only, true)); - static_assert(buf_page_t::UNFIXED == 1U << 29, "comp."); + static_assert(buf_page_t::UNFIXED == 2U << 29, "comp."); static_assert(buf_page_t::READ_FIX == 4U << 29, "comp."); - static_assert(buf_page_t::WRITE_FIX == 5U << 29, "comp."); + static_assert(buf_page_t::WRITE_FIX == 6U << 29, "comp."); unsigned io_fix = page_info->state >> 29; if (io_fix < 4) { io_fix = 1; - } else if (io_fix > 5) { - io_fix = 3; + } else if (io_fix == 4) { + io_fix = 2; } else { - io_fix -= 2; + io_fix = 3; } OK(fields[IDX_BUF_LRU_PAGE_IO_FIX]->store(io_fix, true)); diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 2512232c7ca64..dcee5a7b0ef8d 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2022, MariaDB Corporation. +Copyright (c) 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -17,3583 +17,283 @@ this program; if not, write to the Free Software Foundation, Inc., *****************************************************************************/ -/**************************************************//** +/** @file ibuf/ibuf0ibuf.cc -Insert buffer - -Created 7/19/1997 Heikki Tuuri -*******************************************************/ +Upgrade and removal of the InnoDB change buffer +*/ #include "ibuf0ibuf.h" #include "btr0sea.h" - -/** Number of bits describing a single page */ -#define IBUF_BITS_PER_PAGE 4 -/** The start address for an insert buffer bitmap page bitmap */ -#define IBUF_BITMAP PAGE_DATA - -#include "buf0buf.h" -#include "buf0rea.h" -#include "fsp0fsp.h" -#include "trx0sys.h" -#include "fil0fil.h" -#include "rem0rec.h" -#include "btr0cur.h" #include "btr0pcur.h" -#include "btr0btr.h" #include "row0upd.h" -#include "dict0boot.h" -#include "fut0lst.h" -#include "lock0lock.h" -#include "log0recv.h" -#include "que0que.h" -#include "srv0start.h" /* srv_shutdown_state */ -#include "rem0cmp.h" +#include "my_service_manager.h" #include "log.h" -/* STRUCTURE OF AN INSERT BUFFER RECORD +/** Possible operations buffered in the change buffer. */ +enum ibuf_op +{ + IBUF_OP_INSERT= 0, + IBUF_OP_DELETE_MARK= 1, + IBUF_OP_DELETE= 2, +}; + +constexpr const page_id_t ibuf_root{0, FSP_IBUF_TREE_ROOT_PAGE_NO}; +constexpr const page_id_t ibuf_header{0, FSP_IBUF_HEADER_PAGE_NO}; +constexpr const index_id_t ibuf_index_id{0xFFFFFFFF00000000ULL}; -In versions < 4.1.x: +/* Format of the change buffer records: + +MySQL 3.23 and MySQL 4.0 (not supported since MySQL 5.6.5 and MariaDB 10.0.11): 1. The first field is the page number. 2. The second field is an array which stores type info for each subsequent - field. We store the information which affects the ordering of records, and + field (4 bytes per column). + We store the information which affects the ordering of records, and also the physical storage size of an SQL NULL value. E.g., for CHAR(10) it is 10 bytes. 3. Next we have the fields of the actual index record. -In versions >= 4.1.x: - -Note that contary to what we planned in the 1990's, there will only be one -insert buffer tree, and that is in the system tablespace of InnoDB. +MySQL 4.1: 1. The first field is the space id. 2. The second field is a one-byte marker (0) which differentiates records from the < 4.1.x storage format. 3. The third field is the page number. -4. The fourth field contains the type info, where we have also added 2 bytes to - store the charset. In the compressed table format of 5.0.x we must add more - information here so that we can build a dummy 'index' struct which 5.0.x - can use in the binary search on the index page in the ibuf merge phase. +4. The fourth field contains the type info + (6 bytes per index field, 16-bit collation information added). + Unless ROW_FORMAT=REDUNDANT, we add more metadata here so that + we can access records in the index page. 5. The rest of the fields contain the fields of the actual index record. -In versions >= 5.0.3: +MySQL 5.0 (starting with MySQL 5.0.3) and MySQL 5.1: The first byte of the fourth field is an additional marker (0) if the record -is in the compact format. The presence of this marker can be detected by -looking at the length of the field modulo DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE. +is not in ROW_FORMAT=REDUNDANT. The presence of this marker can be detected by +looking at the length of the field modulo 6. The high-order bit of the character set field in the type info is the "nullable" flag for the field. -In versions >= 5.5: +MySQL 5.5 and MariaDB 5.5 and later: -The optional marker byte at the start of the fourth field is replaced by -mandatory 3 fields, totaling 4 bytes: +Unless innodb_change_buffering=inserts, the optional marker byte at +the start of the fourth field may be replaced by mandatory 3 fields, +comprising 4 bytes: 1. 2 bytes: Counter field, used to sort records within a (space id, page no) in the order they were added. This is needed so that for example the sequence of operations "INSERT x, DEL MARK x, INSERT x" is handled correctly. - 2. 1 byte: Operation type (see ibuf_op_t). + 2. 1 byte: Operation type (see ibuf_op). - 3. 1 byte: Flags. Currently only one flag exists, IBUF_REC_COMPACT. - -To ensure older records, which do not have counters to enforce correct -sorting, are merged before any new records, ibuf_insert checks if we're -trying to insert to a position that contains old-style records, and if so, -refuses the insert. Thus, ibuf pages are gradually converted to the new -format as their corresponding buffer pool pages are read into memory. + 3. 1 byte: 0=ROW_FORMAT=REDUNDANT, 1=other */ - -/* PREVENTING DEADLOCKS IN THE INSERT BUFFER SYSTEM - -If an OS thread performs any operation that brings in disk pages from -non-system tablespaces into the buffer pool, or creates such a page there, -then the operation may have as a side effect an insert buffer index tree -compression. Thus, the tree latch of the insert buffer tree may be acquired -in the x-mode, and also the file space latch of the system tablespace may -be acquired in the x-mode. - -Also, an insert to an index in a non-system tablespace can have the same -effect. How do we know this cannot lead to a deadlock of OS threads? There -is a problem with the i\o-handler threads: they break the latching order -because they own x-latches to pages which are on a lower level than the -insert buffer tree latch, its page latches, and the tablespace latch an -insert buffer operation can reserve. - -The solution is the following: Let all the tree and page latches connected -with the insert buffer be later in the latching order than the fsp latch and -fsp page latches. - -Insert buffer pages must be such that the insert buffer is never invoked -when these pages are accessed as this would result in a recursion violating -the latching order. We let a special i/o-handler thread take care of i/o to -the insert buffer pages and the ibuf bitmap pages, as well as the fsp bitmap -pages and the first inode page, which contains the inode of the ibuf tree: let -us call all these ibuf pages. To prevent deadlocks, we do not let a read-ahead -access both non-ibuf and ibuf pages. - -Then an i/o-handler for the insert buffer never needs to access recursively the -insert buffer tree and thus obeys the latching order. On the other hand, other -i/o-handlers for other tablespaces may require access to the insert buffer, -but because all kinds of latches they need to access there are later in the -latching order, no violation of the latching order occurs in this case, -either. - -A problem is how to grow and contract an insert buffer tree. As it is later -in the latching order than the fsp management, we have to reserve the fsp -latch first, before adding or removing pages from the insert buffer tree. -We let the insert buffer tree have its own file space management: a free -list of pages linked to the tree root. To prevent recursive using of the -insert buffer when adding pages to the tree, we must first load these pages -to memory, obtaining a latch on them, and only after that add them to the -free list of the insert buffer tree. More difficult is removing of pages -from the free list. If there is an excess of pages in the free list of the -ibuf tree, they might be needed if some thread reserves the fsp latch, -intending to allocate more file space. So we do the following: if a thread -reserves the fsp latch, we check the writer count field of the latch. If -this field has value 1, it means that the thread did not own the latch -before entering the fsp system, and the mtr of the thread contains no -modifications to the fsp pages. Now we are free to reserve the ibuf latch, -and check if there is an excess of pages in the free list. We can then, in a -separate mini-transaction, take them out of the free list and free them to -the fsp system. - -To avoid deadlocks in the ibuf system, we divide file pages into three levels: - -(1) non-ibuf pages, -(2) ibuf tree pages and the pages in the ibuf tree free list, and -(3) ibuf bitmap pages. - -No OS thread is allowed to access higher level pages if it has latches to -lower level pages; even if the thread owns a B-tree latch it must not access -the B-tree non-leaf pages if it has latches on lower level pages. Read-ahead -is only allowed for level 1 and 2 pages. Dedicated i/o-handler threads handle -exclusively level 1 i/o. A dedicated i/o handler thread handles exclusively -level 2 i/o. However, if an OS thread does the i/o handling for itself, i.e., -it uses synchronous aio, it can access any pages, as long as it obeys the -access order rules. */ - -/** Operations that can currently be buffered. */ -ulong innodb_change_buffering; - -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG -/** Dump the change buffer at startup */ -my_bool ibuf_dump; -/** Flag to control insert buffer debugging. */ -uint ibuf_debug; -#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - -/** The insert buffer control structure */ -ibuf_t ibuf; - -/** @name Offsets to the per-page bits in the insert buffer bitmap */ -/* @{ */ -#define IBUF_BITMAP_FREE 0 /*!< Bits indicating the - amount of free space */ -#define IBUF_BITMAP_BUFFERED 2 /*!< TRUE if there are buffered - changes for the page */ -#define IBUF_BITMAP_IBUF 3 /*!< TRUE if page is a part of - the ibuf tree, excluding the - root page, or is in the free - list of the ibuf */ -/* @} */ - -#define IBUF_REC_FIELD_SPACE 0 /*!< in the pre-4.1 format, - the page number. later, the space_id */ -#define IBUF_REC_FIELD_MARKER 1 /*!< starting with 4.1, a marker - consisting of 1 byte that is 0 */ -#define IBUF_REC_FIELD_PAGE 2 /*!< starting with 4.1, the - page number */ -#define IBUF_REC_FIELD_METADATA 3 /* the metadata field */ -#define IBUF_REC_FIELD_USER 4 /* first user field */ - -/* Various constants for checking the type of an ibuf record and extracting -data from it. For details, see the description of the record format at the -top of this file. */ - -/** @name Format of the IBUF_REC_FIELD_METADATA of an insert buffer record -The fourth column in the MySQL 5.5 format contains an operation -type, counter, and some flags. */ -/* @{ */ -#define IBUF_REC_INFO_SIZE 4 /*!< Combined size of info fields at - the beginning of the fourth field */ - -/* Offsets for the fields at the beginning of the fourth field */ -#define IBUF_REC_OFFSET_COUNTER 0 /*!< Operation counter */ -#define IBUF_REC_OFFSET_TYPE 2 /*!< Type of operation */ -#define IBUF_REC_OFFSET_FLAGS 3 /*!< Additional flags */ - -/* Record flag masks */ -#define IBUF_REC_COMPACT 0x1 /*!< Set in - IBUF_REC_OFFSET_FLAGS if the - user index is in COMPACT - format or later */ - - -#ifndef SAFE_MUTEX -static -#endif /* SAFE_MUTEX */ -/** The mutex protecting the insert buffer */ -mysql_mutex_t ibuf_mutex, - /** The mutex covering pessimistic inserts into the change buffer */ - ibuf_pessimistic_insert_mutex; - -/** The area in pages from which contract looks for page numbers for merge */ -const ulint IBUF_MERGE_AREA = 8; - -/** Inside the merge area, pages which have at most 1 per this number less -buffered entries compared to maximum volume that can buffered for a single -page are merged along with the page whose buffer became full */ -const ulint IBUF_MERGE_THRESHOLD = 4; - -/** In ibuf_contract at most this number of pages is read to memory in one -batch, in order to merge the entries for them in the insert buffer */ -const ulint IBUF_MAX_N_PAGES_MERGED = IBUF_MERGE_AREA; - -/** If the combined size of the ibuf trees exceeds ibuf.max_size by -this many pages, we start to contract it synchronous contract, but do -not insert */ -const ulint IBUF_CONTRACT_DO_NOT_INSERT = 10; - -/* TODO: how to cope with drop table if there are records in the insert -buffer for the indexes of the table? Is there actually any problem, -because ibuf merge is done to a page when it is read in, and it is -still physically like the index page even if the index would have been -dropped! So, there seems to be no problem. */ - -/******************************************************************//** -Sets the flag in the current mini-transaction record indicating we're -inside an insert buffer routine. */ -UNIV_INLINE -void -ibuf_enter( -/*=======*/ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - ut_ad(!mtr->is_inside_ibuf()); - mtr->enter_ibuf(); -} - -/******************************************************************//** -Sets the flag in the current mini-transaction record indicating we're -exiting an insert buffer routine. */ -UNIV_INLINE -void -ibuf_exit( -/*======*/ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - ut_ad(mtr->is_inside_ibuf()); - mtr->exit_ibuf(); -} - -/**************************************************************//** -Commits an insert buffer mini-transaction and sets the persistent -cursor latch mode to BTR_NO_LATCHES, that is, detaches the cursor. */ -UNIV_INLINE -void -ibuf_btr_pcur_commit_specify_mtr( -/*=============================*/ - btr_pcur_t* pcur, /*!< in/out: persistent cursor */ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - ut_d(ibuf_exit(mtr)); - btr_pcur_commit_specify_mtr(pcur, mtr); -} - -/******************************************************************//** -Gets the ibuf header page and x-latches it. -@return insert buffer header page */ -static -page_t* -ibuf_header_page_get( -/*=================*/ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - ut_ad(!ibuf_inside(mtr)); - - buf_block_t* block = buf_page_get( - page_id_t(IBUF_SPACE_ID, FSP_IBUF_HEADER_PAGE_NO), - 0, RW_X_LATCH, mtr); - - return block ? block->page.frame : nullptr; -} - -/** Acquire the change buffer root page. -@param[in,out] mtr mini-transaction -@return change buffer root page, SX-latched */ -static buf_block_t *ibuf_tree_root_get(mtr_t *mtr, dberr_t *err= nullptr) -{ - ut_ad(ibuf_inside(mtr)); - mysql_mutex_assert_owner(&ibuf_mutex); - - mtr_sx_lock_index(ibuf.index, mtr); - - buf_block_t *block= - buf_page_get_gen(page_id_t{IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO}, - 0, RW_SX_LATCH, nullptr, BUF_GET, mtr, err); - ut_ad(!block || ibuf.empty == page_is_empty(block->page.frame)); - return block; -} - -/******************************************************************//** -Closes insert buffer and frees the data structures. */ -void -ibuf_close(void) -/*============*/ -{ - if (!ibuf.index) { - return; - } - - mysql_mutex_destroy(&ibuf_pessimistic_insert_mutex); - mysql_mutex_destroy(&ibuf_mutex); - - dict_table_t* ibuf_table = ibuf.index->table; - ibuf.index->lock.free(); - dict_mem_index_free(ibuf.index); - dict_mem_table_free(ibuf_table); - ibuf.index = NULL; -} - -/******************************************************************//** -Updates the size information of the ibuf, assuming the segment size has not -changed. */ -static -void -ibuf_size_update( -/*=============*/ - const page_t* root) /*!< in: ibuf tree root */ -{ - mysql_mutex_assert_owner(&ibuf_mutex); - - ibuf.free_list_len = flst_get_len(root + PAGE_HEADER - + PAGE_BTR_IBUF_FREE_LIST); - - ibuf.height = 1 + btr_page_get_level(root); - - /* the '1 +' is the ibuf header page */ - ibuf.size = ibuf.seg_size - (1 + ibuf.free_list_len); -} - -/******************************************************************//** -Creates the insert buffer data structure at a database startup and initializes -the data structures for the insert buffer. -@return DB_SUCCESS or failure */ -dberr_t -ibuf_init_at_db_start(void) -/*=======================*/ -{ - page_t* root; - - ut_ad(!ibuf.index); - mtr_t mtr; - mtr.start(); - compile_time_assert(IBUF_SPACE_ID == TRX_SYS_SPACE); - compile_time_assert(IBUF_SPACE_ID == 0); - mtr.x_lock_space(fil_system.sys_space); - dberr_t err; - buf_block_t* header_page = buf_page_get_gen( - page_id_t(IBUF_SPACE_ID, FSP_IBUF_HEADER_PAGE_NO), - 0, RW_X_LATCH, nullptr, BUF_GET, &mtr, &err); - - if (!header_page) { -err_exit: - sql_print_error("InnoDB: The change buffer is corrupted"); - mtr.commit(); - return err; - } - - fseg_n_reserved_pages(*header_page, - IBUF_HEADER + IBUF_TREE_SEG_HEADER - + header_page->page.frame, &ibuf.seg_size, &mtr); - - do { - DBUG_EXECUTE_IF("intermittent_read_failure", continue;); - ut_ad(ibuf.seg_size >= 2); - } while (0); - - if (buf_block_t* block = - buf_page_get_gen(page_id_t(IBUF_SPACE_ID, - FSP_IBUF_TREE_ROOT_PAGE_NO), - 0, RW_X_LATCH, nullptr, BUF_GET, &mtr, &err)) { - root = buf_block_get_frame(block); - } else { - goto err_exit; - } - - if (page_is_comp(root) || fil_page_get_type(root) != FIL_PAGE_INDEX - || btr_page_get_index_id(root) != DICT_IBUF_ID_MIN) { - err = DB_CORRUPTION; - goto err_exit; - } - - /* At startup we intialize ibuf to have a maximum of - CHANGE_BUFFER_DEFAULT_SIZE in terms of percentage of the - buffer pool size. Once ibuf struct is initialized this - value is updated with the user supplied size by calling - ibuf_max_size_update(). */ - ibuf.max_size = ((buf_pool_get_curr_size() >> srv_page_size_shift) - * CHANGE_BUFFER_DEFAULT_SIZE) / 100; - - mysql_mutex_init(ibuf_mutex_key, &ibuf_mutex, nullptr); - mysql_mutex_init(ibuf_pessimistic_insert_mutex_key, - &ibuf_pessimistic_insert_mutex, nullptr); - - mysql_mutex_lock(&ibuf_mutex); - ibuf_size_update(root); - mysql_mutex_unlock(&ibuf_mutex); - - ibuf.empty = page_is_empty(root); - mtr.commit(); - - ibuf.index = dict_mem_index_create( - dict_table_t::create( - {C_STRING_WITH_LEN("innodb_change_buffer")}, - fil_system.sys_space, 1, 0, 0, 0), - "CLUST_IND", - DICT_CLUSTERED | DICT_IBUF, 1); - ibuf.index->id = DICT_IBUF_ID_MIN + IBUF_SPACE_ID; - ibuf.index->n_uniq = REC_MAX_N_FIELDS; - ibuf.index->lock.SRW_LOCK_INIT(index_tree_rw_lock_key); -#ifdef BTR_CUR_ADAPT - ibuf.index->search_info = btr_search_info_create(ibuf.index->heap); -#endif /* BTR_CUR_ADAPT */ - ibuf.index->page = FSP_IBUF_TREE_ROOT_PAGE_NO; - ut_d(ibuf.index->cached = TRUE); - -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG - if (!ibuf_dump) { - return DB_SUCCESS; - } - ib::info() << "Dumping the change buffer"; - ibuf_mtr_start(&mtr); - btr_pcur_t pcur; - if (DB_SUCCESS - == pcur.open_leaf(true, ibuf.index, BTR_SEARCH_LEAF, &mtr)) { - while (btr_pcur_move_to_next_user_rec(&pcur, &mtr)) { - rec_print_old(stderr, btr_pcur_get_rec(&pcur)); - } - } - ibuf_mtr_commit(&mtr); - ib::info() << "Dumped the change buffer"; -#endif - - return DB_SUCCESS; -} - -/*********************************************************************//** -Updates the max_size value for ibuf. */ -void -ibuf_max_size_update( -/*=================*/ - ulint new_val) /*!< in: new value in terms of - percentage of the buffer pool size */ -{ - if (UNIV_UNLIKELY(!ibuf.index)) return; - ulint new_size = ((buf_pool_get_curr_size() >> srv_page_size_shift) - * new_val) / 100; - mysql_mutex_lock(&ibuf_mutex); - ibuf.max_size = new_size; - mysql_mutex_unlock(&ibuf_mutex); -} - -# ifdef UNIV_DEBUG -/** Gets the desired bits for a given page from a bitmap page. -@param[in] page bitmap page -@param[in] page_id page id whose bits to get -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] bit IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... -@param[in,out] mtr mini-transaction holding an x-latch on the -bitmap page -@return value of bits */ -# define ibuf_bitmap_page_get_bits(page, page_id, zip_size, bit, mtr) \ - ibuf_bitmap_page_get_bits_low(page, page_id, zip_size, \ - MTR_MEMO_PAGE_X_FIX, mtr, bit) -# else /* UNIV_DEBUG */ -/** Gets the desired bits for a given page from a bitmap page. -@param[in] page bitmap page -@param[in] page_id page id whose bits to get -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] bit IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... -@param[in,out] mtr mini-transaction holding an x-latch on the -bitmap page -@return value of bits */ -# define ibuf_bitmap_page_get_bits(page, page_id, zip_size, bit, mtr) \ - ibuf_bitmap_page_get_bits_low(page, page_id, zip_size, bit) -# endif /* UNIV_DEBUG */ - -/** Gets the desired bits for a given page from a bitmap page. -@param[in] page bitmap page -@param[in] page_id page id whose bits to get -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] latch_type MTR_MEMO_PAGE_X_FIX, MTR_MEMO_BUF_FIX, ... -@param[in,out] mtr mini-transaction holding latch_type on the -bitmap page -@param[in] bit IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... -@return value of bits */ -UNIV_INLINE -ulint -ibuf_bitmap_page_get_bits_low( - const page_t* page, - const page_id_t page_id, - ulint zip_size, -#ifdef UNIV_DEBUG - ulint latch_type, - mtr_t* mtr, -#endif /* UNIV_DEBUG */ - ulint bit) -{ - ulint byte_offset; - ulint bit_offset; - ulint map_byte; - ulint value; - const ulint size = zip_size ? zip_size : srv_page_size; - - ut_ad(ut_is_2pow(zip_size)); - ut_ad(bit < IBUF_BITS_PER_PAGE); - compile_time_assert(!(IBUF_BITS_PER_PAGE % 2)); - ut_ad(mtr->memo_contains_page_flagged(page, latch_type)); - - bit_offset = (page_id.page_no() & (size - 1)) - * IBUF_BITS_PER_PAGE + bit; - - byte_offset = bit_offset / 8; - bit_offset = bit_offset % 8; - - ut_ad(byte_offset + IBUF_BITMAP < srv_page_size); - - map_byte = mach_read_from_1(page + IBUF_BITMAP + byte_offset); - - value = ut_bit_get_nth(map_byte, bit_offset); - - if (bit == IBUF_BITMAP_FREE) { - ut_ad(bit_offset + 1 < 8); - - value = value * 2 + ut_bit_get_nth(map_byte, bit_offset + 1); - } - - return(value); -} - -/** Sets the desired bit for a given page in a bitmap page. -@tparam bit IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... -@param[in,out] block bitmap page -@param[in] page_id page id whose bits to set -@param[in] physical_size page size -@param[in] val value to set -@param[in,out] mtr mtr containing an x-latch to the bitmap page */ -template -static void -ibuf_bitmap_page_set_bits( - buf_block_t* block, - const page_id_t page_id, - ulint physical_size, - ulint val, - mtr_t* mtr) -{ - ulint byte_offset; - ulint bit_offset; - - static_assert(bit < IBUF_BITS_PER_PAGE, "wrong bit"); - compile_time_assert(!(IBUF_BITS_PER_PAGE % 2)); - ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); - ut_ad(mtr->is_named_space(page_id.space())); - - bit_offset = (page_id.page_no() % physical_size) - * IBUF_BITS_PER_PAGE + bit; - - byte_offset = bit_offset / 8; - bit_offset = bit_offset % 8; - - ut_ad(byte_offset + IBUF_BITMAP < srv_page_size); - - byte* map_byte = &block->page.frame[IBUF_BITMAP + byte_offset]; - byte b = *map_byte; - - if (bit == IBUF_BITMAP_FREE) { - ut_ad(bit_offset + 1 < 8); - ut_ad(val <= 3); - b &= static_cast(~(3U << bit_offset)); - b |= static_cast(((val & 2) >> 1) << bit_offset - | (val & 1) << (bit_offset + 1)); - } else { - ut_ad(val <= 1); - b &= static_cast(~(1U << bit_offset)); -#if defined __GNUC__ && !defined __clang__ && __GNUC__ < 6 -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wconversion" /* GCC 5 may need this here */ -#endif - b |= static_cast(val << bit_offset); -#if defined __GNUC__ && !defined __clang__ && __GNUC__ < 6 -# pragma GCC diagnostic pop -#endif - } - - mtr->write<1,mtr_t::MAYBE_NOP>(*block, map_byte, b); -} - -/** Calculates the bitmap page number for a given page number. -@param[in] page_id page id -@param[in] size page size -@return the bitmap page id where the file page is mapped */ -inline page_id_t ibuf_bitmap_page_no_calc(const page_id_t page_id, ulint size) -{ - if (!size) - size= srv_page_size; - - return page_id_t(page_id.space(), FSP_IBUF_BITMAP_OFFSET - + uint32_t(page_id.page_no() & ~(size - 1))); -} - -/** Gets the ibuf bitmap page where the bits describing a given file page are -stored. -@param[in] page_id page id of the file page -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in,out] mtr mini-transaction -@return bitmap page where the file page is mapped, that is, the bitmap -page containing the descriptor bits for the file page; the bitmap page -is x-latched */ -static -buf_block_t* -ibuf_bitmap_get_map_page( - const page_id_t page_id, - ulint zip_size, - mtr_t* mtr) -{ - return buf_page_get_gen(ibuf_bitmap_page_no_calc(page_id, zip_size), - zip_size, RW_X_LATCH, nullptr, - BUF_GET_POSSIBLY_FREED, mtr); -} - -/************************************************************************//** -Sets the free bits of the page in the ibuf bitmap. This is done in a separate -mini-transaction, hence this operation does not restrict further work to only -ibuf bitmap operations, which would result if the latch to the bitmap page -were kept. */ -UNIV_INLINE -void -ibuf_set_free_bits_low( -/*===================*/ - const buf_block_t* block, /*!< in: index page; free bits are set if - the index is non-clustered and page - level is 0 */ - ulint val, /*!< in: value to set: < 4 */ - mtr_t* mtr) /*!< in/out: mtr */ -{ - ut_ad(mtr->is_named_space(block->page.id().space())); - if (!page_is_leaf(block->page.frame)) { - return; - } - -#ifdef UNIV_IBUF_DEBUG - ut_a(val <= ibuf_index_page_calc_free(block)); -#endif /* UNIV_IBUF_DEBUG */ - const page_id_t id(block->page.id()); - - if (buf_block_t* bitmap_page = ibuf_bitmap_get_map_page( - id, block->zip_size(), mtr)) { - ibuf_bitmap_page_set_bits( - bitmap_page, id, block->physical_size(), - val, mtr); - } -} - -/************************************************************************//** -Sets the free bit of the page in the ibuf bitmap. This is done in a separate -mini-transaction, hence this operation does not restrict further work to only -ibuf bitmap operations, which would result if the latch to the bitmap page -were kept. */ -void -ibuf_set_free_bits_func( -/*====================*/ - buf_block_t* block, /*!< in: index page of a non-clustered index; - free bit is reset if page level is 0 */ -#ifdef UNIV_IBUF_DEBUG - ulint max_val,/*!< in: ULINT_UNDEFINED or a maximum - value which the bits must have before - setting; this is for debugging */ -#endif /* UNIV_IBUF_DEBUG */ - ulint val) /*!< in: value to set: < 4 */ -{ - if (!page_is_leaf(block->page.frame)) - return; - - mtr_t mtr; - mtr.start(); - const page_id_t id(block->page.id()); - const fil_space_t *space= mtr.set_named_space_id(id.space()); - - if (buf_block_t *bitmap_page= - ibuf_bitmap_get_map_page(id, block->zip_size(), &mtr)) - { - if (space->purpose != FIL_TYPE_TABLESPACE) - mtr.set_log_mode(MTR_LOG_NO_REDO); - -#ifdef UNIV_IBUF_DEBUG - if (max_val != ULINT_UNDEFINED) - { - ulint old_val= ibuf_bitmap_page_get_bits(bitmap_page, id, - IBUF_BITMAP_FREE, &mtr); - ut_a(old_val <= max_val); - } - - ut_a(val <= ibuf_index_page_calc_free(block)); -#endif /* UNIV_IBUF_DEBUG */ - - ibuf_bitmap_page_set_bits - (bitmap_page, id, block->physical_size(), val, &mtr); - } - - mtr.commit(); -} - -/************************************************************************//** -Resets the free bits of the page in the ibuf bitmap. This is done in a -separate mini-transaction, hence this operation does not restrict -further work to only ibuf bitmap operations, which would result if the -latch to the bitmap page were kept. NOTE: The free bits in the insert -buffer bitmap must never exceed the free space on a page. It is safe -to decrement or reset the bits in the bitmap in a mini-transaction -that is committed before the mini-transaction that affects the free -space. */ -void -ibuf_reset_free_bits( -/*=================*/ - buf_block_t* block) /*!< in: index page; free bits are set to 0 - if the index is a non-clustered - non-unique, and page level is 0 */ -{ - ibuf_set_free_bits(block, 0, ULINT_UNDEFINED); -} - -/**********************************************************************//** -Updates the free bits for an uncompressed page to reflect the present -state. Does this in the mtr given, which means that the latching -order rules virtually prevent any further operations for this OS -thread until mtr is committed. NOTE: The free bits in the insert -buffer bitmap must never exceed the free space on a page. It is safe -to set the free bits in the same mini-transaction that updated the -page. */ -void -ibuf_update_free_bits_low( -/*======================*/ - const buf_block_t* block, /*!< in: index page */ - ulint max_ins_size, /*!< in: value of - maximum insert size - with reorganize before - the latest operation - performed to the page */ - mtr_t* mtr) /*!< in/out: mtr */ -{ - ulint before; - ulint after; - - ut_a(!is_buf_block_get_page_zip(block)); - ut_ad(mtr->is_named_space(block->page.id().space())); - - before = ibuf_index_page_calc_free_bits(srv_page_size, - max_ins_size); - - after = ibuf_index_page_calc_free(block); - - /* This approach cannot be used on compressed pages, since the - computed value of "before" often does not match the current - state of the bitmap. This is because the free space may - increase or decrease when a compressed page is reorganized. */ - if (before != after) { - ibuf_set_free_bits_low(block, after, mtr); - } -} - -/**********************************************************************//** -Updates the free bits for a compressed page to reflect the present -state. Does this in the mtr given, which means that the latching -order rules virtually prevent any further operations for this OS -thread until mtr is committed. NOTE: The free bits in the insert -buffer bitmap must never exceed the free space on a page. It is safe -to set the free bits in the same mini-transaction that updated the -page. */ -void -ibuf_update_free_bits_zip( -/*======================*/ - buf_block_t* block, /*!< in/out: index page */ - mtr_t* mtr) /*!< in/out: mtr */ -{ - ut_ad(page_is_leaf(block->page.frame)); - ut_ad(block->zip_size()); - - ulint after = ibuf_index_page_calc_free_zip(block); - - if (after == 0) { - /* We move the page to the front of the buffer pool LRU list: - the purpose of this is to prevent those pages to which we - cannot make inserts using the insert buffer from slipping - out of the buffer pool */ - - buf_page_make_young(&block->page); - } - - if (buf_block_t* bitmap_page = ibuf_bitmap_get_map_page( - block->page.id(), block->zip_size(), mtr)) { - - ibuf_bitmap_page_set_bits( - bitmap_page, block->page.id(), - block->physical_size(), after, mtr); - } -} - -/**********************************************************************//** -Updates the free bits for the two pages to reflect the present state. -Does this in the mtr given, which means that the latching order rules -virtually prevent any further operations until mtr is committed. -NOTE: The free bits in the insert buffer bitmap must never exceed the -free space on a page. It is safe to set the free bits in the same -mini-transaction that updated the pages. */ -void -ibuf_update_free_bits_for_two_pages_low( -/*====================================*/ - buf_block_t* block1, /*!< in: index page */ - buf_block_t* block2, /*!< in: index page */ - mtr_t* mtr) /*!< in: mtr */ -{ - ut_ad(mtr->is_named_space(block1->page.id().space())); - ut_ad(block1->page.id().space() == block2->page.id().space()); - - /* Avoid deadlocks by acquiring multiple bitmap page latches in - a consistent order (smaller pointer first). */ - if (block1 > block2) - std::swap(block1, block2); - - ibuf_set_free_bits_low(block1, ibuf_index_page_calc_free(block1), mtr); - ibuf_set_free_bits_low(block2, ibuf_index_page_calc_free(block2), mtr); -} - -/** Returns TRUE if the page is one of the fixed address ibuf pages. -@param[in] page_id page id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@return TRUE if a fixed address ibuf i/o page */ -inline bool ibuf_fixed_addr_page(const page_id_t page_id, ulint zip_size) -{ - return(page_id == page_id_t(IBUF_SPACE_ID, IBUF_TREE_ROOT_PAGE_NO) - || ibuf_bitmap_page(page_id, zip_size)); -} - -/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. -Must not be called when recv_no_ibuf_operations==true. -@param[in] page_id page id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] x_latch FALSE if relaxed check (avoid latching the -bitmap page) -@param[in,out] mtr mtr which will contain an x-latch to the -bitmap page if the page is not one of the fixed address ibuf pages, or NULL, -in which case a new transaction is created. -@return TRUE if level 2 or level 3 page */ -bool -ibuf_page_low( - const page_id_t page_id, - ulint zip_size, -#ifdef UNIV_DEBUG - bool x_latch, -#endif /* UNIV_DEBUG */ - mtr_t* mtr) -{ - ibool ret; - mtr_t local_mtr; - - ut_ad(!recv_no_ibuf_operations); - ut_ad(x_latch || mtr == NULL); - - if (ibuf_fixed_addr_page(page_id, zip_size)) { - return(true); - } else if (page_id.space() != IBUF_SPACE_ID) { - return(false); - } - - compile_time_assert(IBUF_SPACE_ID == 0); - ut_ad(fil_system.sys_space->purpose == FIL_TYPE_TABLESPACE); - -#ifdef UNIV_DEBUG - if (!x_latch) { - mtr_start(&local_mtr); - - /* Get the bitmap page without a page latch, so that - we will not be violating the latching order when - another bitmap page has already been latched by this - thread. The page will be buffer-fixed, and thus it - cannot be removed or relocated while we are looking at - it. The contents of the page could change, but the - IBUF_BITMAP_IBUF bit that we are interested in should - not be modified by any other thread. Nobody should be - calling ibuf_add_free_page() or ibuf_remove_free_page() - while the page is linked to the insert buffer b-tree. */ - buf_block_t* block = buf_page_get_gen( - ibuf_bitmap_page_no_calc(page_id, zip_size), - zip_size, RW_NO_LATCH, nullptr, BUF_GET, &local_mtr); - - ret = block - && ibuf_bitmap_page_get_bits_low( - block->page.frame, page_id, zip_size, - MTR_MEMO_BUF_FIX, &local_mtr, IBUF_BITMAP_IBUF); - - mtr_commit(&local_mtr); - return(ret); - } -#endif /* UNIV_DEBUG */ - - if (mtr == NULL) { - mtr = &local_mtr; - mtr_start(mtr); - } - - buf_block_t *block = ibuf_bitmap_get_map_page(page_id, zip_size, - mtr); - ret = block - && ibuf_bitmap_page_get_bits(block->page.frame, - page_id, zip_size, - IBUF_BITMAP_IBUF, mtr); - - if (mtr == &local_mtr) { - mtr_commit(mtr); - } - - return(ret); -} - -#ifdef UNIV_DEBUG -# define ibuf_rec_get_page_no(mtr,rec) ibuf_rec_get_page_no_func(mtr,rec) -#else /* UNIV_DEBUG */ -# define ibuf_rec_get_page_no(mtr,rec) ibuf_rec_get_page_no_func(rec) -#endif /* UNIV_DEBUG */ +/** first user record field */ +constexpr unsigned IBUF_REC_FIELD_USER= 4; /********************************************************************//** Returns the page number field of an ibuf record. @return page number */ -static -uint32_t -ibuf_rec_get_page_no_func( -/*======================*/ -#ifdef UNIV_DEBUG - mtr_t* mtr, /*!< in: mini-transaction owning rec */ -#endif /* UNIV_DEBUG */ - const rec_t* rec) /*!< in: ibuf record */ +static uint32_t ibuf_rec_get_page_no(const rec_t *rec) { - const byte* field; - ulint len; - - ut_ad(mtr->memo_contains_page_flagged(rec, MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_S_FIX)); - ut_ad(ibuf_inside(mtr)); - ut_ad(rec_get_n_fields_old(rec) > 2); - - field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_MARKER, &len); - - ut_a(len == 1); - - field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_PAGE, &len); - - ut_a(len == 4); - - return(mach_read_from_4(field)); + return mach_read_from_4(rec + 5); } -#ifdef UNIV_DEBUG -# define ibuf_rec_get_space(mtr,rec) ibuf_rec_get_space_func(mtr,rec) -#else /* UNIV_DEBUG */ -# define ibuf_rec_get_space(mtr,rec) ibuf_rec_get_space_func(rec) -#endif /* UNIV_DEBUG */ - /********************************************************************//** -Returns the space id field of an ibuf record. For < 4.1.x format records -returns 0. +Returns the space id field of an ibuf record. @return space id */ -static -uint32_t -ibuf_rec_get_space_func( -/*====================*/ -#ifdef UNIV_DEBUG - mtr_t* mtr, /*!< in: mini-transaction owning rec */ -#endif /* UNIV_DEBUG */ - const rec_t* rec) /*!< in: ibuf record */ +static uint32_t ibuf_rec_get_space(const rec_t *rec) { - const byte* field; - ulint len; - - ut_ad(mtr->memo_contains_page_flagged(rec, MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_S_FIX)); - ut_ad(ibuf_inside(mtr)); - ut_ad(rec_get_n_fields_old(rec) > 2); - - field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_MARKER, &len); - - ut_a(len == 1); - - field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_SPACE, &len); - - ut_a(len == 4); - - return(mach_read_from_4(field)); + return mach_read_from_4(rec); } -#ifdef UNIV_DEBUG -# define ibuf_rec_get_info(mtr,rec,op,comp,info_len,counter) \ - ibuf_rec_get_info_func(mtr,rec,op,comp,info_len,counter) -#else /* UNIV_DEBUG */ -# define ibuf_rec_get_info(mtr,rec,op,comp,info_len,counter) \ - ibuf_rec_get_info_func(rec,op,comp,info_len,counter) -#endif -/****************************************************************//** -Get various information about an ibuf record in >= 4.1.x format. */ +/********************************************************************//** +Add a column to the dummy index */ static void -ibuf_rec_get_info_func( -/*===================*/ -#ifdef UNIV_DEBUG - mtr_t* mtr, /*!< in: mini-transaction owning rec */ -#endif /* UNIV_DEBUG */ - const rec_t* rec, /*!< in: ibuf record */ - ibuf_op_t* op, /*!< out: operation type, or NULL */ - ibool* comp, /*!< out: compact flag, or NULL */ - ulint* info_len, /*!< out: length of info fields at the - start of the fourth field, or - NULL */ - ulint* counter) /*!< in: counter value, or NULL */ -{ - const byte* types; - ulint fields; - ulint len; - - /* Local variables to shadow arguments. */ - ibuf_op_t op_local; - ibool comp_local; - ulint info_len_local; - ulint counter_local; - - ut_ad(mtr->memo_contains_page_flagged(rec, MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_S_FIX)); - ut_ad(ibuf_inside(mtr)); - fields = rec_get_n_fields_old(rec); - ut_a(fields > IBUF_REC_FIELD_USER); - - types = rec_get_nth_field_old(rec, IBUF_REC_FIELD_METADATA, &len); - - info_len_local = len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE; - compile_time_assert(IBUF_REC_INFO_SIZE - < DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); - - switch (info_len_local) { - case 0: - case 1: - op_local = IBUF_OP_INSERT; - comp_local = info_len_local; - ut_ad(!counter); - counter_local = ULINT_UNDEFINED; - break; - - case IBUF_REC_INFO_SIZE: - op_local = (ibuf_op_t) types[IBUF_REC_OFFSET_TYPE]; - comp_local = types[IBUF_REC_OFFSET_FLAGS] & IBUF_REC_COMPACT; - counter_local = mach_read_from_2( - types + IBUF_REC_OFFSET_COUNTER); - break; - - default: - ut_error; - } - - ut_a(op_local < IBUF_OP_COUNT); - ut_a((len - info_len_local) == - (fields - IBUF_REC_FIELD_USER) - * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); - - if (op) { - *op = op_local; - } - - if (comp) { - *comp = comp_local; - } - - if (info_len) { - *info_len = info_len_local; - } - - if (counter) { - *counter = counter_local; - } -} - -#ifdef UNIV_DEBUG -# define ibuf_rec_get_op_type(mtr,rec) ibuf_rec_get_op_type_func(mtr,rec) -#else /* UNIV_DEBUG */ -# define ibuf_rec_get_op_type(mtr,rec) ibuf_rec_get_op_type_func(rec) -#endif - -/****************************************************************//** -Returns the operation type field of an ibuf record. -@return operation type */ -static -ibuf_op_t -ibuf_rec_get_op_type_func( -/*======================*/ -#ifdef UNIV_DEBUG - mtr_t* mtr, /*!< in: mini-transaction owning rec */ -#endif /* UNIV_DEBUG */ - const rec_t* rec) /*!< in: ibuf record */ -{ - ulint len; - - ut_ad(mtr->memo_contains_page_flagged(rec, MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_S_FIX)); - ut_ad(ibuf_inside(mtr)); - ut_ad(rec_get_n_fields_old(rec) > 2); - - (void) rec_get_nth_field_old(rec, IBUF_REC_FIELD_MARKER, &len); - - if (len > 1) { - /* This is a < 4.1.x format record */ - - return(IBUF_OP_INSERT); - } else { - ibuf_op_t op; - - ibuf_rec_get_info(mtr, rec, &op, NULL, NULL, NULL); - - return(op); - } -} - -/****************************************************************//** -Read the first two bytes from a record's fourth field (counter field in new -records; something else in older records). -@return "counter" field, or ULINT_UNDEFINED if for some reason it -can't be read */ -ulint -ibuf_rec_get_counter( -/*=================*/ - const rec_t* rec) /*!< in: ibuf record */ -{ - const byte* ptr; - ulint len; - - if (rec_get_n_fields_old(rec) <= IBUF_REC_FIELD_METADATA) { - - return(ULINT_UNDEFINED); - } - - ptr = rec_get_nth_field_old(rec, IBUF_REC_FIELD_METADATA, &len); - - if (len >= 2) { - - return(mach_read_from_2(ptr)); - } else { - - return(ULINT_UNDEFINED); - } -} - - -/** - Add accumulated operation counts to a permanent array. - Both arrays must be of size IBUF_OP_COUNT. -*/ -static void ibuf_add_ops(Atomic_counter *out, const ulint *in) -{ - for (auto i = 0; i < IBUF_OP_COUNT; i++) - out[i]+= in[i]; -} - - -/****************************************************************//** -Print operation counts. The array must be of size IBUF_OP_COUNT. */ -static -void -ibuf_print_ops( -/*===========*/ - const char* op_name,/*!< in: operation name */ - const Atomic_counter* ops, /*!< in: operation counts */ - FILE* file) /*!< in: file where to print */ -{ - static const char* op_names[] = { - "insert", - "delete mark", - "delete" - }; - - static_assert(array_elements(op_names) == IBUF_OP_COUNT, ""); - fputs(op_name, file); - - for (ulint i = 0; i < IBUF_OP_COUNT; i++) { - fprintf(file, "%s " ULINTPF "%s", op_names[i], - ulint{ops[i]}, (i < (IBUF_OP_COUNT - 1)) ? ", " : ""); - } - - putc('\n', file); -} - -/********************************************************************//** -Creates a dummy index for inserting a record to a non-clustered index. -@return dummy index */ -static -dict_index_t* -ibuf_dummy_index_create( -/*====================*/ - ulint n, /*!< in: number of fields */ - ibool comp) /*!< in: TRUE=use compact record format */ -{ - dict_table_t* table; - dict_index_t* index; - - table = dict_table_t::create({C_STRING_WITH_LEN("IBUF_DUMMY")}, - nullptr, n, 0, - comp ? DICT_TF_COMPACT : 0, 0); - - index = dict_mem_index_create(table, "IBUF_DUMMY", 0, n); - - /* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */ - index->cached = TRUE; - ut_d(index->is_dummy = true); - - return(index); -} -/********************************************************************//** -Add a column to the dummy index */ -static -void -ibuf_dummy_index_add_col( -/*=====================*/ - dict_index_t* index, /*!< in: dummy index */ - const dtype_t* type, /*!< in: the data type of the column */ - ulint len) /*!< in: length of the column */ +ibuf_dummy_index_add_col( +/*=====================*/ + dict_index_t* index, /*!< in: dummy index */ + const dtype_t* type, /*!< in: the data type of the column */ + ulint len) /*!< in: length of the column */ { ulint i = index->table->n_def; dict_mem_table_add_col(index->table, NULL, NULL, dtype_get_mtype(type), dtype_get_prtype(type), - dtype_get_len(type)); - dict_index_add_col(index, index->table, - dict_table_get_nth_col(index->table, i), len); -} -/********************************************************************//** -Deallocates a dummy index for inserting a record to a non-clustered index. */ -static -void -ibuf_dummy_index_free( -/*==================*/ - dict_index_t* index) /*!< in, own: dummy index */ -{ - dict_table_t* table = index->table; - - dict_mem_index_free(index); - dict_mem_table_free(table); -} - -#ifdef UNIV_DEBUG -# define ibuf_build_entry_from_ibuf_rec(mtr,ibuf_rec,heap,pindex) \ - ibuf_build_entry_from_ibuf_rec_func(mtr,ibuf_rec,heap,pindex) -#else /* UNIV_DEBUG */ -# define ibuf_build_entry_from_ibuf_rec(mtr,ibuf_rec,heap,pindex) \ - ibuf_build_entry_from_ibuf_rec_func(ibuf_rec,heap,pindex) -#endif - -/*********************************************************************//** -Builds the entry used to - -1) IBUF_OP_INSERT: insert into a non-clustered index - -2) IBUF_OP_DELETE_MARK: find the record whose delete-mark flag we need to - activate - -3) IBUF_OP_DELETE: find the record we need to delete - -when we have the corresponding record in an ibuf index. - -NOTE that as we copy pointers to fields in ibuf_rec, the caller must -hold a latch to the ibuf_rec page as long as the entry is used! - -@return own: entry to insert to a non-clustered index */ -static -dtuple_t* -ibuf_build_entry_from_ibuf_rec_func( -/*================================*/ -#ifdef UNIV_DEBUG - mtr_t* mtr, /*!< in: mini-transaction owning rec */ -#endif /* UNIV_DEBUG */ - const rec_t* ibuf_rec, /*!< in: record in an insert buffer */ - mem_heap_t* heap, /*!< in: heap where built */ - dict_index_t** pindex) /*!< out, own: dummy index that - describes the entry */ -{ - dtuple_t* tuple; - dfield_t* field; - ulint n_fields; - const byte* types; - const byte* data; - ulint len; - ulint info_len; - ulint i; - ulint comp; - dict_index_t* index; - - ut_ad(mtr->memo_contains_page_flagged(ibuf_rec, MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_S_FIX)); - ut_ad(ibuf_inside(mtr)); - - data = rec_get_nth_field_old(ibuf_rec, IBUF_REC_FIELD_MARKER, &len); - - ut_a(len == 1); - ut_a(*data == 0); - ut_a(rec_get_n_fields_old(ibuf_rec) > IBUF_REC_FIELD_USER); - - n_fields = rec_get_n_fields_old(ibuf_rec) - IBUF_REC_FIELD_USER; - - tuple = dtuple_create(heap, n_fields); - - types = rec_get_nth_field_old(ibuf_rec, IBUF_REC_FIELD_METADATA, &len); - - ibuf_rec_get_info(mtr, ibuf_rec, NULL, &comp, &info_len, NULL); - - index = ibuf_dummy_index_create(n_fields, comp); - - len -= info_len; - types += info_len; - - ut_a(len == n_fields * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); - - for (i = 0; i < n_fields; i++) { - field = dtuple_get_nth_field(tuple, i); - - data = rec_get_nth_field_old( - ibuf_rec, i + IBUF_REC_FIELD_USER, &len); - - dfield_set_data(field, data, len); - - dtype_new_read_for_order_and_null_size( - dfield_get_type(field), - types + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); - - ibuf_dummy_index_add_col(index, dfield_get_type(field), len); - } - - index->n_core_null_bytes = static_cast( - UT_BITS_IN_BYTES(unsigned(index->n_nullable))); - - /* Prevent an ut_ad() failure in page_zip_write_rec() by - adding system columns to the dummy table pointed to by the - dummy secondary index. The insert buffer is only used for - secondary indexes, whose records never contain any system - columns, such as DB_TRX_ID. */ - ut_d(dict_table_add_system_columns(index->table, index->table->heap)); - - *pindex = index; - - return(tuple); -} - -/******************************************************************//** -Get the data size. -@return size of fields */ -UNIV_INLINE -ulint -ibuf_rec_get_size( -/*==============*/ - const rec_t* rec, /*!< in: ibuf record */ - const byte* types, /*!< in: fields */ - ulint n_fields, /*!< in: number of fields */ - ulint comp) /*!< in: 0=ROW_FORMAT=REDUNDANT, - nonzero=ROW_FORMAT=COMPACT */ -{ - ulint i; - ulint field_offset; - ulint types_offset; - ulint size = 0; - - field_offset = IBUF_REC_FIELD_USER; - types_offset = DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE; - - for (i = 0; i < n_fields; i++) { - ulint len; - dtype_t dtype; - - rec_get_nth_field_offs_old(rec, i + field_offset, &len); - - if (len != UNIV_SQL_NULL) { - size += len; - } else { - dtype_new_read_for_order_and_null_size(&dtype, types); - - size += dtype_get_sql_null_size(&dtype, comp); - } - - types += types_offset; - } - - return(size); -} - -#ifdef UNIV_DEBUG -# define ibuf_rec_get_volume(mtr,rec) ibuf_rec_get_volume_func(mtr,rec) -#else /* UNIV_DEBUG */ -# define ibuf_rec_get_volume(mtr,rec) ibuf_rec_get_volume_func(rec) -#endif - -/********************************************************************//** -Returns the space taken by a stored non-clustered index entry if converted to -an index record. -@return size of index record in bytes + an upper limit of the space -taken in the page directory */ -static -ulint -ibuf_rec_get_volume_func( -/*=====================*/ -#ifdef UNIV_DEBUG - mtr_t* mtr, /*!< in: mini-transaction owning rec */ -#endif /* UNIV_DEBUG */ - const rec_t* ibuf_rec)/*!< in: ibuf record */ -{ - ulint len; - const byte* data; - const byte* types; - ulint n_fields; - ulint data_size; - ulint comp; - ibuf_op_t op; - ulint info_len; - - ut_ad(mtr->memo_contains_page_flagged(ibuf_rec, MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_S_FIX)); - ut_ad(ibuf_inside(mtr)); - ut_ad(rec_get_n_fields_old(ibuf_rec) > 2); - - data = rec_get_nth_field_old(ibuf_rec, IBUF_REC_FIELD_MARKER, &len); - ut_a(len == 1); - ut_a(*data == 0); - - types = rec_get_nth_field_old( - ibuf_rec, IBUF_REC_FIELD_METADATA, &len); - - ibuf_rec_get_info(mtr, ibuf_rec, &op, &comp, &info_len, NULL); - - if (op == IBUF_OP_DELETE_MARK || op == IBUF_OP_DELETE) { - /* Delete-marking a record doesn't take any - additional space, and while deleting a record - actually frees up space, we have to play it safe and - pretend it takes no additional space (the record - might not exist, etc.). */ - - return(0); - } else if (comp) { - dtuple_t* entry; - ulint volume; - dict_index_t* dummy_index; - mem_heap_t* heap = mem_heap_create(500); - - entry = ibuf_build_entry_from_ibuf_rec(mtr, ibuf_rec, - heap, &dummy_index); - - volume = rec_get_converted_size(dummy_index, entry, 0); - - ibuf_dummy_index_free(dummy_index); - mem_heap_free(heap); - - return(volume + page_dir_calc_reserved_space(1)); - } - - types += info_len; - n_fields = rec_get_n_fields_old(ibuf_rec) - - IBUF_REC_FIELD_USER; - - data_size = ibuf_rec_get_size(ibuf_rec, types, n_fields, comp); - - return(data_size + rec_get_converted_extra_size(data_size, n_fields, 0) - + page_dir_calc_reserved_space(1)); -} - -/*********************************************************************//** -Builds the tuple to insert to an ibuf tree when we have an entry for a -non-clustered index. - -NOTE that the original entry must be kept because we copy pointers to -its fields. - -@return own: entry to insert into an ibuf index tree */ -static -dtuple_t* -ibuf_entry_build( -/*=============*/ - ibuf_op_t op, /*!< in: operation type */ - dict_index_t* index, /*!< in: non-clustered index */ - const dtuple_t* entry, /*!< in: entry for a non-clustered index */ - ulint space, /*!< in: space id */ - ulint page_no,/*!< in: index page number where entry should - be inserted */ - ulint counter,/*!< in: counter value; - ULINT_UNDEFINED=not used */ - mem_heap_t* heap) /*!< in: heap into which to build */ -{ - dtuple_t* tuple; - dfield_t* field; - const dfield_t* entry_field; - ulint n_fields; - byte* buf; - byte* ti; - byte* type_info; - ulint i; - - ut_ad(counter != ULINT_UNDEFINED || op == IBUF_OP_INSERT); - ut_ad(counter == ULINT_UNDEFINED || counter <= 0xFFFF); - ut_ad(op < IBUF_OP_COUNT); - - /* We have to build a tuple with the following fields: - - 1-4) These are described at the top of this file. - - 5) The rest of the fields are copied from the entry. - - All fields in the tuple are ordered like the type binary in our - insert buffer tree. */ - - n_fields = dtuple_get_n_fields(entry); - - tuple = dtuple_create(heap, n_fields + IBUF_REC_FIELD_USER); - - /* 1) Space Id */ - - field = dtuple_get_nth_field(tuple, IBUF_REC_FIELD_SPACE); - - buf = static_cast(mem_heap_alloc(heap, 4)); - - mach_write_to_4(buf, space); - - dfield_set_data(field, buf, 4); - - /* 2) Marker byte */ - - field = dtuple_get_nth_field(tuple, IBUF_REC_FIELD_MARKER); - - buf = static_cast(mem_heap_alloc(heap, 1)); - - /* We set the marker byte zero */ - - mach_write_to_1(buf, 0); - - dfield_set_data(field, buf, 1); - - /* 3) Page number */ - - field = dtuple_get_nth_field(tuple, IBUF_REC_FIELD_PAGE); - - buf = static_cast(mem_heap_alloc(heap, 4)); - - mach_write_to_4(buf, page_no); - - dfield_set_data(field, buf, 4); - - /* 4) Type info, part #1 */ - - if (counter == ULINT_UNDEFINED) { - i = dict_table_is_comp(index->table) ? 1 : 0; - } else { - ut_ad(counter <= 0xFFFF); - i = IBUF_REC_INFO_SIZE; - } - - ti = type_info = static_cast( - mem_heap_alloc( - heap, - i + n_fields * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE)); - - switch (i) { - default: - ut_error; - break; - case 1: - /* set the flag for ROW_FORMAT=COMPACT */ - *ti++ = 0; - /* fall through */ - case 0: - /* the old format does not allow delete buffering */ - ut_ad(op == IBUF_OP_INSERT); - break; - case IBUF_REC_INFO_SIZE: - mach_write_to_2(ti + IBUF_REC_OFFSET_COUNTER, counter); - - ti[IBUF_REC_OFFSET_TYPE] = (byte) op; - ti[IBUF_REC_OFFSET_FLAGS] = dict_table_is_comp(index->table) - ? IBUF_REC_COMPACT : 0; - ti += IBUF_REC_INFO_SIZE; - break; - } - - /* 5+) Fields from the entry */ - - for (i = 0; i < n_fields; i++) { - ulint fixed_len; - const dict_field_t* ifield; - - field = dtuple_get_nth_field(tuple, i + IBUF_REC_FIELD_USER); - entry_field = dtuple_get_nth_field(entry, i); - dfield_copy(field, entry_field); - - ifield = dict_index_get_nth_field(index, i); - ut_ad(!ifield->descending); - /* Prefix index columns of fixed-length columns are of - fixed length. However, in the function call below, - dfield_get_type(entry_field) contains the fixed length - of the column in the clustered index. Replace it with - the fixed length of the secondary index column. */ - fixed_len = ifield->fixed_len; - -#ifdef UNIV_DEBUG - if (fixed_len) { - /* dict_index_add_col() should guarantee these */ - ut_ad(fixed_len <= (ulint) - dfield_get_type(entry_field)->len); - if (ifield->prefix_len) { - ut_ad(ifield->prefix_len == fixed_len); - } else { - ut_ad(fixed_len == (ulint) - dfield_get_type(entry_field)->len); - } - } -#endif /* UNIV_DEBUG */ - - dtype_new_store_for_order_and_null_size( - ti, dfield_get_type(entry_field), fixed_len); - ti += DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE; - } - - /* 4) Type info, part #2 */ - - field = dtuple_get_nth_field(tuple, IBUF_REC_FIELD_METADATA); - - dfield_set_data(field, type_info, ulint(ti - type_info)); - - /* Set all the types in the new tuple binary */ - - dtuple_set_types_binary(tuple, n_fields + IBUF_REC_FIELD_USER); - - return(tuple); -} - -/*********************************************************************//** -Builds a search tuple used to search buffered inserts for an index page. -This is for >= 4.1.x format records. -@return own: search tuple */ -static -dtuple_t* -ibuf_search_tuple_build( -/*====================*/ - ulint space, /*!< in: space id */ - ulint page_no,/*!< in: index page number */ - mem_heap_t* heap) /*!< in: heap into which to build */ -{ - dtuple_t* tuple; - dfield_t* field; - byte* buf; - - tuple = dtuple_create(heap, IBUF_REC_FIELD_METADATA); - - /* Store the space id in tuple */ - - field = dtuple_get_nth_field(tuple, IBUF_REC_FIELD_SPACE); - - buf = static_cast(mem_heap_alloc(heap, 4)); - - mach_write_to_4(buf, space); - - dfield_set_data(field, buf, 4); - - /* Store the new format record marker byte */ - - field = dtuple_get_nth_field(tuple, IBUF_REC_FIELD_MARKER); - - buf = static_cast(mem_heap_alloc(heap, 1)); - - mach_write_to_1(buf, 0); - - dfield_set_data(field, buf, 1); - - /* Store the page number in tuple */ - - field = dtuple_get_nth_field(tuple, IBUF_REC_FIELD_PAGE); - - buf = static_cast(mem_heap_alloc(heap, 4)); - - mach_write_to_4(buf, page_no); - - dfield_set_data(field, buf, 4); - - dtuple_set_types_binary(tuple, IBUF_REC_FIELD_METADATA); - - return(tuple); -} - -/*********************************************************************//** -Checks if there are enough pages in the free list of the ibuf tree that we -dare to start a pessimistic insert to the insert buffer. -@return whether enough free pages in list */ -static inline bool ibuf_data_enough_free_for_insert() -{ - mysql_mutex_assert_owner(&ibuf_mutex); - - /* We want a big margin of free pages, because a B-tree can sometimes - grow in size also if records are deleted from it, as the node pointers - can change, and we must make sure that we are able to delete the - inserts buffered for pages that we read to the buffer pool, without - any risk of running out of free space in the insert buffer. */ - - return(ibuf.free_list_len >= (ibuf.size / 2) + 3 * ibuf.height); -} - -/*********************************************************************//** -Checks if there are enough pages in the free list of the ibuf tree that we -should remove them and free to the file space management. -@return TRUE if enough free pages in list */ -UNIV_INLINE -ibool -ibuf_data_too_much_free(void) -/*=========================*/ -{ - mysql_mutex_assert_owner(&ibuf_mutex); - - return(ibuf.free_list_len >= 3 + (ibuf.size / 2) + 3 * ibuf.height); -} - -/** Allocate a change buffer page. -@retval true on success -@retval false if no space left */ -static bool ibuf_add_free_page() -{ - mtr_t mtr; - page_t* header_page; - buf_block_t* block; - - mtr.start(); - /* Acquire the fsp latch before the ibuf header, obeying the latching - order */ - mtr.x_lock_space(fil_system.sys_space); - header_page = ibuf_header_page_get(&mtr); - if (!header_page) { - mtr.commit(); - return false; - } - - /* Allocate a new page: NOTE that if the page has been a part of a - non-clustered index which has subsequently been dropped, then the - page may have buffered inserts in the insert buffer, and these - should be deleted from there. These get deleted when the page - allocation creates the page in buffer. Thus the call below may end - up calling the insert buffer routines and, as we yet have no latches - to insert buffer tree pages, these routines can run without a risk - of a deadlock. This is the reason why we created a special ibuf - header page apart from the ibuf tree. */ - - dberr_t err; - block = fseg_alloc_free_page_general( - header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER, 0, FSP_UP, - false, &mtr, &mtr, &err); - - if (!block) { - mtr.commit(); - return false; - } - - ut_ad(block->page.lock.not_recursive()); - ibuf_enter(&mtr); - mysql_mutex_lock(&ibuf_mutex); - - mtr.write<2>(*block, block->page.frame + FIL_PAGE_TYPE, - FIL_PAGE_IBUF_FREE_LIST); - buf_block_t* ibuf_root = ibuf_tree_root_get(&mtr); - if (UNIV_UNLIKELY(!ibuf_root)) { -corrupted: - /* Do not bother to try to free the allocated block, because - the change buffer is seriously corrupted already. */ - mysql_mutex_unlock(&ibuf_mutex); - ibuf_mtr_commit(&mtr); - return false; - } - - /* Add the page to the free list and update the ibuf size data */ - - err = flst_add_last(ibuf_root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, - block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, - &mtr); - if (UNIV_UNLIKELY(err != DB_SUCCESS)) { - goto corrupted; - } - - /* Set the bit indicating that this page is now an ibuf tree page - (level 2 page) */ - - const page_id_t page_id(block->page.id()); - buf_block_t* bitmap_page = ibuf_bitmap_get_map_page(page_id, 0, &mtr); - - if (UNIV_UNLIKELY(!bitmap_page)) { - goto corrupted; - } - - ibuf.seg_size++; - ibuf.free_list_len++; - - mysql_mutex_unlock(&ibuf_mutex); - - ibuf_bitmap_page_set_bits(bitmap_page, page_id, - srv_page_size, true, &mtr); - ibuf_mtr_commit(&mtr); - return true; -} - -/*********************************************************************//** -Removes a page from the free list and frees it to the fsp system. */ -static void ibuf_remove_free_page() -{ - mtr_t mtr; - mtr_t mtr2; - page_t* header_page; - - log_free_check(); - - mtr_start(&mtr); - /* Acquire the fsp latch before the ibuf header, obeying the latching - order */ - - mtr.x_lock_space(fil_system.sys_space); - header_page = ibuf_header_page_get(&mtr); - - /* Prevent pessimistic inserts to insert buffer trees for a while */ - ibuf_enter(&mtr); - mysql_mutex_lock(&ibuf_pessimistic_insert_mutex); - mysql_mutex_lock(&ibuf_mutex); - - if (!header_page || !ibuf_data_too_much_free()) { -early_exit: - mysql_mutex_unlock(&ibuf_mutex); - mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); - - ibuf_mtr_commit(&mtr); - - return; - } - - ibuf_mtr_start(&mtr2); - - buf_block_t* root = ibuf_tree_root_get(&mtr2); - - if (UNIV_UNLIKELY(!root)) { - ibuf_mtr_commit(&mtr2); - goto early_exit; - } - - mysql_mutex_unlock(&ibuf_mutex); - - const uint32_t page_no = flst_get_last(PAGE_HEADER - + PAGE_BTR_IBUF_FREE_LIST - + root->page.frame).page; - - /* NOTE that we must release the latch on the ibuf tree root - because in fseg_free_page we access level 1 pages, and the root - is a level 2 page. */ - - ibuf_mtr_commit(&mtr2); - ibuf_exit(&mtr); - - /* Since pessimistic inserts were prevented, we know that the - page is still in the free list. NOTE that also deletes may take - pages from the free list, but they take them from the start, and - the free list was so long that they cannot have taken the last - page from it. */ - - compile_time_assert(IBUF_SPACE_ID == 0); - const page_id_t page_id{IBUF_SPACE_ID, page_no}; - buf_block_t* bitmap_page = nullptr; - dberr_t err = fseg_free_page( - header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER, - fil_system.sys_space, page_no, &mtr); - - if (err != DB_SUCCESS) { - goto func_exit; - } - - ibuf_enter(&mtr); - - mysql_mutex_lock(&ibuf_mutex); - - root = ibuf_tree_root_get(&mtr, &err); - if (UNIV_UNLIKELY(!root)) { - mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); - goto func_exit; - } - - ut_ad(page_no == flst_get_last(PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST - + root->page.frame).page); - - /* Remove the page from the free list and update the ibuf size data */ - if (buf_block_t* block = - buf_page_get_gen(page_id, 0, RW_X_LATCH, nullptr, BUF_GET, - &mtr, &err)) { - err = flst_remove(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, - block, - PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, - &mtr); - } - - mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); - - if (err == DB_SUCCESS) { - ibuf.seg_size--; - ibuf.free_list_len--; - bitmap_page = ibuf_bitmap_get_map_page(page_id, 0, &mtr); - } - -func_exit: - mysql_mutex_unlock(&ibuf_mutex); - - if (bitmap_page) { - /* Set the bit indicating that this page is no more an - ibuf tree page (level 2 page) */ - ibuf_bitmap_page_set_bits( - bitmap_page, page_id, srv_page_size, false, &mtr); - } - - if (err == DB_SUCCESS) { - buf_page_free(fil_system.sys_space, page_no, &mtr); - } - - ibuf_mtr_commit(&mtr); -} - -/***********************************************************************//** -Frees excess pages from the ibuf free list. This function is called when an OS -thread calls fsp services to allocate a new file segment, or a new page to a -file segment, and the thread did not own the fsp latch before this call. */ -void -ibuf_free_excess_pages(void) -/*========================*/ -{ - /* Free at most a few pages at a time, so that we do not delay the - requested service too much */ - - for (ulint i = 0; i < 4; i++) { - - ibool too_much_free; - - mysql_mutex_lock(&ibuf_mutex); - too_much_free = ibuf_data_too_much_free(); - mysql_mutex_unlock(&ibuf_mutex); - - if (!too_much_free) { - return; - } - - ibuf_remove_free_page(); - } -} - -#ifdef UNIV_DEBUG -# define ibuf_get_merge_page_nos(contract,rec,mtr,ids,pages,n_stored) \ - ibuf_get_merge_page_nos_func(contract,rec,mtr,ids,pages,n_stored) -#else /* UNIV_DEBUG */ -# define ibuf_get_merge_page_nos(contract,rec,mtr,ids,pages,n_stored) \ - ibuf_get_merge_page_nos_func(contract,rec,ids,pages,n_stored) -#endif /* UNIV_DEBUG */ - -/*********************************************************************//** -Reads page numbers from a leaf in an ibuf tree. -@return a lower limit for the combined volume of records which will be -merged */ -static -ulint -ibuf_get_merge_page_nos_func( -/*=========================*/ - ibool contract,/*!< in: TRUE if this function is called to - contract the tree, FALSE if this is called - when a single page becomes full and we look - if it pays to read also nearby pages */ - const rec_t* rec, /*!< in: insert buffer record */ -#ifdef UNIV_DEBUG - mtr_t* mtr, /*!< in: mini-transaction holding rec */ -#endif /* UNIV_DEBUG */ - uint32_t* space_ids,/*!< in/out: space id's of the pages */ - uint32_t* page_nos,/*!< in/out: buffer for at least - IBUF_MAX_N_PAGES_MERGED many page numbers; - the page numbers are in an ascending order */ - ulint* n_stored)/*!< out: number of page numbers stored to - page_nos in this function */ -{ - uint32_t prev_page_no; - uint32_t prev_space_id; - uint32_t first_page_no; - uint32_t first_space_id; - uint32_t rec_page_no; - uint32_t rec_space_id; - ulint sum_volumes; - ulint volume_for_page; - ulint rec_volume; - ulint limit; - ulint n_pages; - - ut_ad(mtr->memo_contains_page_flagged(rec, MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_S_FIX)); - ut_ad(ibuf_inside(mtr)); - - *n_stored = 0; - - if (page_rec_is_supremum(rec)) { - - rec = page_rec_get_prev_const(rec); - if (UNIV_UNLIKELY(!rec)) { -corruption: - ut_ad("corrupted page" == 0); - return 0; - } - } - - if (page_rec_is_infimum(rec)) { - rec = page_rec_get_next_const(rec); - if (!rec || page_rec_is_supremum(rec)) { - return 0; - } - } - - limit = ut_min(IBUF_MAX_N_PAGES_MERGED, - buf_pool_get_curr_size() / 4); - - first_page_no = ibuf_rec_get_page_no(mtr, rec); - first_space_id = ibuf_rec_get_space(mtr, rec); - n_pages = 0; - prev_page_no = 0; - prev_space_id = 0; - - /* Go backwards from the first rec until we reach the border of the - 'merge area', or the page start or the limit of storeable pages is - reached */ - - while (!page_rec_is_infimum(rec) && UNIV_LIKELY(n_pages < limit)) { - - rec_page_no = ibuf_rec_get_page_no(mtr, rec); - rec_space_id = ibuf_rec_get_space(mtr, rec); - - if (rec_space_id != first_space_id - || (rec_page_no / IBUF_MERGE_AREA) - != (first_page_no / IBUF_MERGE_AREA)) { - - break; - } - - if (rec_page_no != prev_page_no - || rec_space_id != prev_space_id) { - n_pages++; - } - - prev_page_no = rec_page_no; - prev_space_id = rec_space_id; - - if (UNIV_UNLIKELY(!(rec = page_rec_get_prev_const(rec)))) { - goto corruption; - } - } - - rec = page_rec_get_next_const(rec); - - /* At the loop start there is no prev page; we mark this with a pair - of space id, page no (0, 0) for which there can never be entries in - the insert buffer */ - - prev_page_no = 0; - prev_space_id = 0; - sum_volumes = 0; - volume_for_page = 0; - - while (*n_stored < limit && rec) { - if (page_rec_is_supremum(rec)) { - /* When no more records available, mark this with - another 'impossible' pair of space id, page no */ - rec_page_no = 1; - rec_space_id = 0; - } else { - rec_page_no = ibuf_rec_get_page_no(mtr, rec); - rec_space_id = ibuf_rec_get_space(mtr, rec); - /* In the system tablespace the smallest - possible secondary index leaf page number is - bigger than FSP_DICT_HDR_PAGE_NO (7). - In all tablespaces, pages 0 and 1 are reserved - for the allocation bitmap and the change - buffer bitmap. In file-per-table tablespaces, - a file segment inode page will be created at - page 2 and the clustered index tree is created - at page 3. So for file-per-table tablespaces, - page 4 is the smallest possible secondary - index leaf page. CREATE TABLESPACE also initially - uses pages 2 and 3 for the first created table, - but that table may be dropped, allowing page 2 - to be reused for a secondary index leaf page. - To keep this assertion simple, just - make sure the page is >= 2. */ - ut_ad(rec_page_no >= FSP_FIRST_INODE_PAGE_NO); - } - -#ifdef UNIV_IBUF_DEBUG - ut_a(*n_stored < IBUF_MAX_N_PAGES_MERGED); -#endif - if ((rec_space_id != prev_space_id - || rec_page_no != prev_page_no) - && (prev_space_id != 0 || prev_page_no != 0)) { - - if (contract - || (prev_page_no == first_page_no - && prev_space_id == first_space_id) - || (volume_for_page - > ((IBUF_MERGE_THRESHOLD - 1) - * 4U << srv_page_size_shift - / IBUF_PAGE_SIZE_PER_FREE_SPACE) - / IBUF_MERGE_THRESHOLD)) { - - space_ids[*n_stored] = prev_space_id; - page_nos[*n_stored] = prev_page_no; - - (*n_stored)++; - - sum_volumes += volume_for_page; - } - - if (rec_space_id != first_space_id - || rec_page_no / IBUF_MERGE_AREA - != first_page_no / IBUF_MERGE_AREA) { - - break; - } - - volume_for_page = 0; - } - - if (rec_page_no == 1 && rec_space_id == 0) { - /* Supremum record */ - - break; - } - - rec_volume = ibuf_rec_get_volume(mtr, rec); - - volume_for_page += rec_volume; - - prev_page_no = rec_page_no; - prev_space_id = rec_space_id; - - rec = page_rec_get_next_const(rec); - } - -#ifdef UNIV_IBUF_DEBUG - ut_a(*n_stored <= IBUF_MAX_N_PAGES_MERGED); -#endif -#if 0 - fprintf(stderr, "Ibuf merge batch %lu pages %lu volume\n", - *n_stored, sum_volumes); -#endif - return(sum_volumes); -} - -/*******************************************************************//** -Get the matching records for space id. -@return current rec or NULL */ -static MY_ATTRIBUTE((nonnull, warn_unused_result)) -const rec_t* -ibuf_get_user_rec( -/*===============*/ - btr_pcur_t* pcur, /*!< in: the current cursor */ - mtr_t* mtr) /*!< in: mini transaction */ -{ - do { - const rec_t* rec = btr_pcur_get_rec(pcur); - - if (page_rec_is_user_rec(rec)) { - return(rec); - } - } while (btr_pcur_move_to_next(pcur, mtr)); - - return(NULL); -} - -/*********************************************************************//** -Reads page numbers for a space id from an ibuf tree. -@return a lower limit for the combined volume of records which will be -merged */ -static MY_ATTRIBUTE((nonnull, warn_unused_result)) -ulint -ibuf_get_merge_pages( -/*=================*/ - btr_pcur_t* pcur, /*!< in/out: cursor */ - uint32_t space, /*!< in: space for which to merge */ - ulint limit, /*!< in: max page numbers to read */ - uint32_t* pages, /*!< out: pages read */ - uint32_t* spaces, /*!< out: spaces read */ - ulint* n_pages,/*!< out: number of pages read */ - mtr_t* mtr) /*!< in: mini transaction */ -{ - const rec_t* rec; - ulint volume = 0; - - *n_pages = 0; - - while ((rec = ibuf_get_user_rec(pcur, mtr)) != 0 - && ibuf_rec_get_space(mtr, rec) == space - && *n_pages < limit) { - - uint32_t page_no = ibuf_rec_get_page_no(mtr, rec); - - if (*n_pages == 0 || pages[*n_pages - 1] != page_no) { - spaces[*n_pages] = space; - pages[*n_pages] = page_no; - ++*n_pages; - } - - volume += ibuf_rec_get_volume(mtr, rec); - - btr_pcur_move_to_next(pcur, mtr); - } - - return(volume); -} - -/** -Delete a change buffer record. -@param[in] page_id page identifier -@param[in,out] pcur persistent cursor positioned on the record -@param[in] search_tuple search key for (space,page_no) -@param[in,out] mtr mini-transaction -@return whether mtr was committed (due to pessimistic operation) */ -static MY_ATTRIBUTE((warn_unused_result, nonnull)) -bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur, - const dtuple_t* search_tuple, mtr_t* mtr); - -/** Delete the change buffer records for the given page id -@param page_id page identifier */ -static void ibuf_delete_recs(const page_id_t page_id) -{ - if (!ibuf.index || srv_read_only_mode) - return; - dfield_t dfield[IBUF_REC_FIELD_METADATA]; - dtuple_t tuple {0,IBUF_REC_FIELD_METADATA,IBUF_REC_FIELD_METADATA, - dfield,0,nullptr -#ifdef UNIV_DEBUG - ,DATA_TUPLE_MAGIC_N -#endif - }; - byte space_id[4], page_no[4]; - - mach_write_to_4(space_id, page_id.space()); - mach_write_to_4(page_no, page_id.page_no()); - - dfield_set_data(&dfield[0], space_id, 4); - dfield_set_data(&dfield[1], field_ref_zero, 1); - dfield_set_data(&dfield[2], page_no, 4); - dtuple_set_types_binary(&tuple, IBUF_REC_FIELD_METADATA); - - mtr_t mtr; -loop: - btr_pcur_t pcur; - pcur.btr_cur.page_cur.index= ibuf.index; - ibuf_mtr_start(&mtr); - if (btr_pcur_open(&tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF, &pcur, 0, &mtr)) - goto func_exit; - if (!btr_pcur_is_on_user_rec(&pcur)) - { - ut_ad(btr_pcur_is_after_last_on_page(&pcur)); - goto func_exit; - } - - for (;;) - { - ut_ad(btr_pcur_is_on_user_rec(&pcur)); - const rec_t* ibuf_rec = btr_pcur_get_rec(&pcur); - if (ibuf_rec_get_space(&mtr, ibuf_rec) != page_id.space() - || ibuf_rec_get_page_no(&mtr, ibuf_rec) != page_id.page_no()) - break; - /* Delete the record from ibuf */ - if (ibuf_delete_rec(page_id, &pcur, &tuple, &mtr)) - { - /* Deletion was pessimistic and mtr was committed: - we start from the beginning again */ - ut_ad(mtr.has_committed()); - goto loop; - } - - if (btr_pcur_is_after_last_on_page(&pcur)) - { - ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); - goto loop; - } - } -func_exit: - ibuf_mtr_commit(&mtr); - btr_pcur_close(&pcur); -} - -/** Merge the change buffer to some pages. */ -static void ibuf_read_merge_pages(const uint32_t* space_ids, - const uint32_t* page_nos, ulint n_stored) -{ - for (ulint i = 0; i < n_stored; i++) { - const uint32_t space_id = space_ids[i]; - fil_space_t* s = fil_space_t::get(space_id); - if (!s) { -tablespace_deleted: - /* The tablespace was not found: remove all - entries for it */ - ibuf_delete_for_discarded_space(space_id); - while (i + 1 < n_stored - && space_ids[i + 1] == space_id) { - i++; - } - continue; - } - - const ulint zip_size = s->zip_size(), size = s->size; - s->release(); - mtr_t mtr; - - if (UNIV_LIKELY(page_nos[i] < size)) { - mtr.start(); - dberr_t err; - buf_block_t *block = - buf_page_get_gen(page_id_t(space_id, page_nos[i]), - zip_size, RW_X_LATCH, nullptr, - BUF_GET_POSSIBLY_FREED, - &mtr, &err, true); - bool remove = !block - || fil_page_get_type(block->page.frame) - != FIL_PAGE_INDEX - || !page_is_leaf(block->page.frame); - mtr.commit(); - if (err == DB_TABLESPACE_DELETED) { - goto tablespace_deleted; - } - if (!remove) { - continue; - } - } - - if (srv_shutdown_state == SRV_SHUTDOWN_NONE - || srv_fast_shutdown) { - continue; - } - - /* The following code works around a hang when the - change buffer is corrupted, likely due to the - failure of ibuf_merge_or_delete_for_page() to - invoke ibuf_delete_recs() if (!bitmap_bits). - - It also introduced corruption by itself in the - following scenario: - - (1) We merged buffered changes in buf_page_get_gen() - (2) We committed the mini-transaction - (3) Redo log and the page with the merged changes is written - (4) A write completion callback thread evicts the page. - (5) Other threads buffer changes for that page. - (6) We will wrongly discard those newly buffered changes below. - - To prevent this scenario, we will only invoke this code - on shutdown. A call to ibuf_max_size_update(0) will cause - ibuf_insert_low() to refuse to insert anything into the - change buffer. */ - - /* Prevent an infinite loop, by removing entries from - the change buffer in the case the bitmap bits were - wrongly clear even though buffered changes exist. */ - ibuf_delete_recs(page_id_t(space_ids[i], page_nos[i])); - } -} - -/** Contract the change buffer by reading pages to the buffer pool. -@return a lower limit for the combined size in bytes of entries which -will be merged from ibuf trees to the pages read -@retval 0 if ibuf.empty */ -ulint ibuf_contract() -{ - mtr_t mtr; - btr_cur_t cur; - ulint sum_sizes; - uint32_t page_nos[IBUF_MAX_N_PAGES_MERGED]; - uint32_t space_ids[IBUF_MAX_N_PAGES_MERGED]; - - ibuf_mtr_start(&mtr); - - if (cur.open_leaf(true, ibuf.index, BTR_SEARCH_LEAF, &mtr) != - DB_SUCCESS) { - return 0; - } - - ut_ad(page_validate(btr_cur_get_page(&cur), ibuf.index)); - - if (page_is_empty(btr_cur_get_page(&cur))) { - /* If a B-tree page is empty, it must be the root page - and the whole B-tree must be empty. InnoDB does not - allow empty B-tree pages other than the root. */ - ut_ad(ibuf.empty); - ut_ad(btr_cur_get_block(&cur)->page.id() - == page_id_t(IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO)); - - ibuf_mtr_commit(&mtr); - - return(0); - } - - ulint n_pages = 0; - sum_sizes = ibuf_get_merge_page_nos(TRUE, - btr_cur_get_rec(&cur), &mtr, - space_ids, - page_nos, &n_pages); - ibuf_mtr_commit(&mtr); - - ibuf_read_merge_pages(space_ids, page_nos, n_pages); - - return(sum_sizes + 1); -} - -/*********************************************************************//** -Contracts insert buffer trees by reading pages referring to space_id -to the buffer pool. -@returns number of pages merged.*/ -ulint -ibuf_merge_space( -/*=============*/ - ulint space) /*!< in: tablespace id to merge */ -{ - mtr_t mtr; - btr_pcur_t pcur; - - dfield_t dfield[IBUF_REC_FIELD_METADATA]; - dtuple_t tuple {0, IBUF_REC_FIELD_METADATA, - IBUF_REC_FIELD_METADATA,dfield,0,nullptr -#ifdef UNIV_DEBUG - , DATA_TUPLE_MAGIC_N -#endif - }; - byte space_id[4]; - - mach_write_to_4(space_id, space); - - dfield_set_data(&dfield[0], space_id, 4); - dfield_set_data(&dfield[1], field_ref_zero, 1); - dfield_set_data(&dfield[2], field_ref_zero, 4); - - dtuple_set_types_binary(&tuple, IBUF_REC_FIELD_METADATA); - ulint n_pages = 0; - - ut_ad(space < SRV_SPACE_ID_UPPER_BOUND); - - log_free_check(); - ibuf_mtr_start(&mtr); - - /* Position the cursor on the first matching record. */ - - pcur.btr_cur.page_cur.index = ibuf.index; - dberr_t err = btr_pcur_open(&tuple, PAGE_CUR_GE, - BTR_SEARCH_LEAF, &pcur, 0, &mtr); - ut_ad(err != DB_SUCCESS || page_validate(btr_pcur_get_page(&pcur), - ibuf.index)); - - ulint sum_sizes = 0; - uint32_t pages[IBUF_MAX_N_PAGES_MERGED]; - uint32_t spaces[IBUF_MAX_N_PAGES_MERGED]; - - if (err != DB_SUCCESS) { - } else if (page_is_empty(btr_pcur_get_page(&pcur))) { - /* If a B-tree page is empty, it must be the root page - and the whole B-tree must be empty. InnoDB does not - allow empty B-tree pages other than the root. */ - ut_ad(ibuf.empty); - ut_ad(btr_pcur_get_block(&pcur)->page.id() - == page_id_t(IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO)); - } else { - - sum_sizes = ibuf_get_merge_pages( - &pcur, uint32_t(space), IBUF_MAX_N_PAGES_MERGED, - &pages[0], &spaces[0], &n_pages, - &mtr); - ib::info() << "Size of pages merged " << sum_sizes; - } - - ibuf_mtr_commit(&mtr); - - if (n_pages > 0) { - ut_ad(n_pages <= UT_ARR_SIZE(pages)); - -#ifdef UNIV_DEBUG - for (ulint i = 0; i < n_pages; ++i) { - ut_ad(spaces[i] == space); - } -#endif /* UNIV_DEBUG */ - - ibuf_read_merge_pages(spaces, pages, n_pages); - } - - return(n_pages); -} - -/*********************************************************************//** -Contract insert buffer trees after insert if they are too big. */ -UNIV_INLINE -void -ibuf_contract_after_insert( -/*=======================*/ - ulint entry_size) /*!< in: size of a record which was inserted - into an ibuf tree */ -{ - /* dirty comparison, to avoid contention on ibuf_mutex */ - if (ibuf.size < ibuf.max_size) { - return; - } - - /* Contract at least entry_size many bytes */ - ulint sum_sizes = 0; - ulint size; - - do { - size = ibuf_contract(); - sum_sizes += size; - } while (size > 0 && sum_sizes < entry_size); -} - -/** Determine if a change buffer record has been encountered already. -@param rec change buffer record in the MySQL 5.5 format -@param hash hash table of encountered records -@param size number of elements in hash -@retval true if a distinct record -@retval false if this may be duplicating an earlier record */ -static bool ibuf_get_volume_buffered_hash(const rec_t *rec, ulint *hash, - ulint size) -{ - ut_ad(rec_get_n_fields_old(rec) > IBUF_REC_FIELD_USER); - const ulint start= rec_get_field_start_offs(rec, IBUF_REC_FIELD_USER); - const ulint len= rec_get_data_size_old(rec) - start; - const uint32_t fold= my_crc32c(0, rec + start, len); - hash+= (fold / (CHAR_BIT * sizeof *hash)) % size; - ulint bitmask= static_cast(1) << (fold % (CHAR_BIT * sizeof(*hash))); - - if (*hash & bitmask) - return false; - - /* We have not seen this record yet. Remember it. */ - *hash|= bitmask; - return true; -} - -#ifdef UNIV_DEBUG -# define ibuf_get_volume_buffered_count(mtr,rec,hash,size,n_recs) \ - ibuf_get_volume_buffered_count_func(mtr,rec,hash,size,n_recs) -#else /* UNIV_DEBUG */ -# define ibuf_get_volume_buffered_count(mtr,rec,hash,size,n_recs) \ - ibuf_get_volume_buffered_count_func(rec,hash,size,n_recs) -#endif /* UNIV_DEBUG */ - -/*********************************************************************//** -Update the estimate of the number of records on a page, and -get the space taken by merging the buffered record to the index page. -@return size of index record in bytes + an upper limit of the space -taken in the page directory */ -static -ulint -ibuf_get_volume_buffered_count_func( -/*================================*/ -#ifdef UNIV_DEBUG - mtr_t* mtr, /*!< in: mini-transaction owning rec */ -#endif /* UNIV_DEBUG */ - const rec_t* rec, /*!< in: insert buffer record */ - ulint* hash, /*!< in/out: hash array */ - ulint size, /*!< in: number of elements in hash array */ - lint* n_recs) /*!< in/out: estimated number of records - on the page that rec points to */ -{ - ulint len; - ibuf_op_t ibuf_op; - const byte* types; - ulint n_fields; - - ut_ad(mtr->memo_contains_page_flagged(rec, MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_S_FIX)); - ut_ad(ibuf_inside(mtr)); - - n_fields = rec_get_n_fields_old(rec); - ut_ad(n_fields > IBUF_REC_FIELD_USER); - n_fields -= IBUF_REC_FIELD_USER; - - rec_get_nth_field_offs_old(rec, 1, &len); - /* This function is only invoked when buffering new - operations. All pre-4.1 records should have been merged - when the database was started up. */ - ut_a(len == 1); - - if (rec_get_deleted_flag(rec, 0)) { - /* This record has been merged already, - but apparently the system crashed before - the change was discarded from the buffer. - Pretend that the record does not exist. */ - return(0); - } - - types = rec_get_nth_field_old(rec, IBUF_REC_FIELD_METADATA, &len); - - switch (UNIV_EXPECT(int(len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE), - IBUF_REC_INFO_SIZE)) { - default: - ut_error; - case 0: - /* This ROW_TYPE=REDUNDANT record does not include an - operation counter. Exclude it from the *n_recs, - because deletes cannot be buffered if there are - old-style inserts buffered for the page. */ - - len = ibuf_rec_get_size(rec, types, n_fields, 0); - - return(len - + rec_get_converted_extra_size(len, n_fields, 0) - + page_dir_calc_reserved_space(1)); - case 1: - /* This ROW_TYPE=COMPACT record does not include an - operation counter. Exclude it from the *n_recs, - because deletes cannot be buffered if there are - old-style inserts buffered for the page. */ - goto get_volume_comp; - - case IBUF_REC_INFO_SIZE: - ibuf_op = (ibuf_op_t) types[IBUF_REC_OFFSET_TYPE]; - break; - } - - switch (ibuf_op) { - case IBUF_OP_INSERT: - /* Inserts can be done by updating a delete-marked record. - Because delete-mark and insert operations can be pointing to - the same records, we must not count duplicates. */ - case IBUF_OP_DELETE_MARK: - /* There must be a record to delete-mark. - See if this record has been already buffered. */ - if (n_recs && ibuf_get_volume_buffered_hash(rec, hash, size)) { - (*n_recs)++; - } - - if (ibuf_op == IBUF_OP_DELETE_MARK) { - /* Setting the delete-mark flag does not - affect the available space on the page. */ - return(0); - } - break; - case IBUF_OP_DELETE: - /* A record will be removed from the page. */ - if (n_recs) { - (*n_recs)--; - } - /* While deleting a record actually frees up space, - we have to play it safe and pretend that it takes no - additional space (the record might not exist, etc.). */ - return(0); - default: - ut_error; - } - - ut_ad(ibuf_op == IBUF_OP_INSERT); - -get_volume_comp: - { - dtuple_t* entry; - ulint volume; - dict_index_t* dummy_index; - mem_heap_t* heap = mem_heap_create(500); - - entry = ibuf_build_entry_from_ibuf_rec( - mtr, rec, heap, &dummy_index); - - volume = rec_get_converted_size(dummy_index, entry, 0); - - ibuf_dummy_index_free(dummy_index); - mem_heap_free(heap); - - return(volume + page_dir_calc_reserved_space(1)); - } -} - -/*********************************************************************//** -Gets an upper limit for the combined size of entries buffered in the insert -buffer for a given page. -@return upper limit for the volume of buffered inserts for the index -page, in bytes; srv_page_size, if the entries for the index page span -several pages in the insert buffer */ -static -ulint -ibuf_get_volume_buffered( -/*=====================*/ - const btr_pcur_t*pcur, /*!< in: pcur positioned at a place in an - insert buffer tree where we would insert an - entry for the index page whose number is - page_no, latch mode has to be BTR_MODIFY_PREV - or BTR_MODIFY_TREE */ - ulint space, /*!< in: space id */ - ulint page_no,/*!< in: page number of an index page */ - lint* n_recs, /*!< in/out: minimum number of records on the - page after the buffered changes have been - applied, or NULL to disable the counting */ - mtr_t* mtr) /*!< in: mini-transaction of pcur */ -{ - ulint volume; - const rec_t* rec; - const page_t* page; - const page_t* prev_page; - const page_t* next_page; - /* bitmap of buffered recs */ - ulint hash_bitmap[128 / sizeof(ulint)]; - - ut_ad((pcur->latch_mode == BTR_MODIFY_PREV) - || (pcur->latch_mode == BTR_MODIFY_TREE)); - - /* Count the volume of inserts earlier in the alphabetical order than - pcur */ - - volume = 0; - - if (n_recs) { - memset(hash_bitmap, 0, sizeof hash_bitmap); - } - - rec = btr_pcur_get_rec(pcur); - page = page_align(rec); - ut_ad(page_validate(page, ibuf.index)); - - if (page_rec_is_supremum(rec) - && UNIV_UNLIKELY(!(rec = page_rec_get_prev_const(rec)))) { -corruption: - ut_ad("corrupted page" == 0); - return srv_page_size; - } - - uint32_t prev_page_no; - - for (; !page_rec_is_infimum(rec); ) { - ut_ad(page_align(rec) == page); - - if (page_no != ibuf_rec_get_page_no(mtr, rec) - || space != ibuf_rec_get_space(mtr, rec)) { - - goto count_later; - } - - volume += ibuf_get_volume_buffered_count( - mtr, rec, - hash_bitmap, UT_ARR_SIZE(hash_bitmap), n_recs); - - if (UNIV_UNLIKELY(!(rec = page_rec_get_prev_const(rec)))) { - goto corruption; - } - } - - /* Look at the previous page */ - - prev_page_no = btr_page_get_prev(page); - - if (prev_page_no == FIL_NULL) { - - goto count_later; - } - - if (buf_block_t* block = - buf_page_get(page_id_t(IBUF_SPACE_ID, prev_page_no), - 0, RW_X_LATCH, mtr)) { - prev_page = buf_block_get_frame(block); - ut_ad(page_validate(prev_page, ibuf.index)); - } else { - return srv_page_size; - } - - static_assert(FIL_PAGE_NEXT % 4 == 0, "alignment"); - static_assert(FIL_PAGE_OFFSET % 4 == 0, "alignment"); - - if (UNIV_UNLIKELY(memcmp_aligned<4>(prev_page + FIL_PAGE_NEXT, - page + FIL_PAGE_OFFSET, 4))) { - return srv_page_size; - } - - rec = page_rec_get_prev_const(page_get_supremum_rec(prev_page)); - - if (UNIV_UNLIKELY(!rec)) { - goto corruption; - } - - for (;;) { - ut_ad(page_align(rec) == prev_page); - - if (page_rec_is_infimum(rec)) { - - /* We cannot go to yet a previous page, because we - do not have the x-latch on it, and cannot acquire one - because of the latching order: we have to give up */ - - return(srv_page_size); - } - - if (page_no != ibuf_rec_get_page_no(mtr, rec) - || space != ibuf_rec_get_space(mtr, rec)) { - - goto count_later; - } - - volume += ibuf_get_volume_buffered_count( - mtr, rec, - hash_bitmap, UT_ARR_SIZE(hash_bitmap), n_recs); - - if (UNIV_UNLIKELY(!(rec = page_rec_get_prev_const(rec)))) { - goto corruption; - } - } - -count_later: - rec = btr_pcur_get_rec(pcur); - - if (!page_rec_is_supremum(rec)) { - rec = page_rec_get_next_const(rec); - } - - for (; !page_rec_is_supremum(rec); - rec = page_rec_get_next_const(rec)) { - if (UNIV_UNLIKELY(!rec)) { - return srv_page_size; - } - if (page_no != ibuf_rec_get_page_no(mtr, rec) - || space != ibuf_rec_get_space(mtr, rec)) { - - return(volume); - } - - volume += ibuf_get_volume_buffered_count( - mtr, rec, - hash_bitmap, UT_ARR_SIZE(hash_bitmap), n_recs); - } - - /* Look at the next page */ - - uint32_t next_page_no = btr_page_get_next(page); - - if (next_page_no == FIL_NULL) { - - return(volume); - } - - if (buf_block_t* block = - buf_page_get(page_id_t(IBUF_SPACE_ID, next_page_no), - 0, RW_X_LATCH, mtr)) { - next_page = buf_block_get_frame(block); - ut_ad(page_validate(next_page, ibuf.index)); - } else { - return srv_page_size; - } - - static_assert(FIL_PAGE_PREV % 4 == 0, "alignment"); - static_assert(FIL_PAGE_OFFSET % 4 == 0, "alignment"); - - if (UNIV_UNLIKELY(memcmp_aligned<4>(next_page + FIL_PAGE_PREV, - page + FIL_PAGE_OFFSET, 4))) { - return 0; - } - - rec = page_get_infimum_rec(next_page); - rec = page_rec_get_next_const(rec); - - for (; ; rec = page_rec_get_next_const(rec)) { - if (!rec || page_rec_is_supremum(rec)) { - /* We give up */ - return(srv_page_size); - } - - ut_ad(page_align(rec) == next_page); - - if (page_no != ibuf_rec_get_page_no(mtr, rec) - || space != ibuf_rec_get_space(mtr, rec)) { - - return(volume); - } - - volume += ibuf_get_volume_buffered_count( - mtr, rec, - hash_bitmap, UT_ARR_SIZE(hash_bitmap), n_recs); - } -} - -/*********************************************************************//** -Reads the biggest tablespace id from the high end of the insert buffer -tree and updates the counter in fil_system. */ -void -ibuf_update_max_tablespace_id(void) -/*===============================*/ -{ - const rec_t* rec; - const byte* field; - ulint len; - btr_pcur_t pcur; - mtr_t mtr; - - ut_a(!dict_table_is_comp(ibuf.index->table)); - - ibuf_mtr_start(&mtr); - - if (pcur.open_leaf(false, ibuf.index, BTR_SEARCH_LEAF, &mtr) - != DB_SUCCESS) { -func_exit: - ibuf_mtr_commit(&mtr); - return; - } - - ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index)); - - if (!btr_pcur_move_to_prev(&pcur, &mtr) - || btr_pcur_is_before_first_on_page(&pcur)) { - goto func_exit; - } - - rec = btr_pcur_get_rec(&pcur); - - field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_SPACE, &len); - - ut_a(len == 4); - - const uint32_t max_space_id = mach_read_from_4(field); - - ibuf_mtr_commit(&mtr); - - /* printf("Maximum space id in insert buffer %lu\n", max_space_id); */ - - fil_set_max_space_id_if_bigger(max_space_id); -} - -#ifdef UNIV_DEBUG -# define ibuf_get_entry_counter_low(mtr,rec,space,page_no) \ - ibuf_get_entry_counter_low_func(mtr,rec,space,page_no) -#else /* UNIV_DEBUG */ -# define ibuf_get_entry_counter_low(mtr,rec,space,page_no) \ - ibuf_get_entry_counter_low_func(rec,space,page_no) -#endif -/****************************************************************//** -Helper function for ibuf_get_entry_counter_func. Checks if rec is for -(space, page_no), and if so, reads counter value from it and returns -that + 1. -@retval ULINT_UNDEFINED if the record does not contain any counter -@retval 0 if the record is not for (space, page_no) -@retval 1 + previous counter value, otherwise */ -static -ulint -ibuf_get_entry_counter_low_func( -/*============================*/ -#ifdef UNIV_DEBUG - mtr_t* mtr, /*!< in: mini-transaction of rec */ -#endif /* UNIV_DEBUG */ - const rec_t* rec, /*!< in: insert buffer record */ - ulint space, /*!< in: space id */ - ulint page_no) /*!< in: page number */ -{ - ulint counter; - const byte* field; - ulint len; - - ut_ad(ibuf_inside(mtr)); - ut_ad(mtr->memo_contains_page_flagged(rec, MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_S_FIX)); - ut_ad(rec_get_n_fields_old(rec) > 2); - - field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_MARKER, &len); - - ut_a(len == 1); - - /* Check the tablespace identifier. */ - field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_SPACE, &len); - - ut_a(len == 4); - - if (mach_read_from_4(field) != space) { - - return(0); - } - - /* Check the page offset. */ - field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_PAGE, &len); - ut_a(len == 4); - - if (mach_read_from_4(field) != page_no) { - - return(0); - } - - /* Check if the record contains a counter field. */ - field = rec_get_nth_field_old(rec, IBUF_REC_FIELD_METADATA, &len); - - switch (len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE) { - default: - ut_error; - case 0: /* ROW_FORMAT=REDUNDANT */ - case 1: /* ROW_FORMAT=COMPACT */ - return(ULINT_UNDEFINED); - - case IBUF_REC_INFO_SIZE: - counter = mach_read_from_2(field + IBUF_REC_OFFSET_COUNTER); - ut_a(counter < 0xFFFF); - return(counter + 1); - } -} - -#ifdef UNIV_DEBUG -# define ibuf_get_entry_counter(space,page_no,rec,mtr,exact_leaf) \ - ibuf_get_entry_counter_func(space,page_no,rec,mtr,exact_leaf) -#else /* UNIV_DEBUG */ -# define ibuf_get_entry_counter(space,page_no,rec,mtr,exact_leaf) \ - ibuf_get_entry_counter_func(space,page_no,rec,exact_leaf) -#endif /* UNIV_DEBUG */ - -/****************************************************************//** -Calculate the counter field for an entry based on the current -last record in ibuf for (space, page_no). -@return the counter field, or ULINT_UNDEFINED -if we should abort this insertion to ibuf */ -static -ulint -ibuf_get_entry_counter_func( -/*========================*/ - ulint space, /*!< in: space id of entry */ - ulint page_no, /*!< in: page number of entry */ - const rec_t* rec, /*!< in: the record preceding the - insertion point */ -#ifdef UNIV_DEBUG - mtr_t* mtr, /*!< in: mini-transaction */ -#endif /* UNIV_DEBUG */ - ibool only_leaf) /*!< in: TRUE if this is the only - leaf page that can contain entries - for (space,page_no), that is, there - was no exact match for (space,page_no) - in the node pointer */ -{ - ut_ad(ibuf_inside(mtr)); - ut_ad(mtr->memo_contains_page_flagged(rec, MTR_MEMO_PAGE_X_FIX)); - ut_ad(page_validate(page_align(rec), ibuf.index)); - - if (page_rec_is_supremum(rec)) { - /* This is just for safety. The record should be a - page infimum or a user record. */ - ut_ad(0); - return(ULINT_UNDEFINED); - } else if (!page_rec_is_infimum(rec)) { - return(ibuf_get_entry_counter_low(mtr, rec, space, page_no)); - } else if (only_leaf || !page_has_prev(page_align(rec))) { - /* The parent node pointer did not contain the - searched for (space, page_no), which means that the - search ended on the correct page regardless of the - counter value, and since we're at the infimum record, - there are no existing records. */ - return(0); - } else { - /* We used to read the previous page here. It would - break the latching order, because the caller has - buffer-fixed an insert buffer bitmap page. */ - return(ULINT_UNDEFINED); - } -} - - -/** Translates the ibuf free bits to the free space on a page in bytes. -@param[in] physical_size page_size -@param[in] bits value for ibuf bitmap bits -@return maximum insert size after reorganize for the page */ -inline ulint -ibuf_index_page_calc_free_from_bits(ulint physical_size, ulint bits) -{ - ut_ad(bits < 4); - ut_ad(physical_size > IBUF_PAGE_SIZE_PER_FREE_SPACE); - - if (bits == 3) { - bits = 4; - } - - return bits * physical_size / IBUF_PAGE_SIZE_PER_FREE_SPACE; + dtype_get_len(type)); + dict_index_add_col(index, index->table, + dict_table_get_nth_col(index->table, i), len); } -/** Buffer an operation in the insert/delete buffer, instead of doing it -directly to the disk page, if this is possible. -@param[in] mode BTR_MODIFY_PREV or BTR_INSERT_TREE -@param[in] op operation type -@param[in] no_counter TRUE=use 5.0.3 format; FALSE=allow delete -buffering -@param[in] entry index entry to insert -@param[in] entry_size rec_get_converted_size(index, entry) -@param[in,out] index index where to insert; must not be unique -or clustered -@param[in] page_id page id where to insert -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in,out] thr query thread -@return DB_SUCCESS, DB_STRONG_FAIL or other error */ -static TRANSACTIONAL_TARGET MY_ATTRIBUTE((warn_unused_result)) -dberr_t -ibuf_insert_low( - btr_latch_mode mode, - ibuf_op_t op, - ibool no_counter, - const dtuple_t* entry, - ulint entry_size, - dict_index_t* index, - const page_id_t page_id, - ulint zip_size, - que_thr_t* thr) +/**********************************************************************//** +Reads to a type the stored information which determines its alphabetical +ordering and the storage size of an SQL NULL value. This is the >= 4.1.x +storage format. */ +static +void +dtype_new_read_for_order_and_null_size( +/*===================================*/ + dtype_t* type, /*!< in: type struct */ + const byte* buf) /*!< in: buffer for stored type order info */ { - big_rec_t* dummy_big_rec; - btr_pcur_t pcur; - btr_cur_t* cursor; - dtuple_t* ibuf_entry; - mem_heap_t* offsets_heap = NULL; - mem_heap_t* heap; - rec_offs* offsets = NULL; - ulint buffered; - lint min_n_recs; - rec_t* ins_rec; - buf_block_t* bitmap_page; - buf_block_t* block = NULL; - page_t* root; - dberr_t err; - ibool do_merge; - uint32_t space_ids[IBUF_MAX_N_PAGES_MERGED]; - uint32_t page_nos[IBUF_MAX_N_PAGES_MERGED]; - ulint n_stored; - mtr_t mtr; - mtr_t bitmap_mtr; - - ut_a(!dict_index_is_clust(index)); - ut_ad(!dict_index_is_spatial(index)); - ut_ad(dtuple_check_typed(entry)); - ut_ad(!no_counter || op == IBUF_OP_INSERT); - ut_ad(page_id.space() == index->table->space_id); - ut_a(op < IBUF_OP_COUNT); - - do_merge = FALSE; - - /* Perform dirty comparison of ibuf.max_size and ibuf.size to - reduce ibuf_mutex contention. This should be OK; at worst we - are doing some excessive ibuf_contract() or occasionally - skipping an ibuf_contract(). */ - const ulint max_size = ibuf.max_size; - - if (max_size == 0) { - return(DB_STRONG_FAIL); - } - - if (ibuf.size >= max_size + IBUF_CONTRACT_DO_NOT_INSERT) { - /* Insert buffer is now too big, contract it but do not try - to insert */ - - -#ifdef UNIV_IBUF_DEBUG - fputs("Ibuf too big\n", stderr); -#endif - ibuf_contract(); + type->mtype = buf[0] & 63; + type->prtype = buf[1]; - return(DB_STRONG_FAIL); + if (buf[0] & 128) { + type->prtype |= DATA_BINARY_TYPE; } - heap = mem_heap_create(1024); - - /* Build the entry which contains the space id and the page number - as the first fields and the type information for other fields, and - which will be inserted to the insert buffer. Using a counter value - of 0xFFFF we find the last record for (space, page_no), from which - we can then read the counter value N and use N + 1 in the record we - insert. (We patch the ibuf_entry's counter field to the correct - value just before actually inserting the entry.) */ - - ibuf_entry = ibuf_entry_build( - op, index, entry, page_id.space(), page_id.page_no(), - no_counter ? ULINT_UNDEFINED : 0xFFFF, heap); - - /* Open a cursor to the insert buffer tree to calculate if we can add - the new entry to it without exceeding the free space limit for the - page. */ - - if (mode == BTR_INSERT_TREE) { - for (;;) { - mysql_mutex_lock(&ibuf_pessimistic_insert_mutex); - mysql_mutex_lock(&ibuf_mutex); - - if (UNIV_LIKELY(ibuf_data_enough_free_for_insert())) { - - break; - } - - mysql_mutex_unlock(&ibuf_mutex); - mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); - - if (!ibuf_add_free_page()) { - - mem_heap_free(heap); - return(DB_STRONG_FAIL); - } - } + if (buf[4] & 128) { + type->prtype |= DATA_NOT_NULL; } - ibuf_mtr_start(&mtr); - pcur.btr_cur.page_cur.index = ibuf.index; - - err = btr_pcur_open(ibuf_entry, PAGE_CUR_LE, mode, &pcur, 0, &mtr); - if (err != DB_SUCCESS) { -func_exit: - ibuf_mtr_commit(&mtr); - ut_free(pcur.old_rec_buf); - mem_heap_free(heap); + type->len = mach_read_from_2(buf + 2); - if (err == DB_SUCCESS && mode == BTR_INSERT_TREE) { - ibuf_contract_after_insert(entry_size); - } + uint32_t charset_coll = (mach_read_from_2(buf + 4) & CHAR_COLL_MASK) + << 16; - if (do_merge) { -#ifdef UNIV_IBUF_DEBUG - ut_a(n_stored <= IBUF_MAX_N_PAGES_MERGED); -#endif - ibuf_read_merge_pages(space_ids, page_nos, n_stored); - } - return err; - } + if (dtype_is_string_type(type->mtype)) { + type->prtype |= charset_coll << 16; - ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index)); - - /* Find out the volume of already buffered inserts for the same index - page */ - min_n_recs = 0; - buffered = ibuf_get_volume_buffered(&pcur, - page_id.space(), - page_id.page_no(), - op == IBUF_OP_DELETE - ? &min_n_recs - : NULL, &mtr); - - const ulint physical_size = zip_size ? zip_size : srv_page_size; - - if (op == IBUF_OP_DELETE - && (min_n_recs < 2 || buf_pool.watch_occurred(page_id))) { - /* The page could become empty after the record is - deleted, or the page has been read in to the buffer - pool. Refuse to buffer the operation. */ - - /* The buffer pool watch is needed for IBUF_OP_DELETE - because of latching order considerations. We can - check buf_pool_watch_occurred() only after latching - the insert buffer B-tree pages that contain buffered - changes for the page. We never buffer IBUF_OP_DELETE, - unless some IBUF_OP_INSERT or IBUF_OP_DELETE_MARK have - been previously buffered for the page. Because there - are buffered operations for the page, the insert - buffer B-tree page latches held by mtr will guarantee - that no changes for the user page will be merged - before mtr_commit(&mtr). We must not mtr_commit(&mtr) - until after the IBUF_OP_DELETE has been buffered. */ - -fail_exit: - if (mode == BTR_INSERT_TREE) { - mysql_mutex_unlock(&ibuf_mutex); - mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); + if (charset_coll == 0) { + /* This insert buffer record was inserted before + MySQL 4.1.2, and the charset-collation code was not + explicitly stored to dtype->prtype at that time. It + must be the default charset-collation of this MySQL + installation. */ + type->prtype |= default_charset_info->number << 16; } - - err = DB_STRONG_FAIL; - goto func_exit; } - /* After this point, the page could still be loaded to the - buffer pool, but we do not have to care about it, since we are - holding a latch on the insert buffer leaf page that contains - buffered changes for (space, page_no). If the page enters the - buffer pool, buf_page_t::read_complete() for (space, page_no) will - have to acquire a latch on the same insert buffer leaf page, - which it cannot do until we have buffered the IBUF_OP_DELETE - and done mtr_commit(&mtr) to release the latch. */ - - ibuf_mtr_start(&bitmap_mtr); - - bitmap_page = ibuf_bitmap_get_map_page(page_id, zip_size, &bitmap_mtr); - - /* We check if the index page is suitable for buffered entries */ + dtype_set_mblen(type); +} - if (!bitmap_page || buf_pool.page_hash_contains( - page_id, buf_pool.page_hash.cell_get(page_id.fold()))) { -commit_exit: - ibuf_mtr_commit(&bitmap_mtr); - goto fail_exit; - } else if (!lock_sys.rd_lock_try()) { - goto commit_exit; - } else { - hash_cell_t* cell = lock_sys.rec_hash.cell_get(page_id.fold()); - lock_sys.rec_hash.latch(cell)->acquire(); - const lock_t* lock = lock_sys_t::get_first(*cell, page_id); - lock_sys.rec_hash.latch(cell)->release(); - lock_sys.rd_unlock(); - if (lock) { - goto commit_exit; - } - } +/** Construct an index entry and an index for applying an operation. +@param ibuf_rec change buffer record in an X-latched page +@param not_redundant whether another format than ROW_FORMAT=REDUNDANT is used +@param n_fields number of index record fields +@param types type information +@param heap memory heap +@param index dummy index metadata +@return the index entry for applying the operation */ +static dtuple_t *ibuf_entry_build(const rec_t *ibuf_rec, ulint not_redundant, + ulint n_fields, const byte *types, + mem_heap_t *heap, dict_index_t *&index) +{ + dtuple_t* tuple; + dfield_t* field; + const byte* data; + ulint len; - if (op == IBUF_OP_INSERT) { - ulint bits = ibuf_bitmap_page_get_bits( - bitmap_page->page.frame, page_id, physical_size, - IBUF_BITMAP_FREE, &bitmap_mtr); + tuple = dtuple_create(heap, n_fields); - if (buffered + entry_size + page_dir_calc_reserved_space(1) - > ibuf_index_page_calc_free_from_bits(physical_size, - bits)) { - /* Release the bitmap page latch early. */ - ibuf_mtr_commit(&bitmap_mtr); + index = dict_mem_index_create( + dict_table_t::create({C_STRING_WITH_LEN("")}, nullptr, + n_fields, 0, + not_redundant ? DICT_TF_COMPACT : 0, 0), + "IBUF_DUMMY", 0, n_fields); + /* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */ + ut_d(index->cached = true); + ut_d(index->is_dummy = true); - /* It may not fit */ - do_merge = TRUE; + for (ulint i = 0; i < n_fields; i++) { + field = dtuple_get_nth_field(tuple, i); - ibuf_get_merge_page_nos(FALSE, - btr_pcur_get_rec(&pcur), &mtr, - space_ids, - page_nos, &n_stored); + data = rec_get_nth_field_old( + ibuf_rec, i + IBUF_REC_FIELD_USER, &len); - goto fail_exit; - } - } + dfield_set_data(field, data, len); - if (!no_counter) { - /* Patch correct counter value to the entry to - insert. This can change the insert position, which can - result in the need to abort in some cases. */ - ulint counter = ibuf_get_entry_counter( - page_id.space(), page_id.page_no(), - btr_pcur_get_rec(&pcur), &mtr, - btr_pcur_get_btr_cur(&pcur)->low_match - < IBUF_REC_FIELD_METADATA); - dfield_t* field; - - if (counter == ULINT_UNDEFINED) { - goto commit_exit; - } + dtype_new_read_for_order_and_null_size( + dfield_get_type(field), types + i * 6); - field = dtuple_get_nth_field( - ibuf_entry, IBUF_REC_FIELD_METADATA); - mach_write_to_2( - (byte*) dfield_get_data(field) - + IBUF_REC_OFFSET_COUNTER, counter); + ibuf_dummy_index_add_col(index, dfield_get_type(field), len); } - /* Set the bitmap bit denoting that the insert buffer contains - buffered entries for this index page, if the bit is not set yet */ - index->set_modified(bitmap_mtr); - ibuf_bitmap_page_set_bits( - bitmap_page, page_id, physical_size, true, &bitmap_mtr); - ibuf_mtr_commit(&bitmap_mtr); - - cursor = btr_pcur_get_btr_cur(&pcur); - - if (mode == BTR_MODIFY_PREV) { - err = btr_cur_optimistic_insert( - BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG, - cursor, &offsets, &offsets_heap, - ibuf_entry, &ins_rec, - &dummy_big_rec, 0, thr, &mtr); - block = btr_cur_get_block(cursor); - ut_ad(block->page.id().space() == IBUF_SPACE_ID); - - /* If this is the root page, update ibuf.empty. */ - if (block->page.id().page_no() == FSP_IBUF_TREE_ROOT_PAGE_NO) { - const page_t* root = buf_block_get_frame(block); - - ut_ad(page_get_space_id(root) == IBUF_SPACE_ID); - ut_ad(page_get_page_no(root) - == FSP_IBUF_TREE_ROOT_PAGE_NO); - - ibuf.empty = page_is_empty(root); - } - } else { - ut_ad(mode == BTR_INSERT_TREE); - - /* We acquire an sx-latch to the root page before the insert, - because a pessimistic insert releases the tree x-latch, - which would cause the sx-latching of the root after that to - break the latching order. */ - if (buf_block_t* ibuf_root = ibuf_tree_root_get(&mtr)) { - root = ibuf_root->page.frame; - } else { - err = DB_CORRUPTION; - mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); - mysql_mutex_unlock(&ibuf_mutex); - goto ibuf_insert_done; - } - - err = btr_cur_optimistic_insert( - BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG, - cursor, &offsets, &offsets_heap, - ibuf_entry, &ins_rec, - &dummy_big_rec, 0, thr, &mtr); - - if (err == DB_FAIL) { - err = btr_cur_pessimistic_insert( - BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG, - cursor, &offsets, &offsets_heap, - ibuf_entry, &ins_rec, - &dummy_big_rec, 0, thr, &mtr); - } + index->n_core_null_bytes = static_cast( + UT_BITS_IN_BYTES(unsigned(index->n_nullable))); - mysql_mutex_unlock(&ibuf_pessimistic_insert_mutex); - ibuf_size_update(root); - mysql_mutex_unlock(&ibuf_mutex); - ibuf.empty = page_is_empty(root); + /* Prevent an ut_ad() failure in page_zip_write_rec() by + adding system columns to the dummy table pointed to by the + dummy secondary index. The change buffer was only used for + secondary indexes, whose records never contain any system + columns, such as DB_TRX_ID. */ + ut_d(dict_table_add_system_columns(index->table, index->table->heap)); + return(tuple); +} - block = btr_cur_get_block(cursor); - ut_ad(block->page.id().space() == IBUF_SPACE_ID); - } +/** Removes a page from the free list and frees it to the fsp system. +@param mtr mini-transaction +@return error code +@retval DB_SUCCESS if more work may remain to be done +@retval DB_SUCCESS_LOCKED_REC if everything was freed */ +ATTRIBUTE_COLD static dberr_t ibuf_remove_free_page(mtr_t &mtr) +{ + log_free_check(); -ibuf_insert_done: - if (offsets_heap) { - mem_heap_free(offsets_heap); - } + mtr.start(); - if (err == DB_SUCCESS && op != IBUF_OP_DELETE) { - /* Update the page max trx id field */ - page_update_max_trx_id(block, NULL, - thr_get_trx(thr)->id, &mtr); - } + mtr.x_lock_space(fil_system.sys_space); + dberr_t err; + buf_block_t* header= buf_page_get_gen(ibuf_header, 0, RW_X_LATCH, nullptr, + BUF_GET, &mtr, &err); - goto func_exit; -} + if (!header) + { +func_exit: + mtr.commit(); + return err; + } -/** Buffer an operation in the change buffer, instead of applying it -directly to the file page, if this is possible. Does not do it if the index -is clustered or unique. -@param[in] op operation type -@param[in] entry index entry to insert -@param[in,out] index index where to insert -@param[in] page_id page id where to insert -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in,out] thr query thread -@return true if success */ -TRANSACTIONAL_TARGET -bool -ibuf_insert( - ibuf_op_t op, - const dtuple_t* entry, - dict_index_t* index, - const page_id_t page_id, - ulint zip_size, - que_thr_t* thr) -{ - dberr_t err; - ulint entry_size; - ibool no_counter; - /* Read the settable global variable only once in - this function, so that we will have a consistent view of it. */ - ibuf_use_t use = ibuf_use_t(innodb_change_buffering); - DBUG_ENTER("ibuf_insert"); + buf_block_t *root= buf_page_get_gen(ibuf_root, 0, RW_X_LATCH, + nullptr, BUF_GET, &mtr, &err); - DBUG_PRINT("ibuf", ("op: %d, space: " UINT32PF ", page_no: " UINT32PF, - op, page_id.space(), page_id.page_no())); + if (UNIV_UNLIKELY(!root)) + goto func_exit; - ut_ad(dtuple_check_typed(entry)); - ut_ad(page_id.space() != SRV_TMP_SPACE_ID); - ut_ad(index->is_btree()); - ut_a(!dict_index_is_clust(index)); - ut_ad(!index->table->is_temporary()); - - no_counter = use <= IBUF_USE_INSERT; - - switch (op) { - case IBUF_OP_INSERT: - switch (use) { - case IBUF_USE_NONE: - case IBUF_USE_DELETE: - case IBUF_USE_DELETE_MARK: - DBUG_RETURN(false); - case IBUF_USE_INSERT: - case IBUF_USE_INSERT_DELETE_MARK: - case IBUF_USE_ALL: - goto check_watch; - } - break; - case IBUF_OP_DELETE_MARK: - switch (use) { - case IBUF_USE_NONE: - case IBUF_USE_INSERT: - DBUG_RETURN(false); - case IBUF_USE_DELETE_MARK: - case IBUF_USE_DELETE: - case IBUF_USE_INSERT_DELETE_MARK: - case IBUF_USE_ALL: - ut_ad(!no_counter); - goto check_watch; - } - break; - case IBUF_OP_DELETE: - switch (use) { - case IBUF_USE_NONE: - case IBUF_USE_INSERT: - case IBUF_USE_INSERT_DELETE_MARK: - DBUG_RETURN(false); - case IBUF_USE_DELETE_MARK: - case IBUF_USE_DELETE: - case IBUF_USE_ALL: - ut_ad(!no_counter); - goto skip_watch; - } - break; - case IBUF_OP_COUNT: - break; - } + const uint32_t page_no= flst_get_last(PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST + + root->page.frame).page; + if (page_no == FIL_NULL) + { + mtr.set_modified(*root); + fsp_init_file_page(fil_system.sys_space, root, &mtr); + err= DB_SUCCESS_LOCKED_REC; + goto func_exit; + } - /* unknown op or use */ - ut_error; - -check_watch: - /* If a thread attempts to buffer an insert on a page while a - purge is in progress on the same page, the purge must not be - buffered, because it could remove a record that was - re-inserted later. For simplicity, we block the buffering of - all operations on a page that has a purge pending. - - We do not check this in the IBUF_OP_DELETE case, because that - would always trigger the buffer pool watch during purge and - thus prevent the buffering of delete operations. We assume - that the issuer of IBUF_OP_DELETE has called - buf_pool_t::watch_set(). */ - - if (buf_pool.page_hash_contains( - page_id, buf_pool.page_hash.cell_get(page_id.fold()))) { - /* A buffer pool watch has been set or the - page has been read into the buffer pool. - Do not buffer the request. If a purge operation - is being buffered, have this request executed - directly on the page in the buffer pool after the - buffered entries for this page have been merged. */ - DBUG_RETURN(false); - } + /* Since pessimistic inserts were prevented, we know that the + page is still in the free list. NOTE that also deletes may take + pages from the free list, but they take them from the start, and + the free list was so long that they cannot have taken the last + page from it. */ -skip_watch: - entry_size = rec_get_converted_size(index, entry, 0); + err= fseg_free_page(header->page.frame + PAGE_DATA, fil_system.sys_space, + page_no, &mtr); - if (entry_size - >= page_get_free_space_of_empty(dict_table_is_comp(index->table)) - / 2) { + if (err != DB_SUCCESS) + goto func_exit; - DBUG_RETURN(false); - } + if (page_no != flst_get_last(PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST + + root->page.frame).page) + { + err= DB_CORRUPTION; + goto func_exit; + } - err = ibuf_insert_low(BTR_MODIFY_PREV, op, no_counter, - entry, entry_size, - index, page_id, zip_size, thr); - if (err == DB_FAIL) { - err = ibuf_insert_low(BTR_INSERT_TREE, - op, no_counter, entry, entry_size, - index, page_id, zip_size, thr); - } + /* Remove the page from the free list and update the ibuf size data */ + if (buf_block_t *block= + buf_page_get_gen(page_id_t{0, page_no}, 0, RW_X_LATCH, nullptr, BUF_GET, + &mtr, &err)) + err= flst_remove(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, + block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr); - ut_a(err == DB_SUCCESS || err == DB_STRONG_FAIL - || err == DB_TOO_BIG_RECORD); + if (err == DB_SUCCESS) + buf_page_free(fil_system.sys_space, page_no, &mtr); - DBUG_RETURN(err == DB_SUCCESS); + goto func_exit; } MY_ATTRIBUTE((nonnull, warn_unused_result)) @@ -3616,9 +316,7 @@ ibuf_insert_to_index_page_low( return DB_SUCCESS; /* Page reorganization or recompression should already have been - attempted by page_cur_tuple_insert(). Besides, per - ibuf_index_page_calc_free_zip() the page should not have been - recompressed or reorganized. */ + attempted by page_cur_tuple_insert(). */ ut_ad(!is_buf_block_get_page_zip(page_cur->block)); /* If the record did not fit, reorganize */ @@ -3656,19 +354,16 @@ ibuf_insert_to_index_page( block->page.id().page_no())); ut_ad(!dict_index_is_online_ddl(index));// this is an ibuf_dummy index - ut_ad(ibuf_inside(mtr)); ut_ad(dtuple_check_typed(entry)); #ifdef BTR_CUR_HASH_ADAPT - /* A change buffer merge must occur before users are granted - any access to the page. No adaptive hash index entries may - point to a freshly read page. */ + /* ibuf_cleanup() must finish before the adaptive hash index + can be inserted into. */ ut_ad(!block->index); - assert_block_ahi_empty(block); #endif /* BTR_CUR_HASH_ADAPT */ ut_ad(mtr->is_named_space(block->page.id().space())); - if (UNIV_UNLIKELY(dict_table_is_comp(index->table) - != (ibool)!!page_is_comp(page))) { + if (UNIV_UNLIKELY(index->table->not_redundant() + != !!page_is_comp(page))) { return DB_CORRUPTION; } @@ -3808,7 +503,6 @@ ibuf_set_del_mark( page_cur.index = index; ulint up_match = 0, low_match = 0; - ut_ad(ibuf_inside(mtr)); ut_ad(dtuple_check_typed(entry)); if (!page_cur_search_with_match(entry, PAGE_CUR_LE, @@ -3867,7 +561,6 @@ ibuf_delete( page_cur.index = index; ulint up_match = 0, low_match = 0; - ut_ad(ibuf_inside(mtr)); ut_ad(dtuple_check_typed(entry)); ut_ad(!index->is_spatial()); ut_ad(!index->is_clust()); @@ -3876,7 +569,6 @@ ibuf_delete( &up_match, &low_match, &page_cur, nullptr) && low_match == dtuple_get_n_fields(entry)) { - page_zip_des_t* page_zip= buf_block_get_page_zip(block); page_t* page = buf_block_get_frame(block); rec_t* rec = page_cur_get_rec(&page_cur); @@ -3886,7 +578,6 @@ ibuf_delete( rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs* offsets = offsets_; mem_heap_t* heap = NULL; - ulint max_ins_size = 0; rec_offs_init(offsets_); @@ -3917,12 +608,8 @@ ibuf_delete( return; } - if (!page_zip) { - max_ins_size - = page_get_max_insert_size_after_reorganize( - page, 1); - } #ifdef UNIV_ZIP_DEBUG + page_zip_des_t* page_zip= buf_block_get_page_zip(block); ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ page_cur_delete_rec(&page_cur, offsets, mtr); @@ -3930,774 +617,370 @@ ibuf_delete( ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ - if (page_zip) { - ibuf_update_free_bits_zip(block, mtr); - } else { - ibuf_update_free_bits_low(block, max_ins_size, mtr); - } - if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } } } -/*********************************************************************//** -Restores insert buffer tree cursor position -@return whether the position was restored */ -static MY_ATTRIBUTE((nonnull)) -bool -ibuf_restore_pos( -/*=============*/ - const page_id_t page_id,/*!< in: page identifier */ - const dtuple_t* search_tuple, - /*!< in: search tuple for entries of page_no */ - btr_latch_mode mode, /*!< in: BTR_MODIFY_LEAF or BTR_PURGE_TREE */ - btr_pcur_t* pcur, /*!< in/out: persistent cursor whose - position is to be restored */ - mtr_t* mtr) /*!< in/out: mini-transaction */ +/** Reset the bits in the bitmap page for the given page number. +@param bitmap change buffer bitmap page +@param offset page number +@param mtr mini-transaction */ +static void ibuf_reset(buf_block_t &bitmap, uint32_t offset, mtr_t *mtr) { - ut_ad(mode == BTR_MODIFY_LEAF || mode == BTR_PURGE_TREE); - - if (UNIV_LIKELY(pcur->restore_position(mode, mtr) == - btr_pcur_t::SAME_ALL)) { - return true; - } - - if (fil_space_t* s = fil_space_t::get(page_id.space())) { - ib::error() << "ibuf cursor restoration fails!" - " ibuf record inserted to page " - << page_id - << " in file " << s->chain.start->name; - s->release(); - - ib::error() << BUG_REPORT_MSG; - - rec_print_old(stderr, btr_pcur_get_rec(pcur)); - rec_print_old(stderr, pcur->old_rec); - dtuple_print(stderr, search_tuple); - } - - ibuf_btr_pcur_commit_specify_mtr(pcur, mtr); - return false; + offset&= uint32_t(bitmap.physical_size() - 1); + byte *map_byte= &bitmap.page.frame[PAGE_DATA + offset / 2]; + /* We must reset IBUF_BITMAP_BUFFERED, but at the same time we will also + reset IBUF_BITMAP_FREE (and IBUF_BITMAP_IBUF, which should be clear). */ + byte b= byte(*map_byte & ((offset & 1) ? byte{0xf} : byte{0xf0})); + mtr->write<1,mtr_t::MAYBE_NOP>(bitmap, map_byte, b); } -/** -Delete a change buffer record. -@param[in] page_id page identifier -@param[in,out] pcur persistent cursor positioned on the record -@param[in] search_tuple search key for (space,page_no) -@param[in,out] mtr mini-transaction -@return whether mtr was committed (due to pessimistic operation) */ -static MY_ATTRIBUTE((warn_unused_result, nonnull)) -bool ibuf_delete_rec(const page_id_t page_id, btr_pcur_t* pcur, - const dtuple_t* search_tuple, mtr_t* mtr) +/** Move to the next change buffer record. */ +ATTRIBUTE_COLD static dberr_t ibuf_move_to_next(btr_cur_t *cur, mtr_t *mtr) { - dberr_t err; - - ut_ad(ibuf_inside(mtr)); - ut_ad(page_rec_is_user_rec(btr_pcur_get_rec(pcur))); - ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) - == page_id.page_no()); - ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) - == page_id.space()); - - switch (btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), - BTR_CREATE_FLAG, mtr)) { - case DB_FAIL: - break; - case DB_SUCCESS: - if (page_is_empty(btr_pcur_get_page(pcur))) { - /* If a B-tree page is empty, it must be the root page - and the whole B-tree must be empty. InnoDB does not - allow empty B-tree pages other than the root. */ - ut_d(const page_t* root = btr_pcur_get_page(pcur)); - - ut_ad(page_get_space_id(root) == IBUF_SPACE_ID); - ut_ad(page_get_page_no(root) - == FSP_IBUF_TREE_ROOT_PAGE_NO); - - /* ibuf.empty is protected by the root page latch. - Before the deletion, it had to be FALSE. */ - ut_ad(!ibuf.empty); - ibuf.empty = true; - } - /* fall through */ - default: - return(FALSE); - } - - /* We have to resort to a pessimistic delete from ibuf. - Delete-mark the record so that it will not be applied again, - in case the server crashes before the pessimistic delete is - made persistent. */ - btr_rec_set_deleted(btr_pcur_get_block(pcur), - btr_pcur_get_rec(pcur), mtr); - - btr_pcur_store_position(pcur, mtr); - ibuf_btr_pcur_commit_specify_mtr(pcur, mtr); - - ibuf_mtr_start(mtr); - mysql_mutex_lock(&ibuf_mutex); - - if (!ibuf_restore_pos(page_id, search_tuple, BTR_PURGE_TREE, - pcur, mtr)) { - - mysql_mutex_unlock(&ibuf_mutex); - ut_ad(mtr->has_committed()); - goto func_exit; - } - - if (buf_block_t* ibuf_root = ibuf_tree_root_get(mtr)) { - btr_cur_pessimistic_delete(&err, TRUE, - btr_pcur_get_btr_cur(pcur), - BTR_CREATE_FLAG, false, mtr); - ut_a(err == DB_SUCCESS); - - ibuf_size_update(ibuf_root->page.frame); - mysql_mutex_unlock(&ibuf_mutex); - - ibuf.empty = page_is_empty(ibuf_root->page.frame); - } else { - mysql_mutex_unlock(&ibuf_mutex); - } - - ibuf_btr_pcur_commit_specify_mtr(pcur, mtr); - -func_exit: - ut_ad(mtr->has_committed()); - btr_pcur_close(pcur); - - return(TRUE); -} + if (!page_cur_move_to_next(&cur->page_cur)) + return DB_CORRUPTION; + if (!page_cur_is_after_last(&cur->page_cur)) + return DB_SUCCESS; -/** Check whether buffered changes exist for a page. -@param[in] id page identifier -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@return whether buffered changes exist */ -bool ibuf_page_exists(const page_id_t id, ulint zip_size) -{ - ut_ad(!fsp_is_system_temporary(id.space())); + /* The following is adapted from btr_pcur_move_to_next_page(), + but we will not release any latches. */ - const ulint physical_size = zip_size ? zip_size : srv_page_size; + const buf_block_t &block= *cur->page_cur.block; + const uint32_t next_page_no= btr_page_get_next(block.page.frame); + switch (next_page_no) { + case 0: + case 1: + return DB_CORRUPTION; + case FIL_NULL: + return DB_SUCCESS; + } - if (ibuf_fixed_addr_page(id, physical_size) - || fsp_descr_page(id, physical_size)) { - return false; - } + if (UNIV_UNLIKELY(next_page_no == block.page.id().page_no())) + return DB_CORRUPTION; - mtr_t mtr; - bool bitmap_bits = false; + dberr_t err; + buf_block_t *next= + btr_block_get(*cur->index(), next_page_no, BTR_MODIFY_LEAF, mtr, &err); + if (!next) + return err; - ibuf_mtr_start(&mtr); - if (const buf_block_t* bitmap_page = ibuf_bitmap_get_map_page( - id, zip_size, &mtr)) { - bitmap_bits = ibuf_bitmap_page_get_bits( - bitmap_page->page.frame, id, zip_size, - IBUF_BITMAP_BUFFERED, &mtr) != 0; - } - ibuf_mtr_commit(&mtr); - return bitmap_bits; -} + if (UNIV_UNLIKELY(memcmp_aligned<4>(next->page.frame + FIL_PAGE_PREV, + block.page.frame + FIL_PAGE_OFFSET, 4))) + return DB_CORRUPTION; -/** Reset the bits in the bitmap page for the given block and page id. -@param b X-latched secondary index page (nullptr to discard changes) -@param page_id page identifier -@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param mtr mini-transaction */ -static void ibuf_reset_bitmap(buf_block_t *b, page_id_t page_id, - ulint zip_size, mtr_t *mtr) -{ - buf_block_t *bitmap= ibuf_bitmap_get_map_page(page_id, zip_size, mtr); - if (!bitmap) - return; - - const ulint physical_size = zip_size ? zip_size : srv_page_size; - /* FIXME: update the bitmap byte only once! */ - ibuf_bitmap_page_set_bits(bitmap, page_id, - physical_size, false, mtr); - - if (b) - ibuf_bitmap_page_set_bits(bitmap, page_id, physical_size, - ibuf_index_page_calc_free(b), - mtr); + page_cur_set_before_first(next, &cur->page_cur); + return page_cur_move_to_next(&cur->page_cur) ? DB_SUCCESS : DB_CORRUPTION; } -/** When an index page is read from a disk to the buffer pool, this function -applies any buffered operations to the page and deletes the entries from the -insert buffer. If the page is not read, but created in the buffer pool, this -function deletes its buffered entries from the insert buffer; there can -exist entries for such a page if the page belonged to an index which -subsequently was dropped. -@param block X-latched page to try to apply changes to, or NULL to discard -@param page_id page identifier -@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@return error code */ -dberr_t ibuf_merge_or_delete_for_page(buf_block_t *block, - const page_id_t page_id, - ulint zip_size) +/** Apply changes to a block. */ +ATTRIBUTE_COLD +static dberr_t ibuf_merge(fil_space_t *space, btr_cur_t *cur, mtr_t *mtr) { - if (trx_sys_hdr_page(page_id)) { - return DB_SUCCESS; - } - - ut_ad(!block || page_id == block->page.id()); - ut_ad(!block || block->page.frame); - ut_ad(!block || !block->page.is_ibuf_exist()); - ut_ad(!block || !block->page.is_reinit()); - ut_ad(!trx_sys_hdr_page(page_id)); - ut_ad(page_id < page_id_t(SRV_SPACE_ID_UPPER_BOUND, 0)); - - const ulint physical_size = zip_size ? zip_size : srv_page_size; - - if (ibuf_fixed_addr_page(page_id, physical_size) - || fsp_descr_page(page_id, physical_size)) { - return DB_SUCCESS; - } - - btr_pcur_t pcur; -#ifdef UNIV_IBUF_DEBUG - ulint volume = 0; -#endif /* UNIV_IBUF_DEBUG */ - dberr_t err = DB_SUCCESS; - mtr_t mtr; - - fil_space_t* space = fil_space_t::get(page_id.space()); - - if (UNIV_UNLIKELY(!space)) { - block = nullptr; - } else { - ulint bitmap_bits = 0; - - ibuf_mtr_start(&mtr); - - buf_block_t* bitmap_page = ibuf_bitmap_get_map_page( - page_id, zip_size, &mtr); - - if (bitmap_page - && fil_page_get_type(bitmap_page->page.frame) - != FIL_PAGE_TYPE_ALLOCATED) { - bitmap_bits = ibuf_bitmap_page_get_bits( - bitmap_page->page.frame, page_id, zip_size, - IBUF_BITMAP_BUFFERED, &mtr); - } - - ibuf_mtr_commit(&mtr); - - if (bitmap_bits - && DB_SUCCESS - == fseg_page_is_allocated(space, page_id.page_no())) { - ibuf_mtr_start(&mtr); - mtr.set_named_space(space); - ibuf_reset_bitmap(block, page_id, zip_size, &mtr); - ibuf_mtr_commit(&mtr); - bitmap_bits = 0; - if (!block - || btr_page_get_index_id(block->page.frame) - != DICT_IBUF_ID_MIN + IBUF_SPACE_ID) { - ibuf_delete_recs(page_id); - } - } - - if (!bitmap_bits) { - /* No changes are buffered for this page. */ - space->release(); - return DB_SUCCESS; - } - } - - if (!block) { - } else if (!fil_page_index_page_check(block->page.frame) - || !page_is_leaf(block->page.frame)) { - space->set_corrupted(); - err = DB_CORRUPTION; - block = nullptr; - } else { - /* Move the ownership of the x-latch on the page to this OS - thread, so that we can acquire a second x-latch on it. This - is needed for the insert operations to the index page to pass - the debug checks. */ - - block->page.lock.claim_ownership(); - } - - mem_heap_t* heap = mem_heap_create(512); - - const dtuple_t* search_tuple = ibuf_search_tuple_build( - page_id.space(), page_id.page_no(), heap); - - /* Counts for merged & discarded operations. */ - ulint mops[IBUF_OP_COUNT]; - ulint dops[IBUF_OP_COUNT]; + if (btr_cur_get_rec(cur)[4]) + return DB_CORRUPTION; - memset(mops, 0, sizeof(mops)); - memset(dops, 0, sizeof(dops)); - pcur.btr_cur.page_cur.index = ibuf.index; + const uint32_t space_id= mach_read_from_4(btr_cur_get_rec(cur)); + const uint32_t page_no= mach_read_from_4(btr_cur_get_rec(cur) + 5); -loop: - ibuf_mtr_start(&mtr); + buf_block_t *block= space && page_no < space->size + ? buf_page_get_gen(page_id_t{space_id, page_no}, space->zip_size(), + RW_X_LATCH, nullptr, BUF_GET_POSSIBLY_FREED, mtr) + : nullptr; - /* Position pcur in the insert buffer at the first entry for this - index page */ - if (btr_pcur_open_on_user_rec(search_tuple, PAGE_CUR_GE, - BTR_MODIFY_LEAF, &pcur, &mtr) - != DB_SUCCESS) { - err = DB_CORRUPTION; - goto reset_bit; - } - - if (block) { - block->page.fix(); - block->page.lock.x_lock_recursive(); - mtr.memo_push(block, MTR_MEMO_PAGE_X_FIX); - } - - if (space) { - mtr.set_named_space(space); - } - - if (!btr_pcur_is_on_user_rec(&pcur)) { - ut_ad(btr_pcur_is_after_last_on_page(&pcur)); - goto reset_bit; - } + buf_block_t *bitmap= block + ? buf_page_get_gen(page_id_t(space_id, + uint32_t(page_no & + ~(block->physical_size() - 1)) + 1), + block->zip_size(), RW_X_LATCH, nullptr, + BUF_GET_POSSIBLY_FREED, mtr) + : nullptr; - for (;;) { - rec_t* rec; + if (!block); + else if (fil_page_get_type(block->page.frame) != FIL_PAGE_INDEX || + !page_is_leaf(block->page.frame) || + DB_SUCCESS == fseg_page_is_allocated(space, page_no)) + block= nullptr; - ut_ad(btr_pcur_is_on_user_rec(&pcur)); + do + { + rec_t *rec= cur->page_cur.rec; + ulint n_fields= rec_get_n_fields_old(rec); - rec = btr_pcur_get_rec(&pcur); + if (n_fields <= IBUF_REC_FIELD_USER + 1 || rec[4]) + return DB_CORRUPTION; - /* Check if the entry is for this index page */ - if (ibuf_rec_get_page_no(&mtr, rec) != page_id.page_no() - || ibuf_rec_get_space(&mtr, rec) != page_id.space()) { + n_fields-= IBUF_REC_FIELD_USER; - if (block != NULL) { - page_header_reset_last_insert(block, &mtr); - } + ulint types_len, not_redundant; - goto reset_bit; - } + if (rec_get_1byte_offs_flag(rec)) + { + if (rec_1_get_field_end_info(rec, 0) != 4 || + rec_1_get_field_end_info(rec, 1) != 5 || + rec_1_get_field_end_info(rec, 2) != 9) + return DB_CORRUPTION; + types_len= rec_1_get_field_end_info(rec, 3); + } + else + { + if (rec_2_get_field_end_info(rec, 0) != 4 || + rec_2_get_field_end_info(rec, 1) != 5 || + rec_2_get_field_end_info(rec, 2) != 9) + return DB_CORRUPTION; + types_len= rec_2_get_field_end_info(rec, 3); + } - if (err) { - fputs("InnoDB: Discarding record\n ", stderr); - rec_print_old(stderr, rec); - fputs("\nInnoDB: from the insert buffer!\n\n", stderr); - } else if (block != NULL && !rec_get_deleted_flag(rec, 0)) { - /* Now we have at pcur a record which should be - applied on the index page; NOTE that the call below - copies pointers to fields in rec, and we must - keep the latch to the rec page until the - insertion is finished! */ - dtuple_t* entry; - trx_id_t max_trx_id; - dict_index_t* dummy_index; - ibuf_op_t op = ibuf_rec_get_op_type(&mtr, rec); - - max_trx_id = page_get_max_trx_id(page_align(rec)); - page_update_max_trx_id(block, - buf_block_get_page_zip(block), - max_trx_id, &mtr); - - ut_ad(page_validate(page_align(rec), ibuf.index)); - - entry = ibuf_build_entry_from_ibuf_rec( - &mtr, rec, heap, &dummy_index); - ut_ad(!dummy_index->table->space); - dummy_index->table->space = space; - dummy_index->table->space_id = space->id; - - ut_ad(page_validate(block->page.frame, dummy_index)); - - switch (op) { - case IBUF_OP_INSERT: -#ifdef UNIV_IBUF_DEBUG - volume += rec_get_converted_size( - dummy_index, entry, 0); - - volume += page_dir_calc_reserved_space(1); - - ut_a(volume <= (4U << srv_page_size_shift) - / IBUF_PAGE_SIZE_PER_FREE_SPACE); -#endif - ibuf_insert_to_index_page( - entry, block, dummy_index, &mtr); - break; - - case IBUF_OP_DELETE_MARK: - ibuf_set_del_mark( - entry, block, dummy_index, &mtr); - break; - - case IBUF_OP_DELETE: - ibuf_delete(entry, block, dummy_index, &mtr); - /* Because ibuf_delete() will latch an - insert buffer bitmap page, commit mtr - before latching any further pages. - Store and restore the cursor position. */ - ut_ad(rec == btr_pcur_get_rec(&pcur)); - ut_ad(page_rec_is_user_rec(rec)); - ut_ad(ibuf_rec_get_page_no(&mtr, rec) - == page_id.page_no()); - ut_ad(ibuf_rec_get_space(&mtr, rec) - == page_id.space()); - - /* Mark the change buffer record processed, - so that it will not be merged again in case - the server crashes between the following - mtr_commit() and the subsequent mtr_commit() - of deleting the change buffer record. */ - btr_rec_set_deleted( - btr_pcur_get_block(&pcur), - btr_pcur_get_rec(&pcur), &mtr); - - btr_pcur_store_position(&pcur, &mtr); - ibuf_btr_pcur_commit_specify_mtr(&pcur, &mtr); - - ibuf_mtr_start(&mtr); - mtr.set_named_space(space); - - block->page.lock.x_lock_recursive(); - block->fix(); - mtr.memo_push(block, MTR_MEMO_PAGE_X_FIX); - - if (!ibuf_restore_pos(page_id, search_tuple, - BTR_MODIFY_LEAF, - &pcur, &mtr)) { - - ut_ad(mtr.has_committed()); - mops[op]++; - ibuf_dummy_index_free(dummy_index); - goto loop; - } - - break; - default: - ut_error; - } - - mops[op]++; - - ibuf_dummy_index_free(dummy_index); - } else { - dops[ibuf_rec_get_op_type(&mtr, rec)]++; - } + if (types_len < 9 || (types_len - 9) / 6 != n_fields) + return DB_CORRUPTION; - /* Delete the record from ibuf */ - if (ibuf_delete_rec(page_id, &pcur, search_tuple, &mtr)) { - /* Deletion was pessimistic and mtr was committed: - we start from the beginning again */ + ibuf_op op= IBUF_OP_INSERT; + const ulint info_len= (types_len - 9) % 6; - ut_ad(mtr.has_committed()); - goto loop; - } else if (btr_pcur_is_after_last_on_page(&pcur)) { - ibuf_mtr_commit(&mtr); - goto loop; - } - } + switch (info_len) { + default: + return DB_CORRUPTION; + case 0: case 1: + not_redundant= info_len; + break; + case 4: + not_redundant= rec[9 + 3]; + if (rec[9 + 2] > IBUF_OP_DELETE || not_redundant > 1) + return DB_CORRUPTION; + op= static_cast(rec[9 + 2]); + } -reset_bit: - if (space) { - ibuf_reset_bitmap(block, page_id, zip_size, &mtr); - } + const byte *const types= rec + 9 + info_len; - ibuf_mtr_commit(&mtr); - ut_free(pcur.old_rec_buf); + if (ibuf_rec_get_space(rec) != space_id || + ibuf_rec_get_page_no(rec) != page_no) + break; - if (space) { - space->release(); - } + if (!rec_get_deleted_flag(rec, 0)) + { + /* Delete-mark the record so that it will not be applied again if + the server is killed before the completion of ibuf_upgrade(). */ + btr_rec_set_deleted(cur->page_cur.block, rec, mtr); + + if (block) + { + page_header_reset_last_insert(block, mtr); + page_update_max_trx_id(block, buf_block_get_page_zip(block), + page_get_max_trx_id(page_align(rec)), mtr); + dict_index_t *index; + mem_heap_t *heap = mem_heap_create(512); + dtuple_t *entry= ibuf_entry_build(rec, not_redundant, n_fields, + types, heap, index); + dict_table_t *table= index->table; + ut_ad(!table->space); + table->space= space; + table->space_id= space_id; + + switch (op) { + case IBUF_OP_INSERT: + ibuf_insert_to_index_page(entry, block, index, mtr); + break; + case IBUF_OP_DELETE_MARK: + ibuf_set_del_mark(entry, block, index, mtr); + break; + case IBUF_OP_DELETE: + ibuf_delete(entry, block, index, mtr); + break; + } + + mem_heap_free(heap); + dict_mem_index_free(index); + dict_mem_table_free(table); + } + } - mem_heap_free(heap); + if (dberr_t err= ibuf_move_to_next(cur, mtr)) + return err; + } + while (!page_cur_is_after_last(&cur->page_cur)); - ibuf.n_merges++; - ibuf_add_ops(ibuf.n_merged_ops, mops); - ibuf_add_ops(ibuf.n_discarded_ops, dops); + if (bitmap) + ibuf_reset(*bitmap, page_no, mtr); - return err; + return DB_SUCCESS; } -/** Delete all change buffer entries for a tablespace, -in DISCARD TABLESPACE, IMPORT TABLESPACE, or read-ahead. -@param[in] space missing or to-be-discarded tablespace */ -void ibuf_delete_for_discarded_space(uint32_t space) +ATTRIBUTE_COLD dberr_t ibuf_upgrade() { - btr_pcur_t pcur; - const rec_t* ibuf_rec; - mtr_t mtr; - - /* Counts for discarded operations. */ - ulint dops[IBUF_OP_COUNT]; - - dfield_t dfield[IBUF_REC_FIELD_METADATA]; - dtuple_t search_tuple {0,IBUF_REC_FIELD_METADATA, - IBUF_REC_FIELD_METADATA,dfield,0 - ,nullptr -#ifdef UNIV_DEBUG - ,DATA_TUPLE_MAGIC_N -#endif /* UNIV_DEBUG */ - }; - byte space_id[4]; - mach_write_to_4(space_id, space); - - dfield_set_data(&dfield[0], space_id, 4); - dfield_set_data(&dfield[1], field_ref_zero, 1); - dfield_set_data(&dfield[2], field_ref_zero, 4); - dtuple_set_types_binary(&search_tuple, IBUF_REC_FIELD_METADATA); - /* Use page number 0 to build the search tuple so that we get the - cursor positioned at the first entry for this space id */ - - memset(dops, 0, sizeof(dops)); - pcur.btr_cur.page_cur.index = ibuf.index; - -loop: - log_free_check(); - ibuf_mtr_start(&mtr); - - /* Position pcur in the insert buffer at the first entry for the - space */ - if (btr_pcur_open_on_user_rec(&search_tuple, PAGE_CUR_GE, - BTR_MODIFY_LEAF, &pcur, &mtr) - != DB_SUCCESS) { - goto leave_loop; - } - - if (!btr_pcur_is_on_user_rec(&pcur)) { - ut_ad(btr_pcur_is_after_last_on_page(&pcur)); - goto leave_loop; - } - - for (;;) { - ut_ad(btr_pcur_is_on_user_rec(&pcur)); - - ibuf_rec = btr_pcur_get_rec(&pcur); + if (srv_read_only_mode) + { + sql_print_error("InnoDB: innodb_read_only_mode prevents an upgrade"); + return DB_READ_ONLY; + } - /* Check if the entry is for this space */ - if (ibuf_rec_get_space(&mtr, ibuf_rec) != space) { + sql_print_information("InnoDB: Upgrading the change buffer"); - goto leave_loop; - } +#ifdef BTR_CUR_HASH_ADAPT + const bool ahi= btr_search_enabled; + if (ahi) + btr_search_disable(); +#endif - uint32_t page_no = ibuf_rec_get_page_no(&mtr, ibuf_rec); + dict_table_t *ibuf_table= dict_table_t::create({C_STRING_WITH_LEN("ibuf")}, + fil_system.sys_space, + 1, 0, 0, 0); + dict_index_t *ibuf_index= + dict_mem_index_create(ibuf_table, "CLUST_IND", DICT_CLUSTERED, 1); + ibuf_index->id= ibuf_index_id; + ibuf_index->n_uniq= REC_MAX_N_FIELDS; + ibuf_index->lock.SRW_LOCK_INIT(index_tree_rw_lock_key); + ibuf_index->page= FSP_IBUF_TREE_ROOT_PAGE_NO; + ut_d(ibuf_index->is_dummy= true); + ut_d(ibuf_index->cached= true); + + size_t spaces=0, pages= 0; + dberr_t err; + mtr_t mtr; + { + btr_cur_t cur; + uint32_t prev_space_id= ~0U; + fil_space_t *space= nullptr; - dops[ibuf_rec_get_op_type(&mtr, ibuf_rec)]++; + log_free_check(); + mtr.start(); + err= cur.open_leaf(true, ibuf_index, BTR_CONT_MODIFY_TREE, &mtr); - /* Delete the record from ibuf */ - if (ibuf_delete_rec(page_id_t(space, page_no), - &pcur, &search_tuple, &mtr)) { - /* Deletion was pessimistic and mtr was committed: - we start from the beginning again */ + if (err == DB_SUCCESS) + { + cur.page_cur.block->fix(); + mtr.page_lock(cur.page_cur.block, RW_X_LATCH); + err= ibuf_move_to_next(&cur, &mtr); + } - ut_ad(mtr.has_committed()); -clear: - ut_free(pcur.old_rec_buf); - goto loop; - } + while (err == DB_SUCCESS && !page_cur_is_after_last(&cur.page_cur)) + { + const uint32_t space_id= ibuf_rec_get_space(cur.page_cur.rec); + if (space_id != prev_space_id) + { + if (space) + space->release(); + prev_space_id= space_id; + space= fil_space_t::get(space_id); + if (space) + mtr.set_named_space(space); + spaces++; + } + pages++; + err= ibuf_merge(space, &cur, &mtr); + if (err == DB_SUCCESS) + { + /* Move to the next user index page. We buffer-fix the current + change buffer leaf page to prevent it from being evicted + before we have started a new mini-transaction. */ + cur.page_cur.block->fix(); + mtr.commit(); + + if (recv_sys.report(time(nullptr))) + { + sql_print_information("InnoDB: merged changes to" + " %zu tablespaces, %zu pages", spaces, pages); + service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, + "merged changes to" + " %zu tablespaces, %zu pages", + spaces, pages); + } + + log_free_check(); + mtr.start(); + mtr.page_lock(cur.page_cur.block, RW_X_LATCH); + if (space) + mtr.set_named_space(space); + } + } + mtr.commit(); + if (space) + space->release(); + } - if (btr_pcur_is_after_last_on_page(&pcur)) { - ibuf_mtr_commit(&mtr); - goto clear; - } - } + if (err == DB_SUCCESS) + { + mtr.start(); + if (buf_block_t *root= buf_page_get_gen(ibuf_root, 0, RW_X_LATCH, + nullptr, BUF_GET, &mtr, &err)) + { + page_create(root, &mtr, false); + mtr.write<2,mtr_t::MAYBE_NOP>(*root, PAGE_HEADER + PAGE_LEVEL + + root->page.frame, 0U); + } + mtr.commit(); -leave_loop: - ibuf_mtr_commit(&mtr); - ut_free(pcur.old_rec_buf); + while (err == DB_SUCCESS) + err= ibuf_remove_free_page(mtr); - ibuf_add_ops(ibuf.n_discarded_ops, dops); -} + if (err == DB_SUCCESS_LOCKED_REC) + err= DB_SUCCESS; + } -/******************************************************************//** -Looks if the insert buffer is empty. -@return true if empty */ -bool -ibuf_is_empty(void) -/*===============*/ -{ - mtr_t mtr; +#ifdef BTR_CUR_HASH_ADAPT + if (ahi) + btr_search_enable(); +#endif - ibuf_mtr_start(&mtr); + ibuf_index->lock.free(); + dict_mem_index_free(ibuf_index); + dict_mem_table_free(ibuf_table); - ut_d(mysql_mutex_lock(&ibuf_mutex)); - const buf_block_t* root = ibuf_tree_root_get(&mtr); - bool is_empty = root && page_is_empty(root->page.frame); - ut_ad(!root || is_empty == ibuf.empty); - ut_d(mysql_mutex_unlock(&ibuf_mutex)); - ibuf_mtr_commit(&mtr); + if (err) + sql_print_error("InnoDB: Unable to upgrade the change buffer"); + else + sql_print_information("InnoDB: Upgraded the change buffer: " + "%zu tablespaces, %zu pages", spaces, pages); - return(is_empty); + return err; } -/******************************************************************//** -Prints info of ibuf. */ -void -ibuf_print( -/*=======*/ - FILE* file) /*!< in: file where to print */ +dberr_t ibuf_upgrade_needed() { + mtr_t mtr; + mtr.start(); + mtr.x_lock_space(fil_system.sys_space); + dberr_t err; + const buf_block_t *header_page= + buf_page_get_gen(ibuf_header, 0, RW_S_LATCH, nullptr, BUF_GET, &mtr, &err); - mysql_mutex_lock(&ibuf_mutex); - if (ibuf.empty) + if (!header_page) { - mysql_mutex_unlock(&ibuf_mutex); - return; + err_exit: + sql_print_error("InnoDB: The change buffer is corrupted"); + if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) + err= DB_SUCCESS; + func_exit: + mtr.commit(); + return err; } - const ulint size= ibuf.size; - const ulint free_list_len= ibuf.free_list_len; - const ulint seg_size= ibuf.seg_size; - mysql_mutex_unlock(&ibuf_mutex); - - fprintf(file, - "-------------\n" - "INSERT BUFFER\n" - "-------------\n" - "size " ULINTPF ", free list len " ULINTPF "," - " seg size " ULINTPF ", " ULINTPF " merges\n", - size, free_list_len, seg_size, ulint{ibuf.n_merges}); - ibuf_print_ops("merged operations:\n", ibuf.n_merged_ops, file); - ibuf_print_ops("discarded operations:\n", ibuf.n_discarded_ops, file); -} - -/** Check the insert buffer bitmaps on IMPORT TABLESPACE. -@param[in] trx transaction -@param[in,out] space tablespace being imported -@return DB_SUCCESS or error code */ -dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) -{ - ut_ad(trx->mysql_thd); - ut_ad(space->purpose == FIL_TYPE_IMPORT); - - const unsigned zip_size = space->zip_size(); - const unsigned physical_size = space->physical_size(); - - uint32_t size= std::min(space->free_limit, space->size); - - if (size == 0) { - return(DB_TABLE_NOT_FOUND); - } - - mtr_t mtr; - - mysql_mutex_lock(&ibuf_mutex); - - /* The two bitmap pages (allocation bitmap and ibuf bitmap) repeat - every page_size pages. For example if page_size is 16 KiB, then the - two bitmap pages repeat every 16 KiB * 16384 = 256 MiB. In the loop - below page_no is measured in number of pages since the beginning of - the space, as usual. */ - - for (uint32_t page_no = 0; page_no < size; page_no += physical_size) { - if (trx_is_interrupted(trx)) { - mysql_mutex_unlock(&ibuf_mutex); - return(DB_INTERRUPTED); - } - - mtr_start(&mtr); - ibuf_enter(&mtr); - - buf_block_t* bitmap_page = ibuf_bitmap_get_map_page( - page_id_t(space->id, page_no), zip_size, &mtr); - if (!bitmap_page) { - mysql_mutex_unlock(&ibuf_mutex); - ibuf_exit(&mtr); - mtr.commit(); - return DB_CORRUPTION; - } - - if (buf_is_zeroes(span(bitmap_page->page.frame, - physical_size))) { - /* This means we got all-zero page instead of - ibuf bitmap page. The subsequent page should be - all-zero pages. */ -#ifdef UNIV_DEBUG - for (uint32_t curr_page = page_no + 1; - curr_page < physical_size; curr_page++) { - - buf_block_t* block = buf_page_get( - page_id_t(space->id, curr_page), - zip_size, RW_S_LATCH, &mtr); - page_t* page = buf_block_get_frame(block); - ut_ad(buf_is_zeroes(span( - page, - physical_size))); - } -#endif /* UNIV_DEBUG */ - ibuf_exit(&mtr); - mtr_commit(&mtr); - continue; - } - - for (uint32_t i = FSP_IBUF_BITMAP_OFFSET + 1; i < physical_size; - i++) { - const uint32_t offset = page_no + i; - const page_id_t cur_page_id(space->id, offset); - - if (ibuf_bitmap_page_get_bits( - bitmap_page->page.frame, - cur_page_id, zip_size, - IBUF_BITMAP_IBUF, &mtr)) { - - mysql_mutex_unlock(&ibuf_mutex); - ibuf_exit(&mtr); - mtr_commit(&mtr); - - ib_errf(trx->mysql_thd, - IB_LOG_LEVEL_ERROR, - ER_INNODB_INDEX_CORRUPT, - "File %s page %u" - " is wrongly flagged to belong to the" - " insert buffer", - space->chain.start->name, offset); - return(DB_CORRUPTION); - } - - if (ibuf_bitmap_page_get_bits( - bitmap_page->page.frame, - cur_page_id, zip_size, - IBUF_BITMAP_BUFFERED, &mtr)) { - - ib_errf(trx->mysql_thd, - IB_LOG_LEVEL_WARN, - ER_INNODB_INDEX_CORRUPT, - "Buffered changes" - " for file %s page %u are lost", - space->chain.start->name, offset); - - /* Tolerate this error, so that - slightly corrupted tables can be - imported and dumped. Clear the bit. */ - ibuf_bitmap_page_set_bits( - bitmap_page, cur_page_id, - physical_size, false, &mtr); - } - } - - ibuf_exit(&mtr); - mtr_commit(&mtr); - } - - mysql_mutex_unlock(&ibuf_mutex); - return(DB_SUCCESS); -} - -void ibuf_set_bitmap_for_bulk_load(buf_block_t *block, mtr_t *mtr, bool reset) -{ - ut_a(page_is_leaf(block->page.frame)); - const page_id_t id{block->page.id()}; - const auto zip_size= block->zip_size(); - - if (buf_block_t *bitmap_page= ibuf_bitmap_get_map_page(id, zip_size, mtr)) + const buf_block_t *root= buf_page_get_gen(ibuf_root, 0, RW_S_LATCH, nullptr, + BUF_GET, &mtr, &err); + if (!root) + goto err_exit; + + if (UNIV_LIKELY(!page_has_siblings(root->page.frame)) && + UNIV_LIKELY(!memcmp(root->page.frame + FIL_PAGE_TYPE, field_ref_zero, + srv_page_size - + (FIL_PAGE_DATA_END + FIL_PAGE_TYPE)))) + /* the change buffer was removed; no need to upgrade */; + else if (page_is_comp(root->page.frame) || + btr_page_get_index_id(root->page.frame) != ibuf_index_id || + fil_page_get_type(root->page.frame) != FIL_PAGE_INDEX) + { + err= DB_CORRUPTION; + goto err_exit; + } + else if (srv_read_only_mode) { - if (ibuf_bitmap_page_get_bits(bitmap_page->page.frame, id, zip_size, - IBUF_BITMAP_BUFFERED, mtr)) - ibuf_delete_recs(id); - - ulint free_val= reset ? 0 : ibuf_index_page_calc_free(block); - /* FIXME: update the bitmap byte only once! */ - ibuf_bitmap_page_set_bits - (bitmap_page, id, block->physical_size(), free_val, mtr); - ibuf_bitmap_page_set_bits - (bitmap_page, id, block->physical_size(), false, mtr); + sql_print_error("InnoDB: innodb_read_only=ON prevents an upgrade" + " of the change buffer"); + err= DB_READ_ONLY; } + else if (srv_force_recovery != SRV_FORCE_NO_LOG_REDO) + err= DB_FAIL; + + goto func_exit; } diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index a2aa46b62da5c..a397aa6b7f109 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2022, MariaDB Corporation. +Copyright (c) 2014, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -56,12 +56,8 @@ is acceptable for the program to die with a clear assert failure. */ #define BTR_MAX_LEVELS 100 #define BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode) \ - btr_latch_mode((latch_mode) & ~(BTR_INSERT \ - | BTR_DELETE_MARK \ - | BTR_RTREE_UNDO_INS \ + btr_latch_mode((latch_mode) & ~(BTR_RTREE_UNDO_INS \ | BTR_RTREE_DELETE_MARK \ - | BTR_DELETE \ - | BTR_IGNORE_SEC_UNIQUE \ | BTR_ALREADY_S_LATCHED \ | BTR_LATCH_FOR_INSERT \ | BTR_LATCH_FOR_DELETE)) @@ -79,6 +75,14 @@ btr_root_adjust_on_import( const dict_index_t* index) /*!< in: index tree */ MY_ATTRIBUTE((warn_unused_result)); +/** Check a file segment header within a B-tree root page. +@param offset file segment header offset +@param block B-tree root page +@param space tablespace +@return whether the segment header is valid */ +bool btr_root_fseg_validate(ulint offset, const buf_block_t &block, + const fil_space_t &space); + /** Report a decryption failure. */ ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index); @@ -86,12 +90,11 @@ ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index); @param[in] index index tree @param[in] page page number @param[in] mode latch mode -@param[in] merge whether change buffer merge should be attempted @param[in,out] mtr mini-transaction @param[out] err error code @return block */ buf_block_t *btr_block_get(const dict_index_t &index, - uint32_t page, ulint mode, bool merge, + uint32_t page, ulint mode, mtr_t *mtr, dberr_t *err= nullptr); /**************************************************************//** @@ -242,15 +245,7 @@ btr_root_raise_and_insert( mtr_t* mtr, /*!< in: mtr */ dberr_t* err) /*!< out: error code */ MY_ATTRIBUTE((warn_unused_result)); -/*************************************************************//** -Reorganizes an index page. - -IMPORTANT: On success, the caller will have to update IBUF_BITMAP_FREE -if this is a compressed leaf page in a secondary index. This has to -be done either within the same mini-transaction, or by invoking -ibuf_reset_free_bits() before mtr_commit(). On uncompressed pages, -IBUF_BITMAP_FREE is unaffected by reorganization. - +/** Reorganize an index page. @param cursor page cursor @param mtr mini-transaction @return error code @@ -348,6 +343,7 @@ btr_check_node_ptr( /*===============*/ dict_index_t* index, /*!< in: index tree */ buf_block_t* block, /*!< in: index page */ + que_thr_t* thr, /*!< in/out: query thread */ mtr_t* mtr) /*!< in: mtr */ MY_ATTRIBUTE((warn_unused_result)); #endif /* UNIV_DEBUG */ @@ -451,15 +447,8 @@ btr_root_block_get( or RW_X_LATCH */ mtr_t* mtr, /*!< in: mtr */ dberr_t* err); /*!< out: error code */ -/*************************************************************//** -Reorganizes an index page. - -IMPORTANT: On success, the caller will have to update IBUF_BITMAP_FREE -if this is a compressed leaf page in a secondary index. This has to -be done either within the same mini-transaction, or by invoking -ibuf_reset_free_bits() before mtr_commit(). On uncompressed pages, -IBUF_BITMAP_FREE is unaffected by reorganization. +/** Reorganize an index page. @return error code @retval DB_FAIL if reorganizing a ROW_FORMAT=COMPRESSED page failed */ dberr_t btr_page_reorganize_block( @@ -530,9 +519,10 @@ btr_lift_page_up( must not be empty: use btr_discard_only_page_on_level if the last record from the page should be removed */ + que_thr_t* thr, /*!< in/out: query thread for SPATIAL INDEX */ mtr_t* mtr, /*!< in/out: mini-transaction */ dberr_t* err) /*!< out: error code */ - __attribute__((nonnull)); + __attribute__((nonnull(1,2,4,5))); #define BTR_N_LEAF_PAGES 1 #define BTR_TOTAL_SIZE 2 diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 49bc8a4ff1bb7..b317b3abbc3e0 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -56,11 +56,7 @@ enum { BTR_KEEP_POS_FLAG = 8, /** the caller is creating the index or wants to bypass the index->info.online creation log */ - BTR_CREATE_FLAG = 16, - /** the caller of btr_cur_optimistic_update() or - btr_cur_update_in_place() will take care of - updating IBUF_BITMAP_FREE */ - BTR_KEEP_IBUF_BITMAP = 32 + BTR_CREATE_FLAG = 16 }; /* btr_cur_latch_leaves() returns latched blocks and savepoints. */ @@ -156,8 +152,7 @@ If mode is PAGE_CUR_GE, then up_match will a have a sensible value. PAGE_CUR_GE, as the latter may end up on the previous page of the record! Inserts should always be made using PAGE_CUR_LE to search the position! -@param latch_mode BTR_SEARCH_LEAF, ..., ORed with at most one of BTR_INSERT, - BTR_DELETE_MARK, or BTR_DELETE; +@param latch_mode BTR_SEARCH_LEAF, ... cursor->left_block is used to store a pointer to the left neighbor page @param cursor tree cursor; the cursor page is s- or x-latched, but see also @@ -242,14 +237,8 @@ btr_cur_pessimistic_insert( See if there is enough place in the page modification log to log an update-in-place. -@retval false if out of space; IBUF_BITMAP_FREE will be reset -outside mtr if the page was recompressed -@retval true if enough place; - -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if this is -a secondary index leaf page. This has to be done either within the -same mini-transaction, or by invoking ibuf_reset_free_bits() before -mtr_commit(mtr). */ +@retval false if out of space +@retval true if enough place */ bool btr_cur_update_alloc_zip_func( /*==========================*/ @@ -291,7 +280,7 @@ Updates a record when the update causes no size changes in its fields. @return locking or undo log related error code, or @retval DB_SUCCESS on success @retval DB_ZIP_OVERFLOW if there is not enough space left -on the compressed page (IBUF_BITMAP_FREE was reset outside mtr) */ +on a ROW_FORMAT=COMPRESSED page */ dberr_t btr_cur_update_in_place( /*====================*/ @@ -712,34 +701,19 @@ enum btr_cur_method { reference is stored in the field hash_node, and might be necessary to update */ - BTR_CUR_BINARY, /*!< success using the binary search */ - BTR_CUR_INSERT_TO_IBUF, /*!< performed the intended insert to - the insert buffer */ - BTR_CUR_DEL_MARK_IBUF, /*!< performed the intended delete - mark in the insert/delete buffer */ - BTR_CUR_DELETE_IBUF, /*!< performed the intended delete in - the insert/delete buffer */ - BTR_CUR_DELETE_REF /*!< row_purge_poss_sec() failed */ + BTR_CUR_BINARY /*!< success using the binary search */ }; /** The tree cursor: the definition appears here only for the compiler to know struct size! */ struct btr_cur_t { page_cur_t page_cur; /*!< page cursor */ - purge_node_t* purge_node; /*!< purge node, for BTR_DELETE */ buf_block_t* left_block; /*!< this field is used to store a pointer to the left neighbor page, in the cases BTR_SEARCH_PREV and BTR_MODIFY_PREV */ /*------------------------------*/ - que_thr_t* thr; /*!< this field is only used - when btr_cur_search_to_nth_level - is called for an index entry - insertion: the calling query - thread is passed here to be - used in the insert buffer */ - /*------------------------------*/ /** The following fields are used in btr_cur_search_to_nth_level to pass information: */ /* @{ */ diff --git a/storage/innobase/include/btr0types.h b/storage/innobase/include/btr0types.h index 6118bfbc1289d..0c0f4a9cc7965 100644 --- a/storage/innobase/include/btr0types.h +++ b/storage/innobase/include/btr0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2022, MariaDB Corporation. +Copyright (c) 2018, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -76,24 +76,8 @@ enum btr_latch_mode { /** Continue modifying the entire B-tree. */ BTR_CONT_MODIFY_TREE = 4 | BTR_MODIFY_TREE, - /* BTR_INSERT, BTR_DELETE and BTR_DELETE_MARK are mutually - exclusive. */ - /** The search tuple will be inserted to the secondary index - at the searched position. When the leaf page is not in the - buffer pool, try to use the change buffer. */ - BTR_INSERT = 64, - - /** Try to delete mark a secondary index leaf page record at - the searched position using the change buffer when the page is - not in the buffer pool. */ - BTR_DELETE_MARK = 128, - - /** Try to purge the record using the change buffer when the - secondary index leaf page is not in the buffer pool. */ - BTR_DELETE = BTR_INSERT | BTR_DELETE_MARK, - /** The caller is already holding dict_index_t::lock S-latch. */ - BTR_ALREADY_S_LATCHED = 256, + BTR_ALREADY_S_LATCHED = 16, /** Search and S-latch a leaf page, assuming that the dict_index_t::lock S-latch is being held. */ BTR_SEARCH_LEAF_ALREADY_S_LATCHED = BTR_SEARCH_LEAF @@ -107,28 +91,15 @@ enum btr_latch_mode { BTR_MODIFY_LEAF_ALREADY_LATCHED = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED, - /** Attempt to delete-mark a secondary index record. */ - BTR_DELETE_MARK_LEAF = BTR_MODIFY_LEAF | BTR_DELETE_MARK, - /** Attempt to delete-mark a secondary index record - while holding the dict_index_t::lock S-latch. */ - BTR_DELETE_MARK_LEAF_ALREADY_S_LATCHED = BTR_DELETE_MARK_LEAF - | BTR_ALREADY_S_LATCHED, - /** Attempt to purge a secondary index record. */ - BTR_PURGE_LEAF = BTR_MODIFY_LEAF | BTR_DELETE, - /** Attempt to purge a secondary index record - while holding the dict_index_t::lock S-latch. */ - BTR_PURGE_LEAF_ALREADY_S_LATCHED = BTR_PURGE_LEAF - | BTR_ALREADY_S_LATCHED, - /** In the case of BTR_MODIFY_TREE, the caller specifies the intention to delete record only. It is used to optimize block->lock range.*/ - BTR_LATCH_FOR_DELETE = 512, + BTR_LATCH_FOR_DELETE = 32, /** In the case of BTR_MODIFY_TREE, the caller specifies the intention to delete record only. It is used to optimize block->lock range.*/ - BTR_LATCH_FOR_INSERT = 1024, + BTR_LATCH_FOR_INSERT = 64, /** Attempt to delete a record in the tree. */ BTR_PURGE_TREE = BTR_MODIFY_TREE | BTR_LATCH_FOR_DELETE, @@ -136,12 +107,8 @@ enum btr_latch_mode { /** Attempt to insert a record into the tree. */ BTR_INSERT_TREE = BTR_MODIFY_TREE | BTR_LATCH_FOR_INSERT, - /** This flag ORed to BTR_INSERT says that we can ignore possible - UNIQUE definition on secondary indexes when we decide if we can use - the insert buffer to speed up inserts */ - BTR_IGNORE_SEC_UNIQUE = 2048, /** Rollback in spatial index */ - BTR_RTREE_UNDO_INS = 4096, + BTR_RTREE_UNDO_INS = 128, /** Try to delete mark a spatial index record */ - BTR_RTREE_DELETE_MARK = 8192 + BTR_RTREE_DELETE_MARK = 256 }; diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 24571483d05c5..5fc8789f3653b 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -48,10 +48,6 @@ Created 11/5/1995 Heikki Tuuri #define BUF_GET_IF_IN_POOL 11 /*!< get if in pool */ #define BUF_PEEK_IF_IN_POOL 12 /*!< get if in pool, do not make the block young in the LRU list */ -#define BUF_GET_IF_IN_POOL_OR_WATCH 15 - /*!< Get the page only if it's in the - buffer pool, if not then set a watch - on the page. */ #define BUF_GET_POSSIBLY_FREED 16 /*!< Like BUF_GET, but do not mind if the file page has been freed. */ @@ -194,11 +190,9 @@ buf_page_t *buf_page_get_zip(const page_id_t page_id, ulint zip_size); @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, -BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH +or BUF_PEEK_IF_IN_POOL @param[in,out] mtr mini-transaction @param[out] err DB_SUCCESS or error code -@param[in] allow_ibuf_merge Allow change buffer merge while -reading the pages from file. @return pointer to the block or NULL */ buf_block_t* buf_page_get_gen( @@ -208,9 +202,8 @@ buf_page_get_gen( buf_block_t* guess, ulint mode, mtr_t* mtr, - dberr_t* err = NULL, - bool allow_ibuf_merge = false) - MY_ATTRIBUTE((nonnull(6), warn_unused_result)); + dberr_t* err = NULL) + MY_ATTRIBUTE((nonnull(6))); /** This is the low level function used to get access to a database page. @param[in] page_id page id @@ -218,14 +211,10 @@ buf_page_get_gen( @param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, -BUF_PEEK_IF_IN_POOL, or BUF_GET_IF_IN_POOL_OR_WATCH +or BUF_PEEK_IF_IN_POOL @param[in,out] mtr mini-transaction, or NULL if a block with page_id is to be evicted @param[out] err DB_SUCCESS or error code -@param[in] allow_ibuf_merge Allow change buffer merge to happen -while reading the page from file -then it makes sure that it does merging of change buffer changes while -reading the page from file. @return pointer to the block or NULL */ buf_block_t* buf_page_get_low( @@ -235,8 +224,7 @@ buf_page_get_low( buf_block_t* guess, ulint mode, mtr_t* mtr, - dberr_t* err, - bool allow_ibuf_merge); + dberr_t* err); /** Initialize a page in the buffer pool. The page is usually not read from a file even if it cannot be found in the buffer buf_pool. This is one @@ -539,18 +527,16 @@ class buf_page_t static constexpr uint32_t REMOVE_HASH= 2; /** smallest state() of a buffer page that is freed in the tablespace */ static constexpr uint32_t FREED= 3; + /* unused state: 1U<<29 */ /** smallest state() for a block that belongs to buf_pool.LRU */ - static constexpr uint32_t UNFIXED= 1U << 29; - /** smallest state() of a block for which buffered changes may exist */ - static constexpr uint32_t IBUF_EXIST= 2U << 29; + static constexpr uint32_t UNFIXED= 2U << 29; /** smallest state() of a (re)initialized page (no doublewrite needed) */ static constexpr uint32_t REINIT= 3U << 29; /** smallest state() for an io-fixed block */ static constexpr uint32_t READ_FIX= 4U << 29; + /* unused state: 5U<<29 */ /** smallest state() for a write-fixed block */ - static constexpr uint32_t WRITE_FIX= 5U << 29; - /** smallest state() for a write-fixed block with buffered changes */ - static constexpr uint32_t WRITE_FIX_IBUF= 6U << 29; + static constexpr uint32_t WRITE_FIX= 6U << 29; /** smallest state() for a write-fixed block (no doublewrite was used) */ static constexpr uint32_t WRITE_FIX_REINIT= 7U << 29; /** buf_pool.LRU status mask in state() */ @@ -562,8 +548,7 @@ class buf_page_t byte *frame; /* @} */ /** ROW_FORMAT=COMPRESSED page; zip.data (but not the data it points to) - is also protected by buf_pool.mutex; - !frame && !zip.data means an active buf_pool.watch */ + is also protected by buf_pool.mutex */ page_zip_des_t zip; #ifdef UNIV_DEBUG /** whether this->list is in buf_pool.zip_hash; protected by buf_pool.mutex */ @@ -657,6 +642,18 @@ class buf_page_t access_time= 0; } + void set_os_unused() + { + MEM_NOACCESS(frame, srv_page_size); +#ifdef MADV_FREE + madvise(frame, srv_page_size, MADV_FREE); +#endif + } + + void set_os_used() const + { + MEM_MAKE_ADDRESSABLE(frame, srv_page_size); + } public: const page_id_t &id() const { return id_; } uint32_t state() const { return zip.fix; } @@ -684,13 +681,6 @@ class buf_page_t bool is_freed() const { const auto s= state(); ut_ad(s >= FREED); return s < UNFIXED; } - bool is_ibuf_exist() const - { - const auto s= state(); - ut_ad(s >= UNFIXED); - ut_ad(s < READ_FIX); - return (s & LRU_MASK) == IBUF_EXIST; - } bool is_reinit() const { return !(~state() & REINIT); } void set_reinit(uint32_t prev_state) @@ -701,29 +691,10 @@ class buf_page_t ut_ad(s < prev_state + UNFIXED); } - void set_ibuf_exist() - { - ut_ad(lock.is_write_locked()); - ut_ad(id() < page_id_t(SRV_SPACE_ID_UPPER_BOUND, 0)); - const auto s= state(); - ut_ad(s >= UNFIXED); - ut_ad(s < READ_FIX); - ut_ad(s < IBUF_EXIST || s >= REINIT); - zip.fix.fetch_add(IBUF_EXIST - (LRU_MASK & s)); - } - void clear_ibuf_exist() - { - ut_ad(lock.is_write_locked()); - ut_ad(id() < page_id_t(SRV_SPACE_ID_UPPER_BOUND, 0)); - ut_d(const auto s=) zip.fix.fetch_sub(IBUF_EXIST - UNFIXED); - ut_ad(s >= IBUF_EXIST); - ut_ad(s < REINIT); - } - void read_unfix(uint32_t s) { ut_ad(lock.is_write_locked()); - ut_ad(s == UNFIXED + 1 || s == IBUF_EXIST + 1 || s == REINIT + 1); + ut_ad(s == UNFIXED + 1 || s == REINIT + 1); ut_d(auto old_state=) zip.fix.fetch_add(s - READ_FIX); ut_ad(old_state >= READ_FIX); ut_ad(old_state < WRITE_FIX); @@ -810,7 +781,7 @@ class buf_page_t uint32_t fix(uint32_t count= 1) { ut_ad(count); - ut_ad(count < IBUF_EXIST); + ut_ad(count < REINIT); uint32_t f= zip.fix.fetch_add(count); ut_ad(f >= FREED); ut_ad(!((f ^ (f + 1)) & LRU_MASK)); @@ -1414,82 +1385,6 @@ class buf_pool_t } public: - /** @return whether the buffer pool contains a page - @tparam allow_watch whether to allow watch_is_sentinel() - @param page_id page identifier - @param chain hash table chain for page_id.fold() */ - template - TRANSACTIONAL_INLINE - bool page_hash_contains(const page_id_t page_id, hash_chain &chain) - { - transactional_shared_lock_guard g - {page_hash.lock_get(chain)}; - buf_page_t *bpage= page_hash.get(page_id, chain); - if (bpage >= &watch[0] && bpage < &watch[UT_ARR_SIZE(watch)]) - { - ut_ad(!bpage->in_zip_hash); - ut_ad(!bpage->zip.data); - if (!allow_watch) - bpage= nullptr; - } - return bpage; - } - - /** Determine if a block is a sentinel for a buffer pool watch. - @param bpage page descriptor - @return whether bpage a sentinel for a buffer pool watch */ - bool watch_is_sentinel(const buf_page_t &bpage) - { -#ifdef SAFE_MUTEX - DBUG_ASSERT(mysql_mutex_is_owner(&mutex) || - page_hash.lock_get(page_hash.cell_get(bpage.id().fold())). - is_locked()); -#endif /* SAFE_MUTEX */ - ut_ad(bpage.in_file()); - if (&bpage < &watch[0] || &bpage >= &watch[array_elements(watch)]) - return false; - ut_ad(!bpage.in_zip_hash); - ut_ad(!bpage.zip.data); - return true; - } - - /** Check if a watched page has been read. - This may only be called after !watch_set() and before invoking watch_unset(). - @param id page identifier - @return whether the page was read to the buffer pool */ - TRANSACTIONAL_INLINE - bool watch_occurred(const page_id_t id) - { - hash_chain &chain= page_hash.cell_get(id.fold()); - transactional_shared_lock_guard g - {page_hash.lock_get(chain)}; - /* The page must exist because watch_set() increments buf_fix_count. */ - return !watch_is_sentinel(*page_hash.get(id, chain)); - } - - /** Register a watch for a page identifier. The caller must hold an - exclusive page hash latch. The *hash_lock may be released, - relocated, and reacquired. - @param id page identifier - @param chain hash table chain with exclusively held page_hash - @return a buffer pool block corresponding to id - @retval nullptr if the block was not present, and a watch was installed */ - inline buf_page_t *watch_set(const page_id_t id, hash_chain &chain); - - /** Stop watching whether a page has been read in. - watch_set(id) must have returned nullptr before. - @param id page identifier - @param chain unlocked hash table chain */ - void watch_unset(const page_id_t id, hash_chain &chain); - - /** Remove the sentinel block for the watch before replacing it with a - real block. watch_unset() or watch_occurred() will notice - that the block has been replaced with the real block. - @param w sentinel - @param chain locked hash table chain - @return w->state() */ - inline uint32_t watch_remove(buf_page_t *w, hash_chain &chain); - /** @return whether less than 1/4 of the buffer pool is available */ TPOOL_SUPPRESS_TSAN bool running_out() const @@ -1839,9 +1734,6 @@ class buf_pool_t # error "BUF_BUDDY_LOW > UNIV_ZIP_SIZE_MIN" #endif - /** Sentinels to detect if pages are read into the buffer pool while - a delete-buffering operation is pending. Protected by mutex. */ - buf_page_t watch[innodb_purge_threads_MAX + 1]; /** Reserve a buffer. */ buf_tmp_buffer_t *io_buf_reserve() { return io_buf.reserve(); } diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h index 986a792b97e2a..af72c544ebf9d 100644 --- a/storage/innobase/include/buf0rea.h +++ b/storage/innobase/include/buf0rea.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2021, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -24,8 +24,7 @@ The database buffer read Created 11/5/1995 Heikki Tuuri *******************************************************/ -#ifndef buf0rea_h -#define buf0rea_h +#pragma once #include "buf0buf.h" @@ -56,21 +55,14 @@ void buf_read_page_background(fil_space_t *space, const page_id_t page_id, /** Applies a random read-ahead in buf_pool if there are at least a threshold value of accessed pages from the random read-ahead area. Does not read any page, not even the one at the position (space, offset), if the read-ahead -mechanism is not activated. NOTE 1: the calling thread may own latches on +mechanism is not activated. NOTE: the calling thread may own latches on pages: to avoid deadlocks this function must be written such that it cannot -end up waiting for these latches! NOTE 2: the calling thread must want -access to the page given: this rule is set to prevent unintended read-aheads -performed by ibuf routines, a situation which could result in a deadlock if -the OS does not support asynchronous i/o. +end up waiting for these latches! @param[in] page_id page id of a page which the current thread wants to access @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] ibuf whether we are inside ibuf routine -@return number of page read requests issued; NOTE that if we read ibuf -pages, it may happen that the page at the given page number does not -get read even if we return a positive value! */ -ulint -buf_read_ahead_random(const page_id_t page_id, ulint zip_size, bool ibuf); +@return number of page read requests issued */ +ulint buf_read_ahead_random(const page_id_t page_id, ulint zip_size); /** Applies linear read-ahead if in the buf_pool the page is a border page of a linear read-ahead area and all the pages in the area have been accessed. @@ -91,26 +83,12 @@ only very improbably. NOTE 2: the calling thread may own latches on pages: to avoid deadlocks this function must be written such that it cannot end up waiting for these latches! -NOTE 3: the calling thread must want access to the page given: this rule is -set to prevent unintended read-aheads performed by ibuf routines, a situation -which could result in a deadlock if the OS does not support asynchronous io. @param[in] page_id page id; see NOTE 3 above @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] ibuf whether if we are inside ibuf routine @return number of page read requests issued */ -ulint -buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf); +ulint buf_read_ahead_linear(const page_id_t page_id, ulint zip_size); /** Issue read requests for pages that need to be recovered. @param space_id tablespace identifier @param page_nos page numbers to read, in ascending order */ void buf_read_recv_pages(uint32_t space_id, st_::span page_nos); - -/** @name Modes used in read-ahead @{ */ -/** read only pages belonging to the insert buffer tree */ -#define BUF_READ_IBUF_PAGES_ONLY 131 -/** read any page */ -#define BUF_READ_ANY_PAGE 132 -/* @} */ - -#endif diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index 3d63ddb767c74..d48851860879e 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -33,7 +33,6 @@ Created 1/16/1996 Heikki Tuuri /** @return whether a length is actually stored in a field */ #define len_is_stored(len) (len != UNIV_SQL_NULL && len != UNIV_SQL_DEFAULT) -extern ulint data_mysql_default_charset_coll; #define DATA_MYSQL_BINARY_CHARSET_COLL 63 /* SQL data type struct */ @@ -196,14 +195,6 @@ constexpr uint8_t DATA_MBR_LEN= uint8_t(SPDIMS * 2 * sizeof(double)); /*-------------------------------------------*/ -/* This many bytes we need to store the type information affecting the -alphabetical order for a single field and decide the storage size of an -SQL null*/ -#define DATA_ORDER_NULL_TYPE_BUF_SIZE 4 -/* In the >= 4.1.x storage format we add 2 bytes more so that we can also -store the charset-collation number; one byte is left unused, though */ -#define DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE 6 - /* Maximum multi-byte character length in bytes, plus 1 */ #define DATA_MBMAX 8 @@ -344,13 +335,11 @@ charset-collation code. DATA_BINARY_TYPE etc. @param[in] charset_coll character-set collation code @return precise type, including the charset-collation code */ -UNIV_INLINE -uint32_t -dtype_form_prtype(ulint old_prtype, ulint charset_coll) +inline uint32_t dtype_form_prtype(ulint old_prtype, ulint charset_coll) { - ut_ad(old_prtype < 256 * 256); - ut_ad(charset_coll <= MAX_CHAR_COLL_NUM); - return(uint32_t(old_prtype + (charset_coll << 16))); + ut_ad(old_prtype <= 0xffff); + ut_ad(charset_coll <= MAX_CHAR_COLL_NUM); + return uint32_t(old_prtype | (charset_coll << 16)); } /*********************************************************************//** @@ -439,40 +428,6 @@ dtype_get_sql_null_size( const dtype_t* type, /*!< in: type */ ulint comp); /*!< in: nonzero=ROW_FORMAT=COMPACT */ -/**********************************************************************//** -Reads to a type the stored information which determines its alphabetical -ordering and the storage size of an SQL NULL value. */ -UNIV_INLINE -void -dtype_read_for_order_and_null_size( -/*===============================*/ - dtype_t* type, /*!< in: type struct */ - const byte* buf); /*!< in: buffer for the stored order info */ -/**********************************************************************//** -Stores for a type the information which determines its alphabetical ordering -and the storage size of an SQL NULL value. This is the >= 4.1.x storage -format. */ -UNIV_INLINE -void -dtype_new_store_for_order_and_null_size( -/*====================================*/ - byte* buf, /*!< in: buffer for - DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE - bytes where we store the info */ - const dtype_t* type, /*!< in: type struct */ - ulint prefix_len);/*!< in: prefix length to - replace type->len, or 0 */ -/**********************************************************************//** -Reads to a type the stored information which determines its alphabetical -ordering and the storage size of an SQL NULL value. This is the 4.1.x storage -format. */ -UNIV_INLINE -void -dtype_new_read_for_order_and_null_size( -/*===================================*/ - dtype_t* type, /*!< in: type struct */ - const byte* buf); /*!< in: buffer for stored type order info */ - /*********************************************************************//** Validates a data type structure. @return TRUE if ok */ @@ -494,8 +449,6 @@ struct dict_col_t; If you add fields to this structure, be sure to initialize them everywhere. This structure is initialized in the following functions: dtype_set() -dtype_read_for_order_and_null_size() -dtype_new_read_for_order_and_null_size() sym_tab_add_null_lit() */ struct dtype_t{ diff --git a/storage/innobase/include/data0type.inl b/storage/innobase/include/data0type.inl index 329cee5d190a0..add6c211bb942 100644 --- a/storage/innobase/include/data0type.inl +++ b/storage/innobase/include/data0type.inl @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -183,126 +183,6 @@ dtype_get_mbmaxlen( return type->mbmaxlen; } -/**********************************************************************//** -Stores for a type the information which determines its alphabetical ordering -and the storage size of an SQL NULL value. This is the >= 4.1.x storage -format. */ -UNIV_INLINE -void -dtype_new_store_for_order_and_null_size( -/*====================================*/ - byte* buf, /*!< in: buffer for - DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE - bytes where we store the info */ - const dtype_t* type, /*!< in: type struct */ - ulint prefix_len)/*!< in: prefix length to - replace type->len, or 0 */ -{ - compile_time_assert(6 == DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); - - ulint len; - - ut_ad(type); - ut_ad(type->mtype >= DATA_VARCHAR); - ut_ad(type->mtype <= DATA_MTYPE_MAX); - - buf[0] = (byte)(type->mtype & 0xFFUL); - - if (type->prtype & DATA_BINARY_TYPE) { - buf[0] |= 128; - } - - /* In versions < 4.1.2 we had: if (type->prtype & DATA_NONLATIN1) { - buf[0] |= 64; - } - */ - - buf[1] = (byte)(type->prtype & 0xFFUL); - - len = prefix_len ? prefix_len : type->len; - - mach_write_to_2(buf + 2, len & 0xFFFFUL); - - ut_ad(dtype_get_charset_coll(type->prtype) <= MAX_CHAR_COLL_NUM); - mach_write_to_2(buf + 4, dtype_get_charset_coll(type->prtype)); - - if (type->prtype & DATA_NOT_NULL) { - buf[4] |= 128; - } -} - -/**********************************************************************//** -Reads to a type the stored information which determines its alphabetical -ordering and the storage size of an SQL NULL value. This is the < 4.1.x -storage format. */ -UNIV_INLINE -void -dtype_read_for_order_and_null_size( -/*===============================*/ - dtype_t* type, /*!< in: type struct */ - const byte* buf) /*!< in: buffer for stored type order info */ -{ - compile_time_assert(4 == DATA_ORDER_NULL_TYPE_BUF_SIZE); - type->mtype = buf[0] & 63; - type->prtype = buf[1]; - - if (buf[0] & 128) { - type->prtype |= DATA_BINARY_TYPE; - } - - type->len = mach_read_from_2(buf + 2); - - type->prtype = dtype_form_prtype(type->prtype, - data_mysql_default_charset_coll); - dtype_set_mblen(type); -} - -/**********************************************************************//** -Reads to a type the stored information which determines its alphabetical -ordering and the storage size of an SQL NULL value. This is the >= 4.1.x -storage format. */ -UNIV_INLINE -void -dtype_new_read_for_order_and_null_size( -/*===================================*/ - dtype_t* type, /*!< in: type struct */ - const byte* buf) /*!< in: buffer for stored type order info */ -{ - compile_time_assert(6 == DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); - - type->mtype = buf[0] & 63; - type->prtype = buf[1]; - - if (buf[0] & 128) { - type->prtype |= DATA_BINARY_TYPE; - } - - if (buf[4] & 128) { - type->prtype |= DATA_NOT_NULL; - } - - type->len = mach_read_from_2(buf + 2); - - ulint charset_coll = mach_read_from_2(buf + 4) & CHAR_COLL_MASK; - - if (dtype_is_string_type(type->mtype)) { - ut_a(charset_coll <= MAX_CHAR_COLL_NUM); - - if (charset_coll == 0) { - /* This insert buffer record was inserted with MySQL - version < 4.1.2, and the charset-collation code was not - explicitly stored to dtype->prtype at that time. It - must be the default charset-collation of this MySQL - installation. */ - - charset_coll = data_mysql_default_charset_coll; - } - - type->prtype = dtype_form_prtype(type->prtype, charset_coll); - } - dtype_set_mblen(type); -} - /***********************************************************************//** Returns the size of a fixed size data type, 0 if not a fixed size type. @return fixed size, or 0 */ diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h index a65287476ef8e..68400d2095d87 100644 --- a/storage/innobase/include/dict0boot.h +++ b/storage/innobase/include/dict0boot.h @@ -44,39 +44,6 @@ dict_hdr_get_new_id( (not assigned if NULL) */ uint32_t* space_id); /*!< out: space id (not assigned if NULL) */ -/** Update dict_sys.row_id in the dictionary header file page. */ -void dict_hdr_flush_row_id(row_id_t id); -/** @return A new value for GEN_CLUST_INDEX(DB_ROW_ID) */ -inline row_id_t dict_sys_t::get_new_row_id() -{ - row_id_t id= row_id.fetch_add(1); - if (!(id % ROW_ID_WRITE_MARGIN)) - dict_hdr_flush_row_id(id); - return id; -} - -/** Ensure that row_id is not smaller than id, on IMPORT TABLESPACE */ -inline void dict_sys_t::update_row_id(row_id_t id) -{ - row_id_t sys_id= row_id; - while (id >= sys_id) - { - if (!row_id.compare_exchange_strong(sys_id, id)) - continue; - if (!(id % ROW_ID_WRITE_MARGIN)) - dict_hdr_flush_row_id(id); - break; - } -} - -/**********************************************************************//** -Writes a row id to a record or other 6-byte stored form. */ -inline void dict_sys_write_row_id(byte *field, row_id_t row_id) -{ - static_assert(DATA_ROW_ID_LEN == 6, "compatibility"); - mach_write_to_6(field, row_id); -} - /*****************************************************************//** Initializes the data dictionary memory structures when the database is started. This function is also called when the data dictionary is created. @@ -116,7 +83,7 @@ inline bool dict_is_sys_table(table_id_t id) { return id < DICT_HDR_FIRST_ID; } /*-------------------------------------------------------------*/ /* Dictionary header offsets */ -#define DICT_HDR_ROW_ID 0 /* The latest assigned row id */ +//#define DICT_HDR_ROW_ID 0 /* Was: latest assigned DB_ROW_ID */ #define DICT_HDR_TABLE_ID 8 /* The latest assigned table id */ #define DICT_HDR_INDEX_ID 16 /* The latest assigned index id */ #define DICT_HDR_MAX_SPACE_ID 24 /* The latest assigned space id,or 0*/ diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 8daa07160a3e8..628ad8366af87 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -634,8 +634,6 @@ dict_table_get_next_index( #define dict_index_is_auto_gen_clust(index) (index)->is_gen_clust() #define dict_index_is_unique(index) (index)->is_unique() #define dict_index_is_spatial(index) (index)->is_spatial() -#define dict_index_is_ibuf(index) (index)->is_ibuf() -#define dict_index_is_sec_or_ibuf(index) !(index)->is_primary() #define dict_index_has_virtual(index) (index)->has_virtual() /** Get all the FTS indexes on a table. @@ -650,7 +648,7 @@ dict_table_get_all_fts_indexes( /********************************************************************//** Gets the number of user-defined non-virtual columns in a table in the dictionary cache. -@return number of user-defined (e.g., not ROW_ID) non-virtual +@return number of user-defined (e.g., not DB_ROW_ID) non-virtual columns of a table */ UNIV_INLINE unsigned @@ -1372,27 +1370,10 @@ class dict_sys_t std::atomic temp_table_id{DICT_HDR_FIRST_ID}; /** hash table of temporary table IDs */ hash_table_t temp_id_hash; - /** the next value of DB_ROW_ID, backed by DICT_HDR_ROW_ID - (FIXME: remove this, and move to dict_table_t) */ - Atomic_relaxed row_id; - /** The synchronization interval of row_id */ - static constexpr size_t ROW_ID_WRITE_MARGIN= 256; public: /** Diagnostic message for exceeding the lock_wait() timeout */ static const char fatal_msg[]; - /** @return A new value for GEN_CLUST_INDEX(DB_ROW_ID) */ - inline row_id_t get_new_row_id(); - - /** Ensure that row_id is not smaller than id, on IMPORT TABLESPACE */ - inline void update_row_id(row_id_t id); - - /** Recover the global DB_ROW_ID sequence on database startup */ - void recover_row_id(row_id_t id) - { - row_id= ut_uint64_align_up(id, ROW_ID_WRITE_MARGIN) + ROW_ID_WRITE_MARGIN; - } - /** @return a new temporary table ID */ table_id_t acquire_temporary_table_id() { diff --git a/storage/innobase/include/dict0dict.inl b/storage/innobase/include/dict0dict.inl index 4cc3eae96ab03..ead22a21757f2 100644 --- a/storage/innobase/include/dict0dict.inl +++ b/storage/innobase/include/dict0dict.inl @@ -244,7 +244,7 @@ dict_table_get_next_index( /********************************************************************//** Gets the number of user-defined non-virtual columns in a table in the dictionary cache. -@return number of user-defined (e.g., not ROW_ID) non-virtual +@return number of user-defined (e.g., not DB_ROW_ID) non-virtual columns of a table */ UNIV_INLINE unsigned diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h index f7d33d5b43bae..bd55848a776b6 100644 --- a/storage/innobase/include/dict0load.h +++ b/storage/innobase/include/dict0load.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -39,9 +39,7 @@ Created 4/24/1996 Heikki Tuuri /** A stack of table names related through foreign key constraints */ typedef std::deque > dict_names_t; -/** Check each tablespace found in the data dictionary. -Then look at each table defined in SYS_TABLES that has a space_id > 0 -to find all the file-per-table tablespaces. +/** Open each tablespace found in the data dictionary. In a crash recovery we already have some tablespace objects created from processing the REDO log. We will compare the @@ -50,7 +48,7 @@ tablespace file. In addition, more validation will be done if recovery was needed and force_recovery is not set. We also scan the biggest space id, and store it to fil_system. */ -void dict_check_tablespaces_and_store_max_id(); +void dict_load_tablespaces(); /** Make sure the data_file_name is saved in dict_table_t if needed. @param[in,out] table Table object */ diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index c76262ff5bebd..bbbda57b05d5d 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -64,7 +64,6 @@ combination of types */ auto-generated clustered indexes, also DICT_UNIQUE will be set */ #define DICT_UNIQUE 2 /*!< unique index */ -#define DICT_IBUF 8 /*!< insert buffer tree */ #define DICT_CORRUPT 16 /*!< bit to store the corrupted flag in SYS_INDEXES.TYPE */ #define DICT_FTS 32 /* FTS index; can't be combined with the @@ -995,7 +994,7 @@ struct dict_index_t { # define DICT_INDEX_MERGE_THRESHOLD_DEFAULT 50 unsigned type:DICT_IT_BITS; /*!< index type (DICT_CLUSTERED, DICT_UNIQUE, - DICT_IBUF, DICT_CORRUPT) */ + DICT_CORRUPT) */ #define MAX_KEY_LENGTH_BITS 12 unsigned trx_id_offset:MAX_KEY_LENGTH_BITS; /*!< position of the trx id column @@ -1184,12 +1183,8 @@ struct dict_index_t { /** @return whether instant ALTER TABLE is in effect */ inline bool is_instant() const; - /** @return whether the index is the primary key index - (not the clustered index of the change buffer) */ - bool is_primary() const - { - return DICT_CLUSTERED == (type & (DICT_CLUSTERED | DICT_IBUF)); - } + /** @return whether the index is the primary key index */ + bool is_primary() const { return is_clust(); } /** @return whether this is a generated clustered index */ bool is_gen_clust() const { return type == DICT_CLUSTERED; } @@ -1203,16 +1198,13 @@ struct dict_index_t { /** @return whether this is a spatial index */ bool is_spatial() const { return UNIV_UNLIKELY(type & DICT_SPATIAL); } - /** @return whether this is the change buffer */ - bool is_ibuf() const { return UNIV_UNLIKELY(type & DICT_IBUF); } - /** @return whether this index requires locking */ - bool has_locking() const { return !is_ibuf(); } + static constexpr bool has_locking() { return true; } /** @return whether this is a normal B-tree index (not the change buffer, not SPATIAL or FULLTEXT) */ bool is_btree() const { - return UNIV_LIKELY(!(type & (DICT_IBUF | DICT_SPATIAL + return UNIV_LIKELY(!(type & (DICT_SPATIAL | DICT_FTS | DICT_CORRUPT))); } @@ -2355,6 +2347,8 @@ struct dict_table_t { Atomic_relaxed lock_mutex_owner{0}; #endif public: + /** The next DB_ROW_ID value */ + Atomic_counter row_id{0}; /** Autoinc counter value to give to the next inserted row. */ uint64_t autoinc; diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h index 271e4e1fb7642..82a0f78072323 100644 --- a/storage/innobase/include/dict0types.h +++ b/storage/innobase/include/dict0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -48,10 +48,6 @@ struct dict_add_v_col_t; #define DICT_HDR_SPACE 0 /* the SYSTEM tablespace */ #define DICT_HDR_PAGE_NO FSP_DICT_HDR_PAGE_NO -/* The ibuf table and indexes's ID are assigned as the number -DICT_IBUF_ID_MIN plus the space id */ -#define DICT_IBUF_ID_MIN 0xFFFFFFFF00000000ULL - typedef ib_id_t table_id_t; typedef ib_id_t index_id_t; @@ -136,13 +132,6 @@ struct table_name_t inline bool is_temporary() const; }; -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG -/** Dump the change buffer at startup */ -extern my_bool ibuf_dump; -/** Flag to control insert buffer debugging. */ -extern uint ibuf_debug; -#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - /** Shift for spatial status */ #define SPATIAL_STATUS_SHIFT 12 diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 940e1b6845850..65ca704b6d895 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -51,35 +51,6 @@ using space_list_t= ilist; // Forward declaration extern my_bool srv_use_doublewrite_buf; -/** Possible values of innodb_flush_method */ -enum srv_flush_t -{ - /** fsync, the default */ - SRV_FSYNC= 0, - /** open log files in O_DSYNC mode */ - SRV_O_DSYNC, - /** do not call os_file_flush() when writing data files, but do flush - after writing to log files */ - SRV_LITTLESYNC, - /** do not flush after writing */ - SRV_NOSYNC, - /** invoke os_file_set_nocache() on data files. This implies using - unbuffered I/O but still fdatasync(), because some filesystems might - not flush meta-data on write completion */ - SRV_O_DIRECT, - /** Like O_DIRECT, but skip fdatasync(), assuming that the data is - durable on write completion */ - SRV_O_DIRECT_NO_FSYNC -#ifdef _WIN32 - /** Traditional Windows appoach to open all files without caching, - and do FileFlushBuffers() */ - ,SRV_ALL_O_DIRECT_FSYNC -#endif -}; - -/** innodb_flush_method */ -extern ulong srv_file_flush_method; - /** Undo tablespaces starts with space_id. */ extern uint32_t srv_undo_space_id_start; /** The number of UNDO tablespaces that are open and ready to use. */ @@ -631,6 +602,8 @@ struct fil_space_t final } public: + /** Reopen all files on set_write_through() or set_buffered(). */ + static void reopen_all(); /** Try to close a file to adhere to the innodb_open_files limit. @param print_info whether to diagnose why a file cannot be closed @return whether a file was closed */ @@ -1274,11 +1247,11 @@ constexpr uint16_t FIL_PAGE_RTREE= 17854; constexpr uint16_t FIL_PAGE_UNDO_LOG= 2; /** Index node (of file-in-file metadata) */ constexpr uint16_t FIL_PAGE_INODE= 3; -/** Insert buffer free list */ +/** Former change buffer free list */ constexpr uint16_t FIL_PAGE_IBUF_FREE_LIST= 4; /** Freshly allocated page */ constexpr uint16_t FIL_PAGE_TYPE_ALLOCATED= 0; -/** Change buffer bitmap (pages n*innodb_page_size+1) */ +/** Former change buffer bitmap pages (pages n*innodb_page_size+1) */ constexpr uint16_t FIL_PAGE_IBUF_BITMAP= 5; /** System page */ constexpr uint16_t FIL_PAGE_TYPE_SYS= 6; @@ -1414,6 +1387,20 @@ struct fil_system_t fil_space_t* temp_space; /*!< The innodb_temporary tablespace */ /** Map of fil_space_t::id to fil_space_t* */ hash_table_t spaces; + + /** whether each write to data files is durable (O_DSYNC) */ + my_bool write_through; + /** whether data files are buffered (not O_DIRECT) */ + my_bool buffered; + + /** Try to enable or disable write-through of data files */ + void set_write_through(bool write_through); + /** Try to enable or disable file system caching of data files */ + void set_buffered(bool buffered); + + TPOOL_SUPPRESS_TSAN bool is_write_through() const { return write_through; } + TPOOL_SUPPRESS_TSAN bool is_buffered() const { return buffered; } + /** tablespaces for which fil_space_t::needs_flush() holds */ sized_ilist unflushed_spaces; /** number of currently open files; protected by mutex */ @@ -1527,12 +1514,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); - if (srv_file_flush_method == SRV_O_DIRECT_NO_FSYNC) - { - ut_ad(!is_in_unflushed_spaces); - ut_ad(!needs_flush()); - } - else if (have_reference) + if (have_reference) flush_low(); else { diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h index 9a23e84038051..757ead55d0358 100644 --- a/storage/innobase/include/fsp0types.h +++ b/storage/innobase/include/fsp0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2022, MariaDB Corporation. +Copyright (c) 2014, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -157,28 +157,20 @@ this many file pages */ /* This has been replaced with either srv_page_size or page_zip->size. */ /** @name The space low address page map -The pages at FSP_XDES_OFFSET and FSP_IBUF_BITMAP_OFFSET are repeated +The 2 pages at FSP_XDES_OFFSET are repeated every XDES_DESCRIBED_PER_PAGE pages in every tablespace. */ /* @{ */ /*--------------------------------------*/ #define FSP_XDES_OFFSET 0U /* !< extent descriptor */ -#define FSP_IBUF_BITMAP_OFFSET 1U /* !< insert buffer bitmap */ - /* The ibuf bitmap pages are the ones whose - page number is the number above plus a - multiple of XDES_DESCRIBED_PER_PAGE */ - #define FSP_FIRST_INODE_PAGE_NO 2U /*!< in every tablespace */ /* The following pages exist in the system tablespace (space 0). */ -#define FSP_IBUF_HEADER_PAGE_NO 3U /*!< insert buffer +#define FSP_IBUF_HEADER_PAGE_NO 3U /*!< former change buffer header page, in tablespace 0 */ -#define FSP_IBUF_TREE_ROOT_PAGE_NO 4U /*!< insert buffer +#define FSP_IBUF_TREE_ROOT_PAGE_NO 4U /*!< former change buffer B-tree root page in tablespace 0 */ - /* The ibuf tree root page number in - tablespace 0; its fseg inode is on the page - number FSP_FIRST_INODE_PAGE_NO */ #define FSP_TRX_SYS_PAGE_NO 5U /*!< transaction system header, in tablespace 0 */ diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h index 777f2432c93a7..12b7eb785be8b 100644 --- a/storage/innobase/include/gis0rtree.h +++ b/storage/innobase/include/gis0rtree.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -94,7 +94,29 @@ rtr_page_split_and_insert( const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ mtr_t* mtr, /*!< in: mtr */ - dberr_t* err); /*!< out: error code */ + dberr_t* err, /*!< out: error code */ + que_thr_t* thr); /*!< in: query thread */ + +/*************************************************************//** +Makes tree one level higher by splitting the root, and inserts the tuple. +NOTE that the operation of this function must always succeed, +we cannot reverse it: therefore enough free disk space must be +guaranteed to be available before this function is called. +@return inserted record */ +rec_t* +rtr_root_raise_and_insert( + ulint flags, /*!< in: undo logging and locking flags */ + btr_cur_t* cursor, /*!< in: cursor at which to insert: must be + on the root page; when the function returns, + the cursor is positioned on the predecessor + of the inserted record */ + rec_offs** offsets,/*!< out: offsets on inserted record */ + mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ + const dtuple_t* tuple, /*!< in: tuple to insert */ + ulint n_ext, /*!< in: number of externally stored columns */ + mtr_t* mtr, /*!< in: mtr */ + dberr_t* err, /*!< out: error code */ + que_thr_t* thr); /*!< in: query thread */ /**************************************************************//** Sets the child node mbr in a node pointer. */ @@ -205,8 +227,8 @@ rtr_create_rtr_info( bool init_matches, /*!< in: Whether to initiate the "matches" structure for collecting matched leaf records */ - btr_cur_t* cursor, /*!< in: tree search cursor */ - dict_index_t* index); /*!< in: index struct */ + que_thr_t* thr, /*!< in/out: query thread */ + btr_cur_t* cursor); /*!< in: tree search cursor */ /********************************************************************//** Update a btr_cur_t with rtr_info */ @@ -261,8 +283,10 @@ rtr_get_mbr_from_tuple( about parent nodes in search @param[in,out] cursor cursor on node pointer record, its page x-latched +@param[in,out] thr query thread @return whether the cursor was successfully positioned */ -bool rtr_page_get_father(mtr_t *mtr, btr_cur_t *sea_cur, btr_cur_t *cursor) +bool rtr_page_get_father(mtr_t *mtr, btr_cur_t *sea_cur, btr_cur_t *cursor, + que_thr_t *thr) MY_ATTRIBUTE((nonnull(1,3), warn_unused_result)); /************************************************************//** @@ -274,11 +298,12 @@ rtr_page_get_father_block( /*======================*/ rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ - mtr_t* mtr, /*!< in: mtr */ btr_cur_t* sea_cur,/*!< in: search cursor, contains information about parent nodes in search */ - btr_cur_t* cursor);/*!< out: cursor on node pointer record, + btr_cur_t* cursor, /*!< out: cursor on node pointer record, its page x-latched */ + que_thr_t* thr, /*!< in/out: query thread */ + mtr_t* mtr); /*!< in/out: mtr */ /**************************************************************//** Store the parent path cursor @return number of cursor stored */ @@ -297,10 +322,10 @@ Initializes and opens a persistent cursor to an index tree. It should be closed with btr_pcur_close. */ bool rtr_pcur_open( - dict_index_t* index, /*!< in: index */ const dtuple_t* tuple, /*!< in: tuple on which search done */ btr_latch_mode latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ + que_thr_t* thr, /*!< in/out; query thread */ mtr_t* mtr) /*!< in: mtr */ MY_ATTRIBUTE((warn_unused_result)); diff --git a/storage/innobase/include/gis0rtree.inl b/storage/innobase/include/gis0rtree.inl index 5101eeb6f7ace..460496d1978f3 100644 --- a/storage/innobase/include/gis0rtree.inl +++ b/storage/innobase/include/gis0rtree.inl @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -240,6 +240,9 @@ rtr_info_reinit_in_cursor( bool need_prdt) /*!< in: Whether predicate lock is needed */ { + que_thr_t* thr = cursor->rtr_info->thr; + ut_ad(thr); rtr_clean_rtr_info(cursor->rtr_info, false); rtr_init_rtr_info(cursor->rtr_info, need_prdt, cursor, index, true); + cursor->rtr_info->thr = thr; } diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h index c246b2ef513ec..d1ff331fe2161 100644 --- a/storage/innobase/include/ibuf0ibuf.h +++ b/storage/innobase/include/ibuf0ibuf.h @@ -1,7 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2022, MariaDB Corporation. +Copyright (c) 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -17,420 +16,40 @@ this program; if not, write to the Free Software Foundation, Inc., *****************************************************************************/ -/**************************************************//** -@file include/ibuf0ibuf.h -Insert buffer - -Created 7/19/1997 Heikki Tuuri -*******************************************************/ - -#ifndef ibuf0ibuf_h -#define ibuf0ibuf_h - -#include "mtr0mtr.h" -#include "dict0mem.h" -#include "fsp0fsp.h" - -/** Default value for maximum on-disk size of change buffer in terms -of percentage of the buffer pool. */ -#define CHANGE_BUFFER_DEFAULT_SIZE (25) - -/* Possible operations buffered in the insert/whatever buffer. See -ibuf_insert(). DO NOT CHANGE THE VALUES OF THESE, THEY ARE STORED ON DISK. */ -typedef enum { - IBUF_OP_INSERT = 0, - IBUF_OP_DELETE_MARK = 1, - IBUF_OP_DELETE = 2, - - /* Number of different operation types. */ - IBUF_OP_COUNT = 3 -} ibuf_op_t; - -/** Combinations of operations that can be buffered. -@see innodb_change_buffering_names */ -enum ibuf_use_t { - IBUF_USE_NONE = 0, - IBUF_USE_INSERT, /* insert */ - IBUF_USE_DELETE_MARK, /* delete */ - IBUF_USE_INSERT_DELETE_MARK, /* insert+delete */ - IBUF_USE_DELETE, /* delete+purge */ - IBUF_USE_ALL /* insert+delete+purge */ -}; - -/** Operations that can currently be buffered. */ -extern ulong innodb_change_buffering; - -/** Insert buffer struct */ -struct ibuf_t{ - Atomic_relaxed size; /*!< current size of the ibuf index - tree, in pages */ - Atomic_relaxed max_size; /*!< recommended maximum size of the - ibuf index tree, in pages */ - ulint seg_size; /*!< allocated pages of the file - segment containing ibuf header and - tree */ - bool empty; /*!< Protected by the page - latch of the root page of the - insert buffer tree - (FSP_IBUF_TREE_ROOT_PAGE_NO). true - if and only if the insert - buffer tree is empty. */ - ulint free_list_len; /*!< length of the free list */ - ulint height; /*!< tree height */ - dict_index_t* index; /*!< insert buffer index */ - - /** number of pages merged */ - Atomic_counter n_merges; - Atomic_counter n_merged_ops[IBUF_OP_COUNT]; - /*!< number of operations of each type - merged to index pages */ - Atomic_counter n_discarded_ops[IBUF_OP_COUNT]; - /*!< number of operations of each type - discarded without merging due to the - tablespace being deleted or the - index being dropped */ -}; - -/** The insert buffer control structure */ -extern ibuf_t ibuf; - -/* The purpose of the insert buffer is to reduce random disk access. -When we wish to insert a record into a non-unique secondary index and -the B-tree leaf page where the record belongs to is not in the buffer -pool, we insert the record into the insert buffer B-tree, indexed by -(space_id, page_no). When the page is eventually read into the buffer -pool, we look up the insert buffer B-tree for any modifications to the -page, and apply these upon the completion of the read operation. This -is called the insert buffer merge. */ - -/* The insert buffer merge must always succeed. To guarantee this, -the insert buffer subsystem keeps track of the free space in pages for -which it can buffer operations. Two bits per page in the insert -buffer bitmap indicate the available space in coarse increments. The -free bits in the insert buffer bitmap must never exceed the free space -on a page. It is safe to decrement or reset the bits in the bitmap in -a mini-transaction that is committed before the mini-transaction that -affects the free space. It is unsafe to increment the bits in a -separately committed mini-transaction, because in crash recovery, the -free bits could momentarily be set too high. */ - -/******************************************************************//** -Creates the insert buffer data structure at a database startup. -@return DB_SUCCESS or failure */ -dberr_t -ibuf_init_at_db_start(void); -/*=======================*/ -/*********************************************************************//** -Updates the max_size value for ibuf. */ -void -ibuf_max_size_update( -/*=================*/ - ulint new_val); /*!< in: new value in terms of - percentage of the buffer pool size */ -/*********************************************************************//** -Reads the biggest tablespace id from the high end of the insert buffer -tree and updates the counter in fil_system. */ -void -ibuf_update_max_tablespace_id(void); -/*===============================*/ -/***************************************************************//** -Starts an insert buffer mini-transaction. */ -UNIV_INLINE -void -ibuf_mtr_start( -/*===========*/ - mtr_t* mtr) /*!< out: mini-transaction */ - MY_ATTRIBUTE((nonnull)); -/***************************************************************//** -Commits an insert buffer mini-transaction. */ -UNIV_INLINE -void -ibuf_mtr_commit( -/*============*/ - mtr_t* mtr) /*!< in/out: mini-transaction */ - MY_ATTRIBUTE((nonnull)); -/************************************************************************//** -Resets the free bits of the page in the ibuf bitmap. This is done in a -separate mini-transaction, hence this operation does not restrict -further work to only ibuf bitmap operations, which would result if the -latch to the bitmap page were kept. NOTE: The free bits in the insert -buffer bitmap must never exceed the free space on a page. It is safe -to decrement or reset the bits in the bitmap in a mini-transaction -that is committed before the mini-transaction that affects the free -space. */ -void -ibuf_reset_free_bits( -/*=================*/ - buf_block_t* block); /*!< in: index page; free bits are set to 0 - if the index is a non-clustered - non-unique, and page level is 0 */ -/************************************************************************//** -Updates the free bits of an uncompressed page in the ibuf bitmap if -there is not enough free on the page any more. This is done in a -separate mini-transaction, hence this operation does not restrict -further work to only ibuf bitmap operations, which would result if the -latch to the bitmap page were kept. NOTE: The free bits in the insert -buffer bitmap must never exceed the free space on a page. It is -unsafe to increment the bits in a separately committed -mini-transaction, because in crash recovery, the free bits could -momentarily be set too high. It is only safe to use this function for -decrementing the free bits. Should more free space become available, -we must not update the free bits here, because that would break crash -recovery. */ -UNIV_INLINE -void -ibuf_update_free_bits_if_full( -/*==========================*/ - buf_block_t* block, /*!< in: index page to which we have added new - records; the free bits are updated if the - index is non-clustered and non-unique and - the page level is 0, and the page becomes - fuller */ - ulint max_ins_size,/*!< in: value of maximum insert size with - reorganize before the latest operation - performed to the page */ - ulint increase);/*!< in: upper limit for the additional space - used in the latest operation, if known, or - ULINT_UNDEFINED */ -/**********************************************************************//** -Updates the free bits for an uncompressed page to reflect the present -state. Does this in the mtr given, which means that the latching -order rules virtually prevent any further operations for this OS -thread until mtr is committed. NOTE: The free bits in the insert -buffer bitmap must never exceed the free space on a page. It is safe -to set the free bits in the same mini-transaction that updated the -page. */ -void -ibuf_update_free_bits_low( -/*======================*/ - const buf_block_t* block, /*!< in: index page */ - ulint max_ins_size, /*!< in: value of - maximum insert size - with reorganize before - the latest operation - performed to the page */ - mtr_t* mtr); /*!< in/out: mtr */ -/**********************************************************************//** -Updates the free bits for a compressed page to reflect the present -state. Does this in the mtr given, which means that the latching -order rules virtually prevent any further operations for this OS -thread until mtr is committed. NOTE: The free bits in the insert -buffer bitmap must never exceed the free space on a page. It is safe -to set the free bits in the same mini-transaction that updated the -page. */ -void -ibuf_update_free_bits_zip( -/*======================*/ - buf_block_t* block, /*!< in/out: index page */ - mtr_t* mtr); /*!< in/out: mtr */ -/**********************************************************************//** -Updates the free bits for the two pages to reflect the present state. -Does this in the mtr given, which means that the latching order rules -virtually prevent any further operations until mtr is committed. -NOTE: The free bits in the insert buffer bitmap must never exceed the -free space on a page. It is safe to set the free bits in the same -mini-transaction that updated the pages. */ -void -ibuf_update_free_bits_for_two_pages_low( -/*====================================*/ - buf_block_t* block1, /*!< in: index page */ - buf_block_t* block2, /*!< in: index page */ - mtr_t* mtr); /*!< in: mtr */ -/**********************************************************************//** -A basic partial test if an insert to the insert buffer could be possible and -recommended. */ -UNIV_INLINE -ibool -ibuf_should_try( -/*============*/ - dict_index_t* index, /*!< in: index where to insert */ - ulint ignore_sec_unique); /*!< in: if != 0, we should - ignore UNIQUE constraint on - a secondary index when we - decide */ -/******************************************************************//** -Returns TRUE if the current OS thread is performing an insert buffer -routine. - -For instance, a read-ahead of non-ibuf pages is forbidden by threads -that are executing an insert buffer routine. -@return TRUE if inside an insert buffer routine */ -UNIV_INLINE -ibool -ibuf_inside( -/*========*/ - const mtr_t* mtr) /*!< in: mini-transaction */ - MY_ATTRIBUTE((warn_unused_result)); - -/** Checks if a page address is an ibuf bitmap page (level 3 page) address. -@param[in] page_id page id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@return TRUE if a bitmap page */ -inline bool ibuf_bitmap_page(const page_id_t page_id, ulint zip_size) -{ - ut_ad(ut_is_2pow(zip_size)); - ulint size = zip_size ? zip_size : srv_page_size; - return (page_id.page_no() & (size - 1)) == FSP_IBUF_BITMAP_OFFSET; -} - -/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. -Must not be called when recv_no_ibuf_operations==true. -@param[in] page_id page id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] x_latch FALSE if relaxed check (avoid latching the -bitmap page) -@param[in,out] mtr mtr which will contain an x-latch to the -bitmap page if the page is not one of the fixed address ibuf pages, or NULL, -in which case a new transaction is created. -@return true if level 2 or level 3 page */ -bool -ibuf_page_low( - const page_id_t page_id, - ulint zip_size, -#ifdef UNIV_DEBUG - bool x_latch, -#endif /* UNIV_DEBUG */ - mtr_t* mtr) - MY_ATTRIBUTE((warn_unused_result)); - -#ifdef UNIV_DEBUG -/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. -Must not be called when recv_no_ibuf_operations==true. -@param[in] page_id tablespace/page identifier -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in,out] mtr mini-transaction or NULL -@return TRUE if level 2 or level 3 page */ -# define ibuf_page(page_id, zip_size, mtr) \ - ibuf_page_low(page_id, zip_size, true, mtr) - -#else /* UNIV_DEBUG */ - -/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. -Must not be called when recv_no_ibuf_operations==true. -@param[in] page_id tablespace/page identifier -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in,out] mtr mini-transaction or NULL -@return TRUE if level 2 or level 3 page */ -# define ibuf_page(page_id, zip_size, mtr) \ - ibuf_page_low(page_id, zip_size, mtr) - -#endif /* UNIV_DEBUG */ -/***********************************************************************//** -Frees excess pages from the ibuf free list. This function is called when an OS -thread calls fsp services to allocate a new file segment, or a new page to a -file segment, and the thread did not own the fsp latch before this call. */ -void -ibuf_free_excess_pages(void); -/*========================*/ - -/** Buffer an operation in the change buffer, instead of applying it -directly to the file page, if this is possible. Does not do it if the index -is clustered or unique. -@param[in] op operation type -@param[in] entry index entry to insert -@param[in,out] index index where to insert -@param[in] page_id page id where to insert -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in,out] thr query thread -@return true if success */ -bool -ibuf_insert( - ibuf_op_t op, - const dtuple_t* entry, - dict_index_t* index, - const page_id_t page_id, - ulint zip_size, - que_thr_t* thr); - -/** Check whether buffered changes exist for a page. -@param[in] id page identifier -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@return whether buffered changes exist */ -bool ibuf_page_exists(const page_id_t id, ulint zip_size); - -/** When an index page is read from a disk to the buffer pool, this function -applies any buffered operations to the page and deletes the entries from the -insert buffer. If the page is not read, but created in the buffer pool, this -function deletes its buffered entries from the insert buffer; there can -exist entries for such a page if the page belonged to an index which -subsequently was dropped. -@param block X-latched page to try to apply changes to, or NULL to discard -@param page_id page identifier -@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@return error code */ -dberr_t ibuf_merge_or_delete_for_page(buf_block_t *block, - const page_id_t page_id, - ulint zip_size); - -/** Delete all change buffer entries for a tablespace, -in DISCARD TABLESPACE, IMPORT TABLESPACE, or read-ahead. -@param[in] space missing or to-be-discarded tablespace */ -void ibuf_delete_for_discarded_space(uint32_t space); - -/** Contract the change buffer by reading pages to the buffer pool. -@return a lower limit for the combined size in bytes of entries which -will be merged from ibuf trees to the pages read -@retval 0 if ibuf.empty */ -ulint ibuf_contract(); - -/** Contracts insert buffer trees by reading pages referring to space_id -to the buffer pool. -@returns number of pages merged.*/ -ulint -ibuf_merge_space( -/*=============*/ - ulint space); /*!< in: space id */ - -/******************************************************************//** -Looks if the insert buffer is empty. -@return true if empty */ -bool -ibuf_is_empty(void); -/*===============*/ -/******************************************************************//** -Prints info of ibuf. */ -void -ibuf_print( -/*=======*/ - FILE* file); /*!< in: file where to print */ -/******************************************************************** -Read the first two bytes from a record's fourth field (counter field in new -records; something else in older records). -@return "counter" field, or ULINT_UNDEFINED if for some reason it can't be read */ -ulint -ibuf_rec_get_counter( -/*=================*/ - const rec_t* rec); /*!< in: ibuf record */ -/******************************************************************//** -Closes insert buffer and frees the data structures. */ -void -ibuf_close(void); -/*============*/ - -/** Check the insert buffer bitmaps on IMPORT TABLESPACE. -@param[in] trx transaction -@param[in,out] space tablespace being imported -@return DB_SUCCESS or error code */ -dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) - MY_ATTRIBUTE((nonnull, warn_unused_result)); - -/** Update free bits and buffered bits for bulk loaded page. -@param block secondary index leaf page -@param mtr mini-transaction -@param reset whether the page is full */ -void ibuf_set_bitmap_for_bulk_load(buf_block_t *block, mtr_t *mtr, bool reset); - -#define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO -#define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO - -/* The ibuf header page currently contains only the file segment header -for the file segment from which the pages for the ibuf tree are allocated */ -#define IBUF_HEADER PAGE_DATA -#define IBUF_TREE_SEG_HEADER 0 /* fseg header for ibuf tree */ - -/* The insert buffer tree itself is always located in space 0. */ -#define IBUF_SPACE_ID static_cast(0) - -#include "ibuf0ibuf.inl" - -#endif +#include "db0err.h" + +/* The purpose of the change buffer was to reduce random disk access. +When we wished to +(1) insert a record into a non-unique secondary index, +(2) delete-mark a secondary index record, +(3) delete a secondary index record as part of purge (but not ROLLBACK), +and the B-tree leaf page where the record belongs to is not in the buffer +pool, we inserted a record into the change buffer B-tree, indexed by +the page identifier. When the page was eventually read into the buffer +pool, we looked up the change buffer B-tree for any modifications to the +page, applied these upon the completion of the read operation. This +was called the insert buffer merge. + +There was a hash index of the change buffer B-tree, implemented as the +"change buffer bitmap". Bits in these bitmap pages indicated how full +the page roughly was, and whether any records for the page identifier +exist in the change buffer. The "free" bits had to be updated as part of +operations that modified secondary index leaf pages. + +Because the change buffer has been removed, we will no longer update +any change buffer bitmap pages. Instead, on database startup, we will +check if an upgrade needs to be performed, and apply any buffered +changes if that is the case. Finally, the change buffer will be +transformed to a format that will not be recognized by earlier +versions of MariaDB Server, to prevent downgrades from causing +corruption (due to the removed updates of the bitmap pages) when the +change buffer might be enabled. */ + +/** Check if ibuf_upgrade() is needed as part of server startup. +@return error code +@retval DB_SUCCESS if no upgrade is needed +@retval DB_FAIL if the change buffer is not empty (need ibuf_upgrade()) */ +dberr_t ibuf_upgrade_needed(); + +/** Upgrade the change buffer after all redo log has been applied. */ +dberr_t ibuf_upgrade(); diff --git a/storage/innobase/include/ibuf0ibuf.inl b/storage/innobase/include/ibuf0ibuf.inl deleted file mode 100644 index 12aa1ca68371b..0000000000000 --- a/storage/innobase/include/ibuf0ibuf.inl +++ /dev/null @@ -1,282 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2021, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -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 Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/ibuf0ibuf.ic -Insert buffer - -Created 7/19/1997 Heikki Tuuri -*******************************************************/ - -#include "page0page.h" -#include "page0zip.h" -#include "fsp0types.h" -#include "buf0lru.h" - -/** An index page must contain at least srv_page_size / -IBUF_PAGE_SIZE_PER_FREE_SPACE bytes of free space for ibuf to try to -buffer inserts to this page. If there is this much of free space, the -corresponding bits are set in the ibuf bitmap. */ -#define IBUF_PAGE_SIZE_PER_FREE_SPACE 32 - -/***************************************************************//** -Starts an insert buffer mini-transaction. */ -UNIV_INLINE -void -ibuf_mtr_start( -/*===========*/ - mtr_t* mtr) /*!< out: mini-transaction */ -{ - mtr_start(mtr); - mtr->enter_ibuf(); - - if (high_level_read_only || srv_read_only_mode) { - mtr_set_log_mode(mtr, MTR_LOG_NO_REDO); - } - -} -/***************************************************************//** -Commits an insert buffer mini-transaction. */ -UNIV_INLINE -void -ibuf_mtr_commit( -/*============*/ - mtr_t* mtr) /*!< in/out: mini-transaction */ -{ - ut_ad(mtr->is_inside_ibuf()); - ut_d(mtr->exit_ibuf()); - - mtr_commit(mtr); -} - -/************************************************************************//** -Sets the free bit of the page in the ibuf bitmap. This is done in a separate -mini-transaction, hence this operation does not restrict further work to only -ibuf bitmap operations, which would result if the latch to the bitmap page -were kept. */ -void -ibuf_set_free_bits_func( -/*====================*/ - buf_block_t* block, /*!< in: index page of a non-clustered index; - free bit is reset if page level is 0 */ -#ifdef UNIV_IBUF_DEBUG - ulint max_val,/*!< in: ULINT_UNDEFINED or a maximum - value which the bits must have before - setting; this is for debugging */ -#endif /* UNIV_IBUF_DEBUG */ - ulint val); /*!< in: value to set: < 4 */ -#ifdef UNIV_IBUF_DEBUG -# define ibuf_set_free_bits(b,v,max) ibuf_set_free_bits_func(b,max,v) -#else /* UNIV_IBUF_DEBUG */ -# define ibuf_set_free_bits(b,v,max) ibuf_set_free_bits_func(b,v) -#endif /* UNIV_IBUF_DEBUG */ - -/**********************************************************************//** -A basic partial test if an insert to the insert buffer could be possible and -recommended. */ -UNIV_INLINE -ibool -ibuf_should_try( -/*============*/ - dict_index_t* index, /*!< in: index where to insert */ - ulint ignore_sec_unique) /*!< in: if != 0, we should - ignore UNIQUE constraint on - a secondary index when we - decide */ -{ - if (!innodb_change_buffering || !ibuf.max_size || index->is_clust() || - index->is_spatial()) - return false; - if (!ignore_sec_unique && index->is_unique()) - return false; - if (index->table->quiesce != QUIESCE_NONE) - return false; - for (unsigned i= 0; i < index->n_fields; i++) - if (index->fields[i].descending) - return false; - return true; -} - -/******************************************************************//** -Returns TRUE if the current OS thread is performing an insert buffer -routine. - -For instance, a read-ahead of non-ibuf pages is forbidden by threads -that are executing an insert buffer routine. -@return TRUE if inside an insert buffer routine */ -UNIV_INLINE -ibool -ibuf_inside( -/*========*/ - const mtr_t* mtr) /*!< in: mini-transaction */ -{ - return(mtr->is_inside_ibuf()); -} - -/** Translates the free space on a page to a value in the ibuf bitmap. -@param[in] page_size page size in bytes -@param[in] max_ins_size maximum insert size after reorganize for -the page -@return value for ibuf bitmap bits */ -UNIV_INLINE -ulint -ibuf_index_page_calc_free_bits( - ulint page_size, - ulint max_ins_size) -{ - ulint n; - ut_ad(ut_is_2pow(page_size)); - ut_ad(page_size > IBUF_PAGE_SIZE_PER_FREE_SPACE); - - n = max_ins_size / (page_size / IBUF_PAGE_SIZE_PER_FREE_SPACE); - - if (n == 3) { - n = 2; - } - - if (n > 3) { - n = 3; - } - - return(n); -} - -/*********************************************************************//** -Translates the free space on a compressed page to a value in the ibuf bitmap. -@return value for ibuf bitmap bits */ -UNIV_INLINE -ulint -ibuf_index_page_calc_free_zip( -/*==========================*/ - const buf_block_t* block) /*!< in: buffer block */ -{ - ulint max_ins_size; - const page_zip_des_t* page_zip; - lint zip_max_ins; - - ut_ad(block->page.zip.data); - - /* Consider the maximum insert size on the uncompressed page - without reorganizing the page. We must not assume anything - about the compression ratio. If zip_max_ins > max_ins_size and - there is 1/4 garbage on the page, recompression after the - reorganize could fail, in theory. So, let us guarantee that - merging a buffered insert to a compressed page will always - succeed without reorganizing or recompressing the page, just - by using the page modification log. */ - max_ins_size = page_get_max_insert_size( - buf_block_get_frame(block), 1); - - page_zip = buf_block_get_page_zip(block); - zip_max_ins = page_zip_max_ins_size(page_zip, - FALSE/* not clustered */); - - if (zip_max_ins < 0) { - return(0); - } else if (max_ins_size > (ulint) zip_max_ins) { - max_ins_size = (ulint) zip_max_ins; - } - - return(ibuf_index_page_calc_free_bits(block->physical_size(), - max_ins_size)); -} - -/*********************************************************************//** -Translates the free space on a page to a value in the ibuf bitmap. -@return value for ibuf bitmap bits */ -UNIV_INLINE -ulint -ibuf_index_page_calc_free( -/*======================*/ - const buf_block_t* block) /*!< in: buffer block */ -{ - if (!block->page.zip.data) { - ulint max_ins_size; - - max_ins_size = page_get_max_insert_size_after_reorganize( - buf_block_get_frame(block), 1); - - return(ibuf_index_page_calc_free_bits( - block->physical_size(), max_ins_size)); - } else { - return(ibuf_index_page_calc_free_zip(block)); - } -} - -/************************************************************************//** -Updates the free bits of an uncompressed page in the ibuf bitmap if -there is not enough free on the page any more. This is done in a -separate mini-transaction, hence this operation does not restrict -further work to only ibuf bitmap operations, which would result if the -latch to the bitmap page were kept. NOTE: The free bits in the insert -buffer bitmap must never exceed the free space on a page. It is -unsafe to increment the bits in a separately committed -mini-transaction, because in crash recovery, the free bits could -momentarily be set too high. It is only safe to use this function for -decrementing the free bits. Should more free space become available, -we must not update the free bits here, because that would break crash -recovery. */ -UNIV_INLINE -void -ibuf_update_free_bits_if_full( -/*==========================*/ - buf_block_t* block, /*!< in: index page to which we have added new - records; the free bits are updated if the - index is non-clustered and non-unique and - the page level is 0, and the page becomes - fuller */ - ulint max_ins_size,/*!< in: value of maximum insert size with - reorganize before the latest operation - performed to the page */ - ulint increase)/*!< in: upper limit for the additional space - used in the latest operation, if known, or - ULINT_UNDEFINED */ -{ - ulint before; - ulint after; - - ut_ad(buf_block_get_page_zip(block) == NULL); - - before = ibuf_index_page_calc_free_bits( - srv_page_size, max_ins_size); - - if (max_ins_size >= increase) { - compile_time_assert(ULINT32_UNDEFINED > UNIV_PAGE_SIZE_MAX); - after = ibuf_index_page_calc_free_bits( - srv_page_size, max_ins_size - increase); -#ifdef UNIV_IBUF_DEBUG - ut_a(after <= ibuf_index_page_calc_free(block)); -#endif - } else { - after = ibuf_index_page_calc_free(block); - } - - if (after == 0) { - /* We move the page to the front of the buffer pool LRU list: - the purpose of this is to prevent those pages to which we - cannot make inserts using the insert buffer from slipping - out of the buffer pool */ - - buf_page_make_young(&block->page); - } - - if (before > after) { - ibuf_set_free_bits(block, after, before); - } -} diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 09e4ece88943c..8afa92abc93ca 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -275,6 +275,8 @@ typedef srw_lock log_rwlock_t; bool log_maybe_unbuffered; # endif #endif + /** whether each write to ib_logfile0 is durable (O_DSYNC) */ + my_bool log_write_through; /** Fields involved in checkpoints @{ */ lsn_t log_capacity; /*!< capacity of the log; if @@ -362,6 +364,8 @@ typedef srw_lock log_rwlock_t; /** Try to enable or disable file system caching (update log_buffered) */ void set_buffered(bool buffered); #endif + /** Try to enable or disable durable writes (update log_write_through) */ + void set_write_through(bool write_through); void attach(log_file_t file, os_offset_t size); diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index e787d81e8c290..c0b79f1a76de3 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -417,16 +417,6 @@ struct recv_sys_t /** The recovery system */ extern recv_sys_t recv_sys; -/** If the following is TRUE, the buffer pool file pages must be invalidated -after recovery and no ibuf operations are allowed; this will be set if -recv_sys.pages becomes too full, and log records must be merged -to file pages already before the recovery is finished: in this case no -ibuf operations are allowed, as they could modify the pages read in the -buffer pool before the pages have been recovered to the up-to-date state. - -TRUE means that recovery is running and no operations on the log files -are allowed yet: the variable name is misleading. */ -extern bool recv_no_ibuf_operations; /** TRUE when recv_init_crash_recovery() has been called. */ extern bool recv_needed_recovery; #ifdef UNIV_DEBUG diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index abc1f65e6920a..debc3a3fc9c63 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -381,15 +381,6 @@ struct mtr_t { @retval 0 if the transaction only modified temporary tablespaces */ lsn_t commit_lsn() const { ut_ad(has_committed()); return m_commit_lsn; } - /** Note that we are inside the change buffer code. */ - void enter_ibuf() { m_inside_ibuf= true; } - - /** Note that we have exited from the change buffer code. */ - void exit_ibuf() { m_inside_ibuf= false; } - - /** @return true if we are inside the change buffer code */ - bool is_inside_ibuf() const { return m_inside_ibuf; } - /** Note that some pages have been freed */ void set_trim_pages() { m_trim_pages= true; } @@ -792,10 +783,6 @@ struct mtr_t { /** whether log_sys.latch is locked exclusively */ uint16_t m_latch_ex:1; - /** whether change buffer is latched; only needed in non-debug builds - to suppress some read-ahead operations, @see ibuf_inside() */ - uint16_t m_inside_ibuf:1; - /** whether the pages has been trimmed */ uint16_t m_trim_pages:1; diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h index 28aa30565e46a..279138acd791d 100644 --- a/storage/innobase/include/page0cur.h +++ b/storage/innobase/include/page0cur.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2022, MariaDB Corporation. +Copyright (c) 2018, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -117,11 +117,6 @@ succeed, i.e., enough space available, NULL otherwise. The cursor stays at the same logical position, but the physical position may change if it is pointing to a compressed page that was reorganized. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if this is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return pointer to record if succeed, NULL otherwise */ UNIV_INLINE rec_t* @@ -151,11 +146,6 @@ page_cur_insert_rec_low( Inserts a record next to page cursor on a compressed and uncompressed page. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if this is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return pointer to inserted record @return nullptr on failure */ rec_t* diff --git a/storage/innobase/include/page0cur.inl b/storage/innobase/include/page0cur.inl index 7c4eafa266a88..a73c31a7bffad 100644 --- a/storage/innobase/include/page0cur.inl +++ b/storage/innobase/include/page0cur.inl @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -155,11 +155,6 @@ succeed, i.e., enough space available, NULL otherwise. The cursor stays at the same logical position, but the physical position may change if it is pointing to a compressed page that was reorganized. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if this is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return pointer to record if succeed, NULL otherwise */ UNIV_INLINE rec_t* diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 2978656b508f4..38373f6bb19de 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -1,6 +1,6 @@ /***************************************************************************** Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -95,7 +95,7 @@ this byte can be garbage. */ direction */ #define PAGE_N_RECS 16 /* number of user records on the page */ /** The largest DB_TRX_ID that may have modified a record on the page; -Defined only in secondary index leaf pages and in change buffer leaf pages. +Defined only in secondary index leaf pages. Otherwise written as 0. @see PAGE_ROOT_AUTO_INC */ #define PAGE_MAX_TRX_ID 18 /** The AUTO_INCREMENT value (on persistent clustered index root pages). */ @@ -901,11 +901,6 @@ MY_ATTRIBUTE((nonnull, warn_unused_result)) Differs from page_copy_rec_list_end, because this function does not touch the lock table and max trx id on page or compress the page. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_t::commit(). - @return error code */ dberr_t page_copy_rec_list_end_no_locks( @@ -920,11 +915,6 @@ Copies records from page to new_page, from the given record onward, including that record. Infimum and supremum records are not copied. The records are copied to the start of the record list on new_page. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_t::commit(). - @return pointer to the original successor of the infimum record on new_block @retval nullptr on ROW_FORMAT=COMPRESSED page overflow */ rec_t* @@ -942,11 +932,6 @@ Copies records from page to new_page, up to the given record, NOT including that record. Infimum and supremum records are not copied. The records are copied to the end of the record list on new_page. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return pointer to the original predecessor of the supremum record on new_block @retval nullptr on ROW_FORMAT=COMPRESSED page overflow */ rec_t* diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h index 4332990619e75..501ef31a8f913 100644 --- a/storage/innobase/include/page0zip.h +++ b/storage/innobase/include/page0zip.h @@ -2,7 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -213,9 +213,9 @@ page_zip_max_ins_size( /**********************************************************************//** Determine if enough space is available in the modification log. -@return TRUE if page_zip_write_rec() will succeed */ +@return true if page_zip_write_rec() will succeed */ UNIV_INLINE -ibool +bool page_zip_available( /*===============*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ @@ -323,10 +323,6 @@ Reorganize and compress a page. This is a low-level operation for compressed pages, to be used when page_zip_compress() fails. On success, redo log will be written. The function btr_page_reorganize() should be preferred whenever possible. -IMPORTANT: if page_zip_reorganize() is invoked on a leaf page of a -non-clustered index, the caller must update the insert buffer free -bits in the same mini-transaction in such a way that the modification -will be redo-logged. @return error code @retval DB_FAIL on overflow; the block_zip will be left intact */ dberr_t diff --git a/storage/innobase/include/page0zip.inl b/storage/innobase/include/page0zip.inl index afc877c37209c..edcd4ab48fae9 100644 --- a/storage/innobase/include/page0zip.inl +++ b/storage/innobase/include/page0zip.inl @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -269,7 +269,7 @@ page_zip_max_ins_size( Determine if enough space is available in the modification log. @return TRUE if enough space is available */ UNIV_INLINE -ibool +bool page_zip_available( /*===============*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ diff --git a/storage/innobase/include/rem0rec.inl b/storage/innobase/include/rem0rec.inl index 46c209cbdec43..da7337a3b82b9 100644 --- a/storage/innobase/include/rem0rec.inl +++ b/storage/innobase/include/rem0rec.inl @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1095,9 +1095,7 @@ rec_get_converted_size( ut_ad(dtuple_check_typed(dtuple)); #ifdef UNIV_DEBUG - if (dict_index_is_ibuf(index)) { - ut_ad(dtuple->n_fields > 1); - } else if ((dtuple_get_info_bits(dtuple) & REC_NEW_STATUS_MASK) + if ((dtuple_get_info_bits(dtuple) & REC_NEW_STATUS_MASK) == REC_STATUS_NODE_PTR) { ut_ad(dtuple->n_fields - 1 == dict_index_get_n_unique_in_tree_nonleaf(index)); diff --git a/storage/innobase/include/row0purge.h b/storage/innobase/include/row0purge.h index b1390fd1ef10f..686bbaa73841f 100644 --- a/storage/innobase/include/row0purge.h +++ b/storage/innobase/include/row0purge.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -37,39 +37,6 @@ Created 3/14/1997 Heikki Tuuri #include class MDL_ticket; -/** Determines if it is possible to remove a secondary index entry. -Removal is possible if the secondary index entry does not refer to any -not delete marked version of a clustered index record where DB_TRX_ID -is newer than the purge view. - -NOTE: This function should only be called by the purge thread, only -while holding a latch on the leaf page of the secondary index entry -(or keeping the buffer pool watch on the page). It is possible that -this function first returns true and then false, if a user transaction -inserts a record that the secondary index entry would refer to. -However, in that case, the user transaction would also re-insert the -secondary index entry after purge has removed it and released the leaf -page latch. -@param[in,out] node row purge node -@param[in] index secondary index -@param[in] entry secondary index entry -@param[in,out] sec_pcur secondary index cursor or NULL - if it is called for purge buffering - operation. -@param[in,out] sec_mtr mini-transaction which holds - secondary index entry or NULL if it is - called for purge buffering operation. -@param[in] is_tree true=pessimistic purge, - false=optimistic (leaf-page only) -@return true if the secondary index record can be purged */ -bool -row_purge_poss_sec( - purge_node_t* node, - dict_index_t* index, - const dtuple_t* entry, - btr_pcur_t* sec_pcur=NULL, - mtr_t* sec_mtr=NULL, - bool is_tree=false); /*************************************************************** Does the purge operation. diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h index a1350740e2a47..25cadf272dd90 100644 --- a/storage/innobase/include/row0row.h +++ b/storage/innobase/include/row0row.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2022, MariaDB Corporation. +Copyright (c) 2016, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -28,7 +28,6 @@ Created 4/20/1996 Heikki Tuuri #define row0row_h #include "que0types.h" -#include "ibuf0ibuf.h" #include "trx0types.h" #include "mtr0mtr.h" #include "rem0types.h" @@ -344,31 +343,19 @@ row_parse_int( ulint mtype, bool unsigned_type); -/** Result of row_search_index_entry */ -enum row_search_result { - ROW_FOUND = 0, /*!< the record was found */ - ROW_NOT_FOUND, /*!< record not found */ - ROW_BUFFERED, /*!< one of BTR_INSERT, BTR_DELETE, or - BTR_DELETE_MARK was specified, the - secondary index leaf page was not in - the buffer pool, and the operation was - enqueued in the insert/delete buffer */ - ROW_NOT_DELETED_REF /*!< BTR_DELETE was specified, and - row_purge_poss_sec() failed */ -}; - /***************************************************************//** Searches an index record. -@return whether the record was found or buffered */ -enum row_search_result +@return whether the record was found */ +bool row_search_index_entry( /*===================*/ const dtuple_t* entry, /*!< in: index entry */ btr_latch_mode mode, /*!< in: BTR_MODIFY_LEAF, ... */ btr_pcur_t* pcur, /*!< in/out: persistent cursor, which must be closed by the caller */ + que_thr_t* thr, /*!< in/out: query thread */ mtr_t* mtr) /*!< in: mtr */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,3,5), warn_unused_result)); #define ROW_COPY_DATA 1 #define ROW_COPY_POINTERS 2 @@ -398,22 +385,17 @@ row_raw_format( in bytes */ MY_ATTRIBUTE((nonnull, warn_unused_result)); +#include "dict0mem.h" + /** Prepare to start a mini-transaction to modify an index. @param[in,out] mtr mini-transaction -@param[in,out] index possibly secondary index -@param[in] pessimistic whether this is a pessimistic operation */ -inline -void -row_mtr_start(mtr_t* mtr, dict_index_t* index, bool pessimistic) +@param[in,out] index possibly secondary index */ +inline void row_mtr_start(mtr_t* mtr, dict_index_t* index) { mtr->start(); switch (index->table->space_id) { - case IBUF_SPACE_ID: - if (pessimistic - && !(index->type & (DICT_UNIQUE | DICT_SPATIAL))) { - ibuf_free_excess_pages(); - } + case 0: break; case SRV_TMP_SPACE_ID: mtr->set_log_mode(MTR_LOG_NO_REDO); diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index 51f3049b81ac3..4672ce00a3675 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -2,7 +2,7 @@ Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -228,12 +228,8 @@ enum monitor_id_t { MONITOR_MODULE_BUF_PAGE, MONITOR_INDEX_LEAF_PAGE_READ, MONITOR_INDEX_NON_LEAF_PAGE_READ, - MONITOR_INDEX_IBUF_LEAF_PAGE_READ, - MONITOR_INDEX_IBUF_NON_LEAF_PAGE_READ, MONITOR_UNDO_LOG_PAGE_READ, MONITOR_INODE_PAGE_READ, - MONITOR_IBUF_FREELIST_PAGE_READ, - MONITOR_IBUF_BITMAP_PAGE_READ, MONITOR_SYSTEM_PAGE_READ, MONITOR_TRX_SYSTEM_PAGE_READ, MONITOR_FSP_HDR_PAGE_READ, @@ -244,12 +240,8 @@ enum monitor_id_t { MONITOR_OTHER_PAGE_READ, MONITOR_INDEX_LEAF_PAGE_WRITTEN, MONITOR_INDEX_NON_LEAF_PAGE_WRITTEN, - MONITOR_INDEX_IBUF_LEAF_PAGE_WRITTEN, - MONITOR_INDEX_IBUF_NON_LEAF_PAGE_WRITTEN, MONITOR_UNDO_LOG_PAGE_WRITTEN, MONITOR_INODE_PAGE_WRITTEN, - MONITOR_IBUF_FREELIST_PAGE_WRITTEN, - MONITOR_IBUF_BITMAP_PAGE_WRITTEN, MONITOR_SYSTEM_PAGE_WRITTEN, MONITOR_TRX_SYSTEM_PAGE_WRITTEN, MONITOR_FSP_HDR_PAGE_WRITTEN, @@ -347,17 +339,6 @@ enum monitor_id_t { MONITOR_MODULE_FIL_SYSTEM, MONITOR_OVLD_N_FILE_OPENED, - /* InnoDB Change Buffer related counters */ - MONITOR_MODULE_IBUF_SYSTEM, - MONITOR_OVLD_IBUF_MERGE_INSERT, - MONITOR_OVLD_IBUF_MERGE_DELETE, - MONITOR_OVLD_IBUF_MERGE_PURGE, - MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT, - MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE, - MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE, - MONITOR_OVLD_IBUF_MERGES, - MONITOR_OVLD_IBUF_SIZE, - /* Counters for server operations */ MONITOR_MODULE_SERVER, MONITOR_MASTER_THREAD_SLEEP, diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 606d94818cfb8..f94c52c2d97a4 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -170,9 +170,9 @@ extern char* srv_data_home; recovery and open all tables in RO mode instead of RW mode. We don't sync the max trx id to disk either. */ extern my_bool srv_read_only_mode; -/** Set if InnoDB operates in read-only mode or innodb-force-recovery -is greater than SRV_FORCE_NO_IBUF_MERGE. */ -extern my_bool high_level_read_only; +/** Set if innodb_read_only is set or innodb_force_recovery +is SRV_FORCE_NO_UNDO_LOG_SCAN or greater. */ +extern bool high_level_read_only; /** store to its own file each table created by an user; data dictionary tables are in the system tablespace 0 */ extern my_bool srv_file_per_table; @@ -585,11 +585,6 @@ void srv_monitor_task(void*); void srv_master_callback(void*); -/** -Complete the shutdown tasks such as background DROP TABLE, -and optionally change buffer merge (on innodb_fast_shutdown=0). */ -void srv_shutdown(bool ibuf_merge); - } /* extern "C" */ #ifdef UNIV_DEBUG diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 44b19aa666bda..c18cf1ceb63d1 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -33,10 +33,10 @@ Created 10/10/1995 Heikki Tuuri struct dict_table_t; /** Open the configured number of dedicated undo tablespaces. -@param[in] create_new_db whether the database is being initialized +@param[in] create_new_undo whether the undo tablespaces has to be created +@param[in,out] mtr mini-transaction @return DB_SUCCESS or error code */ -dberr_t -srv_undo_tablespaces_init(bool create_new_db); +dberr_t srv_undo_tablespaces_init(bool create_new_undo, mtr_t *mtr); /** Start InnoDB. @param[in] create_new_db whether to create a new database diff --git a/storage/innobase/include/sux_lock.h b/storage/innobase/include/sux_lock.h index 2c0167ac651e0..7a7f93b6787e6 100644 --- a/storage/innobase/include/sux_lock.h +++ b/storage/innobase/include/sux_lock.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2020, 2022, MariaDB Corporation. +Copyright (c) 2020, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -149,7 +149,7 @@ class sux_lock final #endif public: - /** In crash recovery or the change buffer, claim the ownership + /** In crash recovery, claim the ownership of the exclusive block lock to the current thread */ void claim_ownership() { set_new_owner(pthread_self()); } diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index 7ad20b0fff0e1..6ea4b8cb1cc5a 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -306,7 +306,10 @@ which corresponds to the transaction just being committed. In a replication slave, this updates the master binlog position up to which replication has proceeded. @param[in,out] rseg_header rollback segment header -@param[in] trx committing transaction +@param[in] log_file_name binlog file name +@param[in] log_offset binlog offset value @param[in,out] mtr mini-transaction */ -void trx_rseg_update_binlog_offset(buf_block_t *rseg_header, const trx_t *trx, +void trx_rseg_update_binlog_offset(buf_block_t *rseg_header, + const char *log_file_name, + ulonglong log_offset, mtr_t *mtr); diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index 4d231077b12d7..2ed9566c21502 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -855,6 +855,8 @@ class trx_sys_t bool m_initialised; + /** False if there is no undo log to purge or rollback */ + bool undo_log_nonempty; public: /** List of all transactions. */ thread_safe_trx_ilist_t trx_list; @@ -1165,6 +1167,20 @@ class trx_sys_t return count; } + /** Set the undo log empty value */ + void set_undo_non_empty(bool val) + { + if (!undo_log_nonempty) + undo_log_nonempty= val; + } + + /** Get the undo log empty value */ + bool is_undo_empty() const { return !undo_log_nonempty; } + + /* Reset the trx_sys page and retain the dblwr information, + system rollback segment header page + @return error code */ + inline dberr_t reset_page(mtr_t *mtr); private: static my_bool find_same_or_older_callback(rw_trx_hash_element_t *element, trx_id_t *id) diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 0450be89cfb76..a571de04f2f57 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -774,13 +774,17 @@ struct trx_t : ilist_node<> const char* op_info; /*!< English text describing the current operation, or an empty string */ - uint isolation_level;/*!< TRX_ISO_REPEATABLE_READ, ... */ - bool check_foreigns; /*!< normally TRUE, but if the user - wants to suppress foreign key checks, - (in table imports, for example) we - set this FALSE */ + /** TRX_ISO_REPEATABLE_READ, ... */ + unsigned isolation_level:2; + /** normally set; "SET foreign_key_checks=0" can be issued to suppress + foreign key checks, in table imports, for example */ + unsigned check_foreigns:1; + /** normally set; "SET unique_checks=0, foreign_key_checks=0" + enables bulk insert into an empty table */ + unsigned check_unique_secondary:1; + /** whether an insert into an empty table is active */ - bool bulk_insert; + unsigned bulk_insert:1; /*------------------------------*/ /* MySQL has a transaction coordinator to coordinate two phase commit between multiple storage engines and the binary log. When @@ -794,13 +798,6 @@ struct trx_t : ilist_node<> /** whether this is holding the prepare mutex */ bool active_commit_ordered; /*------------------------------*/ - bool check_unique_secondary; - /*!< normally TRUE, but if the user - wants to speed up inserts by - suppressing unique key checks - for secondary indexes when we decide - if we can use the insert buffer for - them, we set this FALSE */ bool flush_log_later;/* In 2PC, we hold the prepare_commit mutex across both phases. In that case, we diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index d06343fcabe68..93352b279b114 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -142,7 +142,6 @@ using the call command. */ assertions. */ #define UNIV_LRU_DEBUG /* debug the buffer pool LRU */ #define UNIV_HASH_DEBUG /* debug HASH_ macros */ -#define UNIV_IBUF_DEBUG /* debug the insert buffer */ #define UNIV_PERF_DEBUG /* debug flag that enables light weight performance related stuff. */ @@ -475,9 +474,6 @@ extern mysql_pfs_key_t fts_cache_mutex_key; extern mysql_pfs_key_t fts_cache_init_mutex_key; extern mysql_pfs_key_t fts_delete_mutex_key; extern mysql_pfs_key_t fts_doc_id_mutex_key; -extern mysql_pfs_key_t ibuf_bitmap_mutex_key; -extern mysql_pfs_key_t ibuf_mutex_key; -extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; extern mysql_pfs_key_t recalc_pool_mutex_key; extern mysql_pfs_key_t purge_sys_pq_mutex_key; extern mysql_pfs_key_t recv_sys_mutex_key; diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 2804143721c12..e144b9fea38ad 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Google Inc. -Copyright (c) 2014, 2022, MariaDB Corporation. +Copyright (c) 2014, 2023, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -401,6 +401,31 @@ void log_t::set_buffered(bool buffered) } #endif + /** Try to enable or disable durable writes (update log_write_through) */ +void log_t::set_write_through(bool write_through) +{ + if (is_pmem() || high_level_read_only) + return; + log_resize_acquire(); + if (!resize_in_progress() && is_opened() && + bool(log_write_through) != write_through) + { + os_file_close_func(log.m_file); + log.m_file= OS_FILE_CLOSED; + std::string path{get_log_file_path()}; + log_write_through= write_through; + bool success; + log.m_file= os_file_create_func(path.c_str(), + OS_FILE_OPEN, OS_FILE_NORMAL, OS_LOG_FILE, + false, &success); + ut_a(log.m_file != OS_FILE_CLOSED); + sql_print_information(log_write_through + ? "InnoDB: Log writes write through" + : "InnoDB: Log writes may be cached"); + } + log_resize_release(); +} + /** Start resizing the log and release the exclusive latch. @param size requested new file_size @return whether the resizing was started successfully */ @@ -852,7 +877,7 @@ bool log_t::flush(lsn_t lsn) noexcept { ut_ad(lsn >= get_flushed_lsn()); flush_lock.set_pending(lsn); - const bool success{srv_file_flush_method == SRV_O_DSYNC || log.flush()}; + const bool success{log_write_through || log.flush()}; if (UNIV_LIKELY(success)) { flushed_to_disk_lsn.store(lsn, std::memory_order_release); @@ -888,15 +913,6 @@ void log_write_up_to(lsn_t lsn, bool durable, { ut_ad(!srv_read_only_mode); ut_ad(lsn != LSN_MAX); - - if (UNIV_UNLIKELY(recv_no_ibuf_operations)) - { - /* A non-final batch of recovery is active no writes to the log - are allowed yet. */ - ut_a(!callback); - return; - } - ut_ad(lsn <= log_sys.get_lsn()); #ifdef HAVE_PMEM @@ -922,6 +938,7 @@ void log_write_up_to(lsn_t lsn, bool durable, if (write_lock.acquire(lsn, durable ? nullptr : callback) == group_commit_lock::ACQUIRED) { + 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()); } @@ -1054,11 +1071,9 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() ib::info() << "Starting shutdown..."; - /* Wait until the master thread and all other operations are idle: our + /* Wait until the master task and all other operations are idle: our algorithm only works if the server is idle at shutdown */ - bool do_srv_shutdown = false; if (srv_master_timer) { - do_srv_shutdown = srv_fast_shutdown < 2; srv_master_timer.reset(); } @@ -1075,11 +1090,6 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() } srv_monitor_timer.reset(); - if (do_srv_shutdown) { - srv_shutdown(srv_fast_shutdown == 0); - } - - loop: ut_ad(lock_sys.is_initialised() || !srv_was_started); ut_ad(log_sys.is_initialised() || !srv_was_started); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 7d23001962b6a..1f96fbcc9d63d 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -46,7 +46,6 @@ Created 9/20/1997 Heikki Tuuri #include "page0page.h" #include "page0cur.h" #include "trx0undo.h" -#include "ibuf0ibuf.h" #include "trx0undo.h" #include "trx0rec.h" #include "fil0fil.h" @@ -71,17 +70,6 @@ number (FIL_PAGE_LSN) is in the future. Initially FALSE, and set by recv_recovery_from_checkpoint_start(). */ bool recv_lsn_checks_on; -/** If the following is TRUE, the buffer pool file pages must be invalidated -after recovery and no ibuf operations are allowed; this becomes TRUE if -the log record hash table becomes too full, and log records must be merged -to file pages already before the recovery is finished: in this case no -ibuf operations are allowed, as they could modify the pages read in the -buffer pool before the pages have been recovered to the up-to-date state. - -true means that recovery is running and no operations on the log file -are allowed yet: the variable name is misleading. */ -bool recv_no_ibuf_operations; - /** The maximum lsn we see for a page during the recovery process. If this is bigger than the lsn we are able to scan up to, that is an indication that the recovery failed and the database may be corrupt. */ @@ -1089,64 +1077,11 @@ class mlog_init_t void reset() { mysql_mutex_assert_owner(&recv_sys.mutex); - ut_ad(recv_no_ibuf_operations); for (map::value_type& i : inits) { i.second.created = false; } } - /** On the last recovery batch, mark whether there exist - buffered changes for the pages that were initialized - by buf_page_create() and still reside in the buffer pool. - @param[in,out] mtr dummy mini-transaction */ - void mark_ibuf_exist(mtr_t& mtr) - { - mysql_mutex_assert_owner(&recv_sys.mutex); - mtr.start(); - - for (const map::value_type& i : inits) { - if (!i.second.created) { - continue; - } - if (buf_block_t* block = buf_page_get_low( - i.first, 0, RW_X_LATCH, nullptr, - BUF_GET_IF_IN_POOL, - &mtr, nullptr, false)) { - if (UNIV_LIKELY_NULL(block->page.zip.data)) { - switch (fil_page_get_type( - block->page.zip.data)) { - case FIL_PAGE_INDEX: - case FIL_PAGE_RTREE: - if (page_zip_decompress( - &block->page.zip, - block->page.frame, - true)) { - break; - } - ib::error() << "corrupted " - << block->page.id(); - } - } - if (recv_no_ibuf_operations) { - mtr.commit(); - mtr.start(); - continue; - } - mysql_mutex_unlock(&recv_sys.mutex); - if (ibuf_page_exists(block->page.id(), - block->zip_size())) { - block->page.set_ibuf_exist(); - } - mtr.commit(); - mtr.start(); - mysql_mutex_lock(&recv_sys.mutex); - } - } - - mtr.commit(); - clear(); - } - /** Clear the data structure */ void clear() { inits.clear(); } }; @@ -3436,10 +3371,6 @@ void recv_sys_t::apply(bool last_batch) } } - recv_no_ibuf_operations = !last_batch || - srv_operation == SRV_OPERATION_RESTORE || - srv_operation == SRV_OPERATION_RESTORE_EXPORT; - mtr_t mtr; if (!pages.empty()) @@ -3580,10 +3511,7 @@ void recv_sys_t::apply(bool last_batch) } } - if (last_batch) - /* We skipped this in buf_page_create(). */ - mlog_init.mark_ibuf_exist(mtr); - else + if (!last_batch) { mlog_init.reset(); log_sys.latch.wr_unlock(); @@ -4298,7 +4226,6 @@ dberr_t recv_recovery_from_checkpoint_start() mysql_mutex_lock(&recv_sys.mutex); recv_sys.apply_log_recs = true; - recv_no_ibuf_operations = false; ut_d(recv_no_log_write = srv_operation == SRV_OPERATION_RESTORE || srv_operation == SRV_OPERATION_RESTORE_EXPORT); if (srv_operation == SRV_OPERATION_NORMAL) { diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 3eacd3ab7e17a..04b20de8e96dc 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -175,7 +175,6 @@ void mtr_t::start() m_made_dirty= false; m_latch_ex= false; - m_inside_ibuf= false; m_modifications= false; m_log_mode= MTR_LOG_ALL; ut_d(m_user_space_id= TRX_SYS_SPACE); @@ -323,7 +322,6 @@ void mtr_t::release() void mtr_t::commit() { ut_ad(is_active()); - ut_ad(!is_inside_ibuf()); /* This is a dirty read, for debugging. */ ut_ad(!m_modifications || !recv_no_log_write); @@ -506,7 +504,6 @@ void mtr_t::rollback_to_savepoint(ulint begin, ulint end) void mtr_t::commit_shrink(fil_space_t &space) { ut_ad(is_active()); - ut_ad(!is_inside_ibuf()); ut_ad(!high_level_read_only); ut_ad(m_modifications); ut_ad(m_made_dirty); @@ -613,7 +610,6 @@ void mtr_t::commit_shrink(fil_space_t &space) bool mtr_t::commit_file(fil_space_t &space, const char *name) { ut_ad(is_active()); - ut_ad(!is_inside_ibuf()); ut_ad(!high_level_read_only); ut_ad(m_modifications); ut_ad(!m_made_dirty); @@ -724,7 +720,6 @@ lsn_t mtr_t::commit_files(lsn_t checkpoint_lsn) ut_ad(log_sys.latch.is_write_locked()); #endif ut_ad(is_active()); - ut_ad(!is_inside_ibuf()); ut_ad(m_log_mode == MTR_LOG_ALL); ut_ad(!m_made_dirty); ut_ad(!m_memo); diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index c7164ccc3ff77..6141c9dcc374a 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -65,7 +65,9 @@ Created 10/21/1995 Heikki Tuuri #endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */ #ifdef _WIN32 -#include +# include +#elif !defined O_DSYNC +# define O_DSYNC O_SYNC #endif // my_test_if_atomic_write() , my_win_secattr() @@ -83,8 +85,7 @@ class io_slots int m_max_aio; public: io_slots(int max_submitted_io, int max_callback_concurrency) : - m_cache(max_submitted_io), - m_group(max_callback_concurrency), + m_cache(max_submitted_io), m_group(max_callback_concurrency, false), m_max_aio(max_submitted_io) { } @@ -105,6 +106,11 @@ class io_slots } /* Wait for completions of all AIO operations */ + void wait(std::unique_lock &lk) + { + m_cache.wait(lk); + } + void wait() { m_cache.wait(); @@ -124,6 +130,24 @@ class io_slots { wait(); } + + std::mutex& mutex() + { + return m_cache.mutex(); + } + + void resize(int max_submitted_io, int max_callback_concurrency, std::unique_lock &lk) + { + ut_a(lk.owns_lock()); + m_cache.resize(max_submitted_io); + m_group.set_max_tasks(max_callback_concurrency); + m_max_aio = max_submitted_io; + } + + tpool::task_group& task_group() + { + return m_group; + } }; static io_slots *read_slots; @@ -909,6 +933,8 @@ bool os_file_flush_func( os_file_t file) { + if (UNIV_UNLIKELY(my_disable_sync)) return true; + int ret; ret = os_file_sync_posix(file); @@ -959,40 +985,19 @@ os_file_create_simple_func( *success = false; - int create_flag; - const char* mode_str = NULL; + int create_flag = O_RDONLY; ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT)); ut_a(!(create_mode & OS_FILE_ON_ERROR_NO_EXIT)); - if (create_mode == OS_FILE_OPEN) { - mode_str = "OPEN"; - - if (access_type == OS_FILE_READ_ONLY) { - - create_flag = O_RDONLY; - - } else if (read_only) { - - create_flag = O_RDONLY; - - } else { + if (read_only) { + } else if (create_mode == OS_FILE_OPEN) { + if (access_type != OS_FILE_READ_ONLY) { create_flag = O_RDWR; } - - } else if (read_only) { - - mode_str = "OPEN"; - create_flag = O_RDONLY; - } else if (create_mode == OS_FILE_CREATE) { - - mode_str = "CREATE"; create_flag = O_RDWR | O_CREAT | O_EXCL; - } else if (create_mode == OS_FILE_CREATE_PATH) { - - mode_str = "CREATE PATH"; /* Create subdirs along the path if needed. */ *success = os_file_create_subdirs_if_needed(name); @@ -1018,40 +1023,32 @@ os_file_create_simple_func( return(OS_FILE_CLOSED); } - bool retry; + create_flag |= O_CLOEXEC; + if (fil_system.is_write_through()) create_flag |= O_DSYNC; + int direct_flag = fil_system.is_buffered() ? 0 : O_DIRECT; - do { - file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); + for (;;) { + file = open(name, create_flag | direct_flag, os_innodb_umask); if (file == -1) { + if (direct_flag && errno == EINVAL) { + direct_flag = 0; + continue; + } + *success = false; - retry = os_file_handle_error( + if (!os_file_handle_error( name, create_mode == OS_FILE_OPEN - ? "open" : "create"); + ? "open" : "create")) { + break; + } } else { *success = true; - retry = false; - } - - } while (retry); - - /* This function is always called for data files, we should disable - OS caching (O_DIRECT) here as we do in os_file_create_func(), so - we open the same file in the same mode, see man page of open(2). */ - if (!srv_read_only_mode && *success) { - switch (srv_file_flush_method) { - case SRV_O_DSYNC: - case SRV_O_DIRECT: - case SRV_O_DIRECT_NO_FSYNC: - os_file_set_nocache(file, name, mode_str); - break; - default: break; } } -#ifndef _WIN32 if (!read_only && *success && access_type == OS_FILE_READ_WRITE @@ -1062,7 +1059,6 @@ os_file_create_simple_func( close(file); file = -1; } -#endif /* !_WIN32 */ return(file); } @@ -1134,8 +1130,8 @@ os_file_create_func( return(OS_FILE_CLOSED); ); - int create_flag; - const char* mode_str = NULL; + int create_flag = O_RDONLY | O_CLOEXEC; + const char* mode_str = "OPEN"; on_error_no_exit = create_mode & OS_FILE_ON_ERROR_NO_EXIT ? true : false; @@ -1145,30 +1141,17 @@ os_file_create_func( create_mode &= ulint(~(OS_FILE_ON_ERROR_NO_EXIT | OS_FILE_ON_ERROR_SILENT)); - if (create_mode == OS_FILE_OPEN - || create_mode == OS_FILE_OPEN_RAW - || create_mode == OS_FILE_OPEN_RETRY) { - - mode_str = "OPEN"; - - create_flag = read_only ? O_RDONLY : O_RDWR; - - } else if (read_only) { - - mode_str = "OPEN"; - - create_flag = O_RDONLY; - + if (read_only) { + } else if (create_mode == OS_FILE_OPEN + || create_mode == OS_FILE_OPEN_RAW + || create_mode == OS_FILE_OPEN_RETRY) { + create_flag = O_RDWR | O_CLOEXEC; } else if (create_mode == OS_FILE_CREATE) { - mode_str = "CREATE"; - create_flag = O_RDWR | O_CREAT | O_EXCL; - + create_flag = O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC; } else if (create_mode == OS_FILE_OVERWRITE) { - mode_str = "OVERWRITE"; - create_flag = O_RDWR | O_CREAT | O_TRUNC; - + create_flag = O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC; } else { ib::error() << "Unknown file create mode (" << create_mode << ")" @@ -1183,25 +1166,30 @@ os_file_create_func( ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL); - /* We let O_DSYNC only affect log files */ + create_flag |= O_CLOEXEC; - if (!read_only - && type == OS_LOG_FILE - && srv_file_flush_method == SRV_O_DSYNC) { -#ifdef O_DSYNC + int direct_flag = type == OS_DATA_FILE && create_mode != OS_FILE_CREATE + && !fil_system.is_buffered() + ? O_DIRECT : 0; + + if (read_only) { + } else if ((type == OS_LOG_FILE) + ? log_sys.log_write_through + : fil_system.is_write_through()) { create_flag |= O_DSYNC; -#else - create_flag |= O_SYNC; -#endif } os_file_t file; - bool retry; - do { - file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); + for (;;) { + file = open(name, create_flag | direct_flag, os_innodb_umask); if (file == -1) { + if (direct_flag && errno == EINVAL) { + direct_flag = 0; + continue; + } + const char* operation; operation = (create_mode == OS_FILE_CREATE @@ -1210,39 +1198,30 @@ os_file_create_func( *success = false; if (on_error_no_exit) { - retry = os_file_handle_error_no_exit( - name, operation, on_error_silent); + if (os_file_handle_error_no_exit( + name, operation, on_error_silent)) + continue; } else { - retry = os_file_handle_error(name, operation); + if (os_file_handle_error(name, operation)) + continue; } + + return file; } else { *success = true; - retry = false; + break; } - - } while (retry); - - if (!*success) { - return file; } #if (defined __sun__ && defined DIRECTIO_ON) || defined O_DIRECT - if (type == OS_DATA_FILE) { - switch (srv_file_flush_method) { - case SRV_O_DSYNC: - case SRV_O_DIRECT: - case SRV_O_DIRECT_NO_FSYNC: + if (type == OS_DATA_FILE && create_mode == OS_FILE_CREATE + && !fil_system.is_buffered()) { # ifdef __linux__ use_o_direct: # endif - os_file_set_nocache(file, name, mode_str); - break; - default: - break; - } - } + os_file_set_nocache(file, name, mode_str); # ifdef __linux__ - else if (type == OS_LOG_FILE && !log_sys.is_opened()) { + } else if (type == OS_LOG_FILE && !log_sys.is_opened()) { struct stat st; char b[20 + sizeof "/sys/dev/block/" ":" "/../queue/physical_block_size"]; @@ -1294,11 +1273,10 @@ os_file_create_func( log_sys.log_buffered= true; log_sys.set_block_size(512); } - } # endif + } #endif -#ifndef _WIN32 if (!read_only && create_mode != OS_FILE_OPEN_RAW && !my_disable_locking @@ -1326,7 +1304,6 @@ os_file_create_func( close(file); file = -1; } -#endif /* !_WIN32 */ return(file); } @@ -1764,6 +1741,9 @@ Flushes the write buffers of a given file to the disk. @return true if success */ bool os_file_flush_func(os_file_t file) { + if (UNIV_UNLIKELY(my_disable_sync)) + return true; + ++os_n_fsyncs; static bool disable_datasync; @@ -1989,6 +1969,11 @@ os_file_create_simple_func( return(OS_FILE_CLOSED); } + if (fil_system.is_write_through()) + attributes |= FILE_FLAG_WRITE_THROUGH; + if (!fil_system.is_buffered()) + attributes |= FILE_FLAG_NO_BUFFERING; + bool retry; do { @@ -2160,27 +2145,16 @@ os_file_create_func( if (!log_sys.is_opened() && !log_sys.log_buffered) { attributes|= FILE_FLAG_NO_BUFFERING; } - if (srv_file_flush_method == SRV_O_DSYNC) + if (log_sys.log_write_through) attributes|= FILE_FLAG_WRITE_THROUGH; - } - else if (type == OS_DATA_FILE) - { - switch (srv_file_flush_method) - { - case SRV_FSYNC: - case SRV_LITTLESYNC: - case SRV_NOSYNC: - break; - default: + } else { + if (type == OS_DATA_FILE && !fil_system.is_buffered()) attributes|= FILE_FLAG_NO_BUFFERING; - } + if (fil_system.is_write_through()) + attributes|= FILE_FLAG_WRITE_THROUGH; } - DWORD access = GENERIC_READ; - - if (!read_only) { - access |= GENERIC_WRITE; - } + DWORD access = read_only ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE; for (;;) { const char *operation; @@ -3633,6 +3607,58 @@ int os_aio_init() } +/** +Change reader or writer thread parameter on a running server. +This includes resizing the io slots, as we calculate +number of outstanding IOs based on the these variables. + +It is trickier with when Linux AIO is involved (io_context +needs to be recreated to account for different number of +max_events). With Linux AIO, depending on fs-max-aio number +and user and system wide max-aio limitation, this can fail. + +Otherwise, we just resize the slots, and allow for +more concurrent threads via thread_group setting. + +@param[in] n_reader_threads - max number of concurrently + executing read callbacks +@param[in] n_writer_thread - max number of cuncurrently + executing write callbacks +@return 0 for success, !=0 for error. +*/ +int os_aio_resize(ulint n_reader_threads, ulint n_writer_threads) +{ + /* Lock the slots, and wait until all current IOs finish.*/ + std::unique_lock lk_read(read_slots->mutex()); + std::unique_lock lk_write(write_slots->mutex()); + + read_slots->wait(lk_read); + write_slots->wait(lk_write); + + /* Now, all IOs have finished and no new ones can start, due to locks. */ + int max_read_events= int(n_reader_threads * OS_AIO_N_PENDING_IOS_PER_THREAD); + int max_write_events= int(n_writer_threads * OS_AIO_N_PENDING_IOS_PER_THREAD); + int events= max_read_events + max_write_events; + + /** Do the Linux AIO dance (this will try to create a new + io context with changed max_events ,etc*/ + + if (int ret= srv_thread_pool->reconfigure_aio(srv_use_native_aio, events)) + { + /** Do the best effort. We can't change the parallel io number, + but we still can adjust the number of concurrent completion handlers.*/ + read_slots->task_group().set_max_tasks(static_cast(n_reader_threads)); + write_slots->task_group().set_max_tasks(static_cast(n_writer_threads)); + return ret; + } + + /* Allocation succeeded, resize the slots*/ + read_slots->resize(max_read_events, static_cast(n_reader_threads), lk_read); + write_slots->resize(max_write_events, static_cast(n_writer_threads), lk_write); + + return 0; +} + void os_aio_free() { srv_thread_pool->disable_aio(); diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index b019694b9f616..8d3a44d630d86 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2018, 2022, MariaDB Corporation. +Copyright (c) 2018, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1369,8 +1369,7 @@ page_cur_insert_rec_low( ut_ad(!!page_is_comp(block->page.frame) == !!rec_offs_comp(offsets)); ut_ad(fil_page_index_page_check(block->page.frame)); ut_ad(mach_read_from_8(PAGE_HEADER + PAGE_INDEX_ID + block->page.frame) == - index->id || - mtr->is_inside_ibuf()); + index->id || index->is_dummy); ut_ad(page_dir_get_n_slots(block->page.frame) >= 2); ut_ad(!page_rec_is_supremum(cur->rec)); @@ -1769,11 +1768,6 @@ static inline void page_zip_dir_add_slot(buf_block_t *block, Inserts a record next to page cursor on a compressed and uncompressed page. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if this is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return pointer to inserted record @return nullptr on failure */ rec_t* @@ -1797,8 +1791,7 @@ page_cur_insert_rec_zip( ut_ad(rec_offs_comp(offsets)); ut_ad(fil_page_get_type(page) == FIL_PAGE_INDEX || fil_page_get_type(page) == FIL_PAGE_RTREE); - ut_ad(mach_read_from_8(PAGE_HEADER + PAGE_INDEX_ID + page) == - index->id || mtr->is_inside_ibuf()); + ut_ad(mach_read_from_8(PAGE_HEADER + PAGE_INDEX_ID + page) == index->id); ut_ad(!page_get_instant(page)); ut_ad(!page_cur_is_after_last(cursor)); #ifdef UNIV_ZIP_DEBUG @@ -2265,8 +2258,7 @@ page_cur_delete_rec( == index->table->not_redundant()); ut_ad(fil_page_index_page_check(block->page.frame)); ut_ad(mach_read_from_8(PAGE_HEADER + PAGE_INDEX_ID + block->page.frame) - == index->id - || mtr->is_inside_ibuf()); + == index->id); ut_ad(mtr->is_named_space(index->table->space)); /* The record must not be the supremum or infimum record. */ diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index 127eb11f939ce..63bd39feb4db5 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -336,17 +336,13 @@ page_create_zip( /* PAGE_MAX_TRX_ID or PAGE_ROOT_AUTO_INC are always 0 for temporary tables. */ ut_ad(max_trx_id == 0 || !index->table->is_temporary()); - /* In secondary indexes and the change buffer, PAGE_MAX_TRX_ID + /* In secondary indexes, PAGE_MAX_TRX_ID must be zero on non-leaf pages. max_trx_id can be 0 when the - index consists of an empty root (leaf) page. */ - ut_ad(max_trx_id == 0 - || level == 0 - || !dict_index_is_sec_or_ibuf(index) - || index->table->is_temporary()); - /* In the clustered index, PAGE_ROOT_AUTOINC or + index consists of an empty root (leaf) page. + + the clustered index, PAGE_ROOT_AUTOINC or PAGE_MAX_TRX_ID must be 0 on other pages than the root. */ - ut_ad(level == 0 || max_trx_id == 0 - || !dict_index_is_sec_or_ibuf(index) + ut_ad(max_trx_id == 0 || level == 0 || index->is_primary() || index->table->is_temporary()); buf_block_modify_clock_inc(block); @@ -390,8 +386,7 @@ page_create_empty( same temp-table in parallel. max_trx_id is ignored for temp tables because it not required for MVCC. */ - if (dict_index_is_sec_or_ibuf(index) - && !index->table->is_temporary() + if (!index->is_primary() && !index->table->is_temporary() && page_is_leaf(block->page.frame)) { max_trx_id = page_get_max_trx_id(block->page.frame); ut_ad(max_trx_id); @@ -435,11 +430,6 @@ page_create_empty( Differs from page_copy_rec_list_end, because this function does not touch the lock table and max trx id on page or compress the page. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return error code */ dberr_t page_copy_rec_list_end_no_locks( @@ -507,11 +497,6 @@ Copies records from page to new_page, from a given record onward, including that record. Infimum and supremum records are not copied. The records are copied to the start of the record list on new_page. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_t::commit(). - @return pointer to the original successor of the infimum record on new_block @retval nullptr on ROW_FORMAT=COMPRESSED page overflow */ rec_t* @@ -603,8 +588,7 @@ page_copy_rec_list_end( same temp-table in parallel. max_trx_id is ignored for temp tables because it not required for MVCC. */ - if (dict_index_is_sec_or_ibuf(index) - && page_is_leaf(page) + if (!index->is_primary() && page_is_leaf(page) && !index->table->is_temporary()) { ut_ad(!was_empty || page_dir_get_n_heap(new_page) == PAGE_HEAP_NO_USER_LOW @@ -677,11 +661,6 @@ Copies records from page to new_page, up to the given record, NOT including that record. Infimum and supremum records are not copied. The records are copied to the end of the record list on new_page. -IMPORTANT: The caller will have to update IBUF_BITMAP_FREE -if new_block is a compressed leaf page in a secondary index. -This has to be done either within the same mini-transaction, -or by invoking ibuf_reset_free_bits() before mtr_commit(). - @return pointer to the original predecessor of the supremum record on new_block @retval nullptr on ROW_FORMAT=COMPRESSED page overflow */ rec_t* @@ -786,8 +765,7 @@ page_copy_rec_list_start( same temp-table in parallel. max_trx_id is ignored for temp tables because it not required for MVCC. */ - if (n_core && dict_index_is_sec_or_ibuf(index) - && !index->table->is_temporary()) { + if (n_core && !index->is_primary() && !index->table->is_temporary()) { page_update_max_trx_id(new_block, new_page_zip, page_get_max_trx_id(block->page.frame), @@ -2059,7 +2037,7 @@ bool page_validate(const page_t* page, const dict_index_t* index) max_trx_id is ignored for temp tables because it not required for MVCC. */ if (!page_is_leaf(page) || page_is_empty(page) - || !dict_index_is_sec_or_ibuf(index) + || index->is_primary() || index->table->is_temporary()) { } else if (trx_id_t sys_max_trx_id = trx_sys.get_max_trx_id()) { trx_id_t max_trx_id = page_get_max_trx_id(page); diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 56b58dd87d087..aff01764be6fc 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -2,7 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2022, MariaDB Corporation. +Copyright (c) 2014, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -408,8 +408,6 @@ inline void mtr_t::zmemcpy(const buf_block_t &b, void *dest, const void *str, static void page_zip_compress_write_log(buf_block_t *block, dict_index_t *index, mtr_t *mtr) { - ut_ad(!index->is_ibuf()); - if (!mtr->is_logged()) return; @@ -463,8 +461,7 @@ page_zip_get_n_prev_extern( ut_ad(page_is_leaf(page)); ut_ad(page_is_comp(page)); ut_ad(dict_table_is_comp(index->table)); - ut_ad(dict_index_is_clust(index)); - ut_ad(!dict_index_is_ibuf(index)); + ut_ad(index->is_primary()); heap_no = rec_get_heap_no_new(rec); ut_ad(heap_no >= PAGE_HEAP_NO_USER_LOW); @@ -1282,7 +1279,6 @@ page_zip_compress( ut_ad(page_simple_validate_new((page_t*) page)); ut_ad(page_zip_simple_validate(page_zip)); ut_ad(dict_table_is_comp(index->table)); - ut_ad(!dict_index_is_ibuf(index)); MEM_CHECK_DEFINED(page, srv_page_size); @@ -4374,10 +4370,6 @@ Reorganize and compress a page. This is a low-level operation for compressed pages, to be used when page_zip_compress() fails. On success, redo log will be written. The function btr_page_reorganize() should be preferred whenever possible. -IMPORTANT: if page_zip_reorganize() is invoked on a leaf page of a -non-clustered index, the caller must update the insert buffer free -bits in the same mini-transaction in such a way that the modification -will be redo-logged. @return error code @retval DB_FAIL on overflow; the block_zip will be left intact */ dberr_t @@ -4398,7 +4390,6 @@ page_zip_reorganize( ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); ut_ad(block->page.zip.data); ut_ad(page_is_comp(page)); - ut_ad(!dict_index_is_ibuf(index)); ut_ad(!index->table->is_temporary()); /* Note that page_zip_validate(page_zip, page, index) may fail here. */ MEM_CHECK_DEFINED(page, srv_page_size); @@ -4505,7 +4496,6 @@ page_zip_copy_recs( ut_ad(mtr->memo_contains_flagged(block, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr->memo_contains_page_flagged(src, MTR_MEMO_PAGE_X_FIX)); - ut_ad(!dict_index_is_ibuf(index)); ut_ad(!index->table->is_temporary()); #ifdef UNIV_ZIP_DEBUG /* The B-tree operations that call this function may set diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc index a77ddafd56837..92ec8ba0869bc 100644 --- a/storage/innobase/rem/rem0cmp.cc +++ b/storage/innobase/rem/rem0cmp.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2020, 2022, MariaDB Corporation. +Copyright (c) 2020, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -401,8 +401,8 @@ int cmp_dtuple_rec_with_match_low(const dtuple_t *dtuple, const rec_t *rec, ut_ad(!dfield_is_ext(dtuple_field)); - ret = cmp_data(type->mtype, type->prtype, !index->is_ibuf() - && index->fields[cur_field].descending, + ret = cmp_data(type->mtype, type->prtype, + index->fields[cur_field].descending, dtuple_b_ptr, dtuple_f_len, rec_b_ptr, rec_f_len); if (ret) { @@ -480,7 +480,6 @@ cmp_dtuple_rec_with_match_bytes( ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(!(REC_INFO_MIN_REC_FLAG & dtuple_get_info_bits(dtuple))); - ut_ad(!index->is_ibuf()); if (UNIV_UNLIKELY(REC_INFO_MIN_REC_FLAG & rec_get_info_bits(rec, rec_offs_comp(offsets)))) { @@ -829,32 +828,21 @@ cmp_rec_rec( dict_index_get_n_unique_in_tree(index)); for (; cur_field < n_fields; cur_field++) { - ulint mtype; - ulint prtype; - bool descending; - - if (UNIV_UNLIKELY(dict_index_is_ibuf(index))) { - /* This is for the insert buffer B-tree. */ - mtype = DATA_BINARY; + const dict_field_t* field = dict_index_get_nth_field( + index, cur_field); + bool descending = field->descending; + ulint mtype = field->col->mtype; + ulint prtype = field->col->prtype; + + if (UNIV_LIKELY(!index->is_spatial())) { + } else if (cur_field == 0) { + ut_ad(DATA_GEOMETRY_MTYPE(mtype)); + prtype |= DATA_GIS_MBR; + } else if (!page_rec_is_leaf(rec2)) { + /* Compare the child page number. */ + ut_ad(cur_field == 1); + mtype = DATA_SYS_CHILD; prtype = 0; - descending = false; - } else { - const dict_field_t* field = dict_index_get_nth_field( - index, cur_field); - descending = field->descending; - mtype = field->col->mtype; - prtype = field->col->prtype; - - if (UNIV_LIKELY(!dict_index_is_spatial(index))) { - } else if (cur_field == 0) { - ut_ad(DATA_GEOMETRY_MTYPE(mtype)); - prtype |= DATA_GIS_MBR; - } else if (!page_rec_is_leaf(rec2)) { - /* Compare the child page number. */ - ut_ad(cur_field == 1); - mtype = DATA_SYS_CHILD; - prtype = 0; - } } /* We should never encounter an externally stored field. diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index da6447c390eff..a84cba01ef0dd 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -479,7 +479,7 @@ rec_offs_make_valid( const bool is_alter_metadata = leaf && rec_is_alter_metadata(rec, *index); ut_ad((leaf && rec_is_metadata(rec, *index)) - || index->is_dummy || index->is_ibuf() + || index->is_dummy || (leaf ? rec_offs_n_fields(offsets) <= dict_index_get_n_fields(index) @@ -891,18 +891,15 @@ rec_get_offsets_func( /* The infimum and supremum records carry 1 field. */ ut_ad(is_user_rec || n == 1); ut_ad(!is_user_rec || n_core || index->is_dummy - || dict_index_is_ibuf(index) || n == n_fields /* dict_stats_analyze_index_level() */ || n - 1 == dict_index_get_n_unique_in_tree_nonleaf(index)); ut_ad(!is_user_rec || !n_core || index->is_dummy - || dict_index_is_ibuf(index) || n == n_fields /* btr_pcur_restore_position() */ || (n + (index->id == DICT_INDEXES_ID) >= n_core)); if (is_user_rec && n_core && n < index->n_fields) { ut_ad(!index->is_dummy); - ut_ad(!dict_index_is_ibuf(index)); n = index->n_fields; } } @@ -1993,7 +1990,7 @@ rec_copy_prefix_to_buf( or NULL */ ulint* buf_size) /*!< in/out: buffer size */ { - ut_ad(n_fields <= index->n_fields || dict_index_is_ibuf(index)); + ut_ad(n_fields <= index->n_fields); ut_ad(index->n_core_null_bytes <= UT_BITS_IN_BYTES(index->n_nullable)); UNIV_PREFETCH_RW(*buf); diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index c4ee55e79b3cf..c2c17f718ec95 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2071,7 +2071,7 @@ dberr_t PageConverter::operator()(buf_block_t* block) UNIV_NOTHROW we no longer evict the pages on DISCARD TABLESPACE. */ buf_page_get_low(block->page.id(), get_zip_size(), RW_NO_LATCH, nullptr, BUF_PEEK_IF_IN_POOL, - nullptr, nullptr, false); + nullptr, nullptr); uint16_t page_type; @@ -2109,8 +2109,9 @@ row_import_cleanup( row_prebuilt_t* prebuilt, /*!< in/out: prebuilt from handler */ dberr_t err) /*!< in: error code */ { + dict_table_t* table = prebuilt->table; + if (err != DB_SUCCESS) { - dict_table_t* table = prebuilt->table; table->file_unreadable = true; if (table->space) { fil_close_tablespace(table->space_id); @@ -2141,7 +2142,25 @@ row_import_cleanup( DBUG_EXECUTE_IF("ib_import_before_checkpoint_crash", DBUG_SUICIDE();); - return(err); + if (err != DB_SUCCESS + || !dict_table_get_first_index(table)->is_gen_clust()) { + return err; + } + + btr_cur_t cur; + mtr_t mtr; + mtr.start(); + err = cur.open_leaf(false, dict_table_get_first_index(table), + BTR_SEARCH_LEAF, &mtr); + if (err != DB_SUCCESS) { + } else if (const rec_t *rec = + page_rec_get_prev(btr_cur_get_rec(&cur))) { + if (page_rec_is_user_rec(rec)) + table->row_id= mach_read_from_6(rec); + } + mtr.commit(); + + return err; } /*****************************************************************//** @@ -2276,55 +2295,6 @@ row_import_adjust_root_pages_of_secondary_indexes( return(err); } -/*****************************************************************//** -Ensure that dict_sys.row_id exceeds SELECT MAX(DB_ROW_ID). */ -MY_ATTRIBUTE((nonnull)) static -void -row_import_set_sys_max_row_id( -/*==========================*/ - row_prebuilt_t* prebuilt, /*!< in/out: prebuilt from - handler */ - const dict_table_t* table) /*!< in: table to import */ -{ - const rec_t* rec; - mtr_t mtr; - btr_pcur_t pcur; - row_id_t row_id = 0; - dict_index_t* index; - - index = dict_table_get_first_index(table); - ut_ad(index->is_primary()); - ut_ad(dict_index_is_auto_gen_clust(index)); - - mtr_start(&mtr); - - mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO); - - if (pcur.open_leaf(false, index, BTR_SEARCH_LEAF, &mtr) - == DB_SUCCESS) { - rec = btr_pcur_move_to_prev_on_page(&pcur); - - if (!rec) { - /* The table is corrupted. */ - } else if (page_rec_is_infimum(rec)) { - /* The table is empty. */ - } else if (rec_is_metadata(rec, *index)) { - /* The clustered index contains the metadata - record only, that is, the table is empty. */ - } else { - row_id = mach_read_from_6(rec); - } - } - - mtr_commit(&mtr); - - if (row_id) { - /* Update the system row id if the imported index row id is - greater than the max system row id. */ - dict_sys.update_row_id(row_id); - } -} - /*****************************************************************//** Read the a string from the meta data file. @return DB_SUCCESS or error code. */ @@ -4256,8 +4226,6 @@ row_import_for_mysql( ut_ad(trx->state == TRX_STATE_ACTIVE); ut_ad(!table->is_readable()); - ibuf_delete_for_discarded_space(table->space_id); - /* Assign an undo segment for the transaction, so that the transaction will be recovered after a crash. */ @@ -4456,12 +4424,6 @@ row_import_for_mysql( ut_free(filepath); - if (err == DB_SUCCESS) { - err = ibuf_check_bitmap_on_import(trx, table->space); - } - - DBUG_EXECUTE_IF("ib_import_check_bitmap_failure", err = DB_CORRUPTION;); - if (err != DB_SUCCESS) { return row_import_cleanup(prebuilt, err); } @@ -4518,13 +4480,6 @@ row_import_for_mysql( return row_import_error(prebuilt, err); } - /* Ensure that the next available DB_ROW_ID is not smaller than - any DB_ROW_ID stored in the table. */ - - if (prebuilt->clust_index_was_generated) { - row_import_set_sys_max_row_id(prebuilt, table); - } - ib::info() << "Phase III - Flush changes to disk"; /* Ensure that all pages dirtied during the IMPORT make it to disk. diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index de58e3896b094..9cd83e98528b3 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2022, MariaDB Corporation. +Copyright (c) 2016, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -31,7 +31,6 @@ Created 4/20/1996 Heikki Tuuri #include "btr0btr.h" #include "btr0cur.h" #include "mach0data.h" -#include "ibuf0ibuf.h" #include "que0que.h" #include "row0upd.h" #include "row0sel.h" @@ -2403,7 +2402,10 @@ row_ins_duplicate_error_in_clust( duplicate: trx->error_info = cursor->index(); err = DB_DUPLICATE_KEY; - if (cursor->index()->table->versioned() + if (thr->prebuilt + && thr->prebuilt->upd_node + && thr->prebuilt->upd_node->is_delete + == VERSIONED_DELETE && entry->vers_history_row()) { ulint trx_id_len; @@ -2680,7 +2682,6 @@ row_ins_clust_index_entry_low( } cursor = btr_pcur_get_btr_cur(&pcur); - cursor->thr = thr; #ifdef UNIV_DEBUG { @@ -2946,7 +2947,6 @@ row_ins_sec_index_entry_low( ut_ad(!dict_index_is_clust(index)); ut_ad(mode == BTR_MODIFY_LEAF || mode == BTR_INSERT_TREE); - cursor.thr = thr; cursor.rtr_info = NULL; cursor.page_cur.index = index; ut_ad(thr_get_trx(thr)->id != 0); @@ -2968,6 +2968,7 @@ row_ins_sec_index_entry_low( if (index->is_spatial()) { rtr_init_rtr_info(&rtr_info, false, &cursor, index, false); + rtr_info.thr = thr; rtr_info_update_btr(&cursor, &rtr_info); err = btr_cur_search_to_nth_level(0, entry, @@ -2981,6 +2982,7 @@ row_ins_sec_index_entry_low( rtr_clean_rtr_info(&rtr_info, true); rtr_init_rtr_info(&rtr_info, false, &cursor, index, false); + rtr_info.thr = thr; rtr_info_update_btr(&cursor, &rtr_info); mtr.start(); if (index->table->is_temporary()) { @@ -2998,14 +3000,6 @@ row_ins_sec_index_entry_low( goto func_exit;}); } else { - if (!index->table->is_temporary()) { - search_mode = btr_latch_mode( - search_mode - | (thr_get_trx(thr)->check_unique_secondary - ? BTR_INSERT | BTR_IGNORE_SEC_UNIQUE - : BTR_INSERT)); - } - err = btr_cur_search_to_nth_level(0, entry, PAGE_CUR_LE, search_mode, &cursor, &mtr); } @@ -3017,12 +3011,6 @@ row_ins_sec_index_entry_low( goto func_exit; } - if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) { - ut_ad(!dict_index_is_spatial(index)); - /* The insert was buffered during the search: we are done */ - goto func_exit; - } - #ifdef UNIV_DEBUG { page_t* page = btr_cur_get_page(&cursor); @@ -3082,13 +3070,9 @@ row_ins_sec_index_entry_low( locked with s-locks the necessary records to prevent any insertion of a duplicate by another transaction. Let us now reposition the cursor and - continue the insertion (bypassing the change buffer). */ + continue the insertion. */ err = btr_cur_search_to_nth_level( - 0, entry, PAGE_CUR_LE, - btr_latch_mode(search_mode - & ~(BTR_INSERT - | BTR_IGNORE_SEC_UNIQUE)), - &cursor, &mtr); + 0, entry, PAGE_CUR_LE, search_mode, &cursor, &mtr); if (err != DB_SUCCESS) { goto func_exit; } @@ -3319,11 +3303,6 @@ row_ins_sec_index_entry( if (err == DB_FAIL) { mem_heap_empty(heap); - if (index->table->space == fil_system.sys_space - && !(index->type & (DICT_UNIQUE | DICT_SPATIAL))) { - ibuf_free_excess_pages(); - } - /* Try then pessimistic descent to the B-tree */ log_free_check(); @@ -3546,19 +3525,6 @@ row_ins_index_entry_step( DBUG_RETURN(err); } -/***********************************************************//** -Allocates a row id for row and inits the node->index field. */ -UNIV_INLINE -void -row_ins_alloc_row_id_step( -/*======================*/ - ins_node_t* node) /*!< in: row insert node */ -{ - ut_ad(node->state == INS_NODE_ALLOC_ROW_ID); - if (dict_table_get_first_index(node->table)->is_gen_clust()) - dict_sys_write_row_id(node->sys_buf, dict_sys.get_new_row_id()); -} - /***********************************************************//** Gets a row to insert from the values list. */ UNIV_INLINE @@ -3639,13 +3605,18 @@ row_ins( DBUG_PRINT("row_ins", ("table: %s", node->table->name.m_name)); if (node->state == INS_NODE_ALLOC_ROW_ID) { - - row_ins_alloc_row_id_step(node); - node->index = dict_table_get_first_index(node->table); ut_ad(node->entry_list.empty() == false); node->entry = node->entry_list.begin(); + if (node->index->is_gen_clust()) { + const uint64_t db_row_id{++node->table->row_id}; + if (db_row_id >> 48) { + DBUG_RETURN(DB_OUT_OF_FILE_SPACE); + } + mach_write_to_6(node->sys_buf, db_row_id); + } + if (node->ins_type == INS_SEARCHED) { row_ins_get_row_from_select(node); diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 64b4d02fa181c..958975804b23d 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1701,22 +1701,6 @@ row_log_table_apply_delete_low( if (error) { goto err_exit; } -#ifdef UNIV_DEBUG - switch (btr_pcur_get_btr_cur(pcur)->flag) { - case BTR_CUR_DELETE_REF: - case BTR_CUR_DEL_MARK_IBUF: - case BTR_CUR_DELETE_IBUF: - case BTR_CUR_INSERT_TO_IBUF: - /* We did not request buffering. */ - break; - case BTR_CUR_HASH: - case BTR_CUR_HASH_FAIL: - case BTR_CUR_BINARY: - goto flag_ok; - } - ut_ad(0); -flag_ok: -#endif /* UNIV_DEBUG */ if (page_rec_is_infimum(btr_pcur_get_rec(pcur)) || btr_pcur_get_low_match(pcur) < index->n_uniq) { @@ -1724,8 +1708,8 @@ row_log_table_apply_delete_low( found, because new_table is being modified by this thread only, and all indexes should be updated in sync. */ - mtr->commit(); - return(DB_INDEX_CORRUPT); + error = DB_INDEX_CORRUPT; + goto err_exit; } btr_cur_pessimistic_delete(&error, FALSE, @@ -1785,22 +1769,6 @@ row_log_table_apply_delete( if (err != DB_SUCCESS) { goto all_done; } -#ifdef UNIV_DEBUG - switch (btr_pcur_get_btr_cur(&pcur)->flag) { - case BTR_CUR_DELETE_REF: - case BTR_CUR_DEL_MARK_IBUF: - case BTR_CUR_DELETE_IBUF: - case BTR_CUR_INSERT_TO_IBUF: - /* We did not request buffering. */ - break; - case BTR_CUR_HASH: - case BTR_CUR_HASH_FAIL: - case BTR_CUR_BINARY: - goto flag_ok; - } - ut_ad(0); -flag_ok: -#endif /* UNIV_DEBUG */ if (page_rec_is_infimum(btr_pcur_get_rec(&pcur)) || btr_pcur_get_low_match(&pcur) < index->n_uniq) { @@ -1934,19 +1902,6 @@ row_log_table_apply_update( return error; } -#ifdef UNIV_DEBUG - switch (btr_pcur_get_btr_cur(&pcur)->flag) { - case BTR_CUR_DELETE_REF: - case BTR_CUR_DEL_MARK_IBUF: - case BTR_CUR_DELETE_IBUF: - case BTR_CUR_INSERT_TO_IBUF: - ut_ad(0);/* We did not request buffering. */ - case BTR_CUR_HASH: - case BTR_CUR_HASH_FAIL: - case BTR_CUR_BINARY: - break; - } -#endif /* UNIV_DEBUG */ ut_ad(!page_rec_is_infimum(btr_pcur_get_rec(&pcur)) && btr_pcur_get_low_match(&pcur) >= index->n_uniq); @@ -2096,8 +2051,17 @@ row_log_table_apply_update( ut_free(pcur.old_rec_buf); pcur.old_rec_buf = nullptr; - if (ROW_FOUND != row_search_index_entry( - entry, BTR_MODIFY_TREE, &pcur, &mtr)) { + error = btr_pcur_open(entry, PAGE_CUR_LE, BTR_MODIFY_TREE, + &pcur, 0, &mtr); + + if (error != DB_SUCCESS) { + ut_ad(0); + break; + } + + if (btr_pcur_is_before_first_on_page(&pcur) + || btr_pcur_get_low_match(&pcur) + != dtuple_get_n_fields(entry)) { ut_ad(0); error = DB_CORRUPTION; break; diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 723b4b1d38766..d321546430690 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2227,7 +2227,7 @@ row_merge_read_clustered_index( next_page_no), old_table->space->zip_size(), RW_S_LATCH, nullptr, BUF_GET, &mtr, - &err, false); + &err); if (!block) { goto err_exit; } @@ -3715,8 +3715,6 @@ row_merge_mtuple_to_dtuple( dtuple_t* dtuple, const mtuple_t* mtuple) { - ut_ad(!dict_index_is_ibuf(index)); - memcpy(dtuple->fields, mtuple->fields, dtuple->n_fields * sizeof *mtuple->fields); } diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 549d274522364..81879431096b9 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -43,7 +43,6 @@ Created 9/17/2000 Heikki Tuuri #include "fsp0file.h" #include "fts0fts.h" #include "fts0types.h" -#include "ibuf0ibuf.h" #include "lock0lock.h" #include "log0log.h" #include "pars0pars.h" @@ -2334,12 +2333,7 @@ row_discard_tablespace( 2) Purge and rollback: we assign a new table id for the table. Since purge and rollback look for the table based on the table id, they see the table as 'dropped' and discard - their operations. - - 3) Insert buffer: we remove all entries for the tablespace in - the insert buffer tree. */ - - ibuf_delete_for_discarded_space(table->space_id); + their operations. */ table_id_t new_id; @@ -2442,9 +2436,8 @@ dberr_t row_discard_tablespace_for_mysql(dict_table_t *table, trx_t *trx) /* Note: The following cannot be rolled back. Rollback would see the UPDATE of SYS_INDEXES.TABLE_ID as two operations: DELETE and INSERT. It would invoke btr_free_if_exists() when rolling back the INSERT, - effectively dropping all indexes of the table. Furthermore, calls like - ibuf_delete_for_discarded_space() are already discarding data - before the transaction is committed. + effectively dropping all indexes of the table. Furthermore, we are + already discarding data before the transaction is committed. It would be better to remove the integrity-breaking ALTER TABLE...DISCARD TABLESPACE operation altogether. */ diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index df042f6652151..81b02fea8a3cc 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -273,10 +273,10 @@ not delete marked version of a clustered index record where DB_TRX_ID is newer than the purge view. NOTE: This function should only be called by the purge thread, only -while holding a latch on the leaf page of the secondary index entry -(or keeping the buffer pool watch on the page). It is possible that -this function first returns true and then false, if a user transaction -inserts a record that the secondary index entry would refer to. +while holding a latch on the leaf page of the secondary index entry. +It is possible that this function first returns true and then false, +if a user transaction inserts a record that the secondary index entry +would refer to. However, in that case, the user transaction would also re-insert the secondary index entry after purge has removed it and released the leaf page latch. @@ -292,6 +292,7 @@ page latch. @param[in] is_tree true=pessimistic purge, false=optimistic (leaf-page only) @return true if the secondary index record can be purged */ +static bool row_purge_poss_sec( purge_node_t* node, @@ -342,18 +343,14 @@ row_purge_remove_sec_if_poss_tree( ibool success = TRUE; dberr_t err; mtr_t mtr; - enum row_search_result search_result; log_free_check(); mtr.start(); index->set_modified(mtr); pcur.btr_cur.page_cur.index = index; - search_result = row_search_index_entry(entry, BTR_PURGE_TREE, - &pcur, &mtr); - - switch (search_result) { - case ROW_NOT_FOUND: + if (!row_search_index_entry(entry, BTR_PURGE_TREE, &pcur, + nullptr, &mtr)) { /* Not found. This is a legitimate condition. In a rollback, InnoDB will remove secondary recs that would be purged anyway. Then the actual purge will not find @@ -363,18 +360,7 @@ row_purge_remove_sec_if_poss_tree( index, it will remove it. Then if/when the purge comes to consider the secondary index record a second time, it will not exist any more in the index. */ - - /* fputs("PURGE:........sec entry not found\n", stderr); */ - /* dtuple_print(stderr, entry); */ goto func_exit; - case ROW_FOUND: - break; - case ROW_BUFFERED: - case ROW_NOT_DELETED_REF: - /* These are invalid outcomes, because the mode passed - to row_search_index_entry() did not include any of the - flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */ - ut_error; } /* We should remove the index record if no later version of the row, @@ -439,8 +425,6 @@ row_purge_remove_sec_if_poss_leaf( { mtr_t mtr; btr_pcur_t pcur; - enum btr_latch_mode mode; - enum row_search_result search_result; bool success = true; log_free_check(); @@ -449,31 +433,21 @@ row_purge_remove_sec_if_poss_leaf( mtr.start(); index->set_modified(mtr); - /* Change buffering is disabled for spatial index and - virtual index. */ - mode = (index->type & (DICT_SPATIAL | DICT_VIRTUAL)) - ? BTR_MODIFY_LEAF : BTR_PURGE_LEAF; + const auto mode = BTR_MODIFY_LEAF; pcur.btr_cur.page_cur.index = index; - /* Set the purge node for the call to row_purge_poss_sec(). */ - pcur.btr_cur.purge_node = node; + bool found; if (index->is_spatial()) { - pcur.btr_cur.thr = NULL; index->lock.u_lock(SRW_LOCK_CALL); - search_result = row_search_index_entry( - entry, mode, &pcur, &mtr); + found = !rtr_pcur_open(entry, mode, &pcur, nullptr, &mtr); index->lock.u_unlock(); } else { - /* Set the query thread, so that ibuf_insert_low() will be - able to invoke thd_get_trx(). */ - pcur.btr_cur.thr = static_cast( - que_node_get_parent(node)); - search_result = row_search_index_entry( - entry, mode, &pcur, &mtr); + found = btr_pcur_open(entry, PAGE_CUR_LE, mode, &pcur, 0, &mtr) + == DB_SUCCESS; } - switch (search_result) { - case ROW_FOUND: + if (found && !btr_pcur_is_before_first_on_page(&pcur) + && btr_pcur_get_low_match(&pcur) == dtuple_get_n_fields(entry)) { /* Before attempting to purge a record, check if it is safe to do so. */ if (row_purge_poss_sec(node, index, entry, &pcur, &mtr, false)) { @@ -501,25 +475,18 @@ row_purge_remove_sec_if_poss_leaf( if (index->is_spatial()) { const buf_block_t* block = btr_cur_get_block( btr_cur); + const page_id_t id{block->page.id()}; - if (block->page.id().page_no() - != index->page + if (id.page_no() != index->page && page_get_n_recs(block->page.frame) < 2 - && !lock_test_prdt_page_lock( - btr_cur->rtr_info - && btr_cur->rtr_info->thr - ? thr_get_trx( - btr_cur->rtr_info->thr) - : nullptr, - block->page.id())) { + && !lock_test_prdt_page_lock(nullptr, id)){ /* this is the last record on page, and it has a "page" lock on it, which mean search is still depending on it, so do not delete */ DBUG_LOG("purge", "skip purging last" - " record on page " - << block->page.id()); + " record on page " << id); goto func_exit; } } @@ -527,25 +494,13 @@ row_purge_remove_sec_if_poss_leaf( success = btr_cur_optimistic_delete(btr_cur, 0, &mtr) != DB_FAIL; } + } - /* (The index entry is still needed, - or the deletion succeeded) */ - /* fall through */ - case ROW_NOT_DELETED_REF: - /* The index entry is still needed. */ - case ROW_BUFFERED: - /* The deletion was buffered. */ - case ROW_NOT_FOUND: - /* The index entry does not exist, nothing to do. */ func_exit: - mtr.commit(); + mtr.commit(); cleanup: - btr_pcur_close(&pcur); // FIXME: do we need these? when is btr_cur->rtr_info set? - return(success); - } - - ut_error; - return(false); + btr_pcur_close(&pcur); + return success; } /***********************************************************//** @@ -598,10 +553,7 @@ Purges a delete marking of a record. @retval false the purge needs to be suspended because of running out of file space */ static MY_ATTRIBUTE((nonnull, warn_unused_result)) -bool -row_purge_del_mark( -/*===============*/ - purge_node_t* node) /*!< in/out: row purge node */ +bool row_purge_del_mark(purge_node_t *node) { if (node->index) { diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc index a4d634f2d140c..059aee6f14029 100644 --- a/storage/innobase/row/row0quiesce.cc +++ b/storage/innobase/row/row0quiesce.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -26,7 +26,6 @@ Created 2012-02-08 by Sunny Bains. #include "row0quiesce.h" #include "row0mysql.h" -#include "ibuf0ibuf.h" #include "srv0start.h" #include "trx0purge.h" @@ -533,18 +532,6 @@ row_quiesce_table_start( purge_sys.stop(); } - for (ulint count = 0; - ibuf_merge_space(table->space_id); - ++count) { - if (trx_is_interrupted(trx)) { - goto aborted; - } - if (!(count % 20)) { - ib::info() << "Merging change buffer entries for " - << table->name; - } - } - while (buf_flush_list_space(table->space)) { if (trx_is_interrupted(trx)) { goto aborted; diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc index b998d27d83646..616423e8a2147 100644 --- a/storage/innobase/row/row0row.cc +++ b/storage/innobase/row/row0row.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2022, MariaDB Corporation. +Copyright (c) 2018, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -215,28 +215,20 @@ row_build_index_entry_low( entry = dtuple_create(heap, entry_len); } - if (dict_index_is_ibuf(index)) { - dtuple_set_n_fields_cmp(entry, entry_len); - /* There may only be externally stored columns - in a clustered index B-tree of a user table. */ - ut_a(!ext); - } else { - dtuple_set_n_fields_cmp( - entry, dict_index_get_n_unique_in_tree(index)); - if (dict_index_is_spatial(index)) { - /* Set the MBR field */ - if (!row_build_spatial_index_key( - index, ext, - dtuple_get_nth_field(entry, 0), - dtuple_get_nth_field( - row, - dict_index_get_nth_field(index, i) - ->col->ind), flag, heap)) { - return NULL; - } - - i = 1; + dtuple_set_n_fields_cmp(entry, dict_index_get_n_unique_in_tree(index)); + if (index->is_spatial()) { + /* Set the MBR field */ + if (!row_build_spatial_index_key( + index, ext, + dtuple_get_nth_field(entry, 0), + dtuple_get_nth_field( + row, + dict_index_get_nth_field(index, i) + ->col->ind), flag, heap)) { + return NULL; } + + i = 1; } for (; i < entry_len; i++) { @@ -1262,65 +1254,32 @@ row_get_clust_rec( /***************************************************************//** Searches an index record. -@return whether the record was found or buffered */ -enum row_search_result +@return whether the record was found */ +bool row_search_index_entry( /*===================*/ const dtuple_t* entry, /*!< in: index entry */ btr_latch_mode mode, /*!< in: BTR_MODIFY_LEAF, ... */ btr_pcur_t* pcur, /*!< in/out: persistent cursor, which must be closed by the caller */ + que_thr_t* thr, /*!< in/out: query thread */ mtr_t* mtr) /*!< in: mtr */ { - ulint n_fields; - ulint low_match; - rec_t* rec; - ut_ad(dtuple_check_typed(entry)); if (pcur->index()->is_spatial()) { - if (rtr_pcur_open(pcur->index(), entry, mode, pcur, mtr)) { - return ROW_NOT_FOUND; + if (rtr_pcur_open(entry, mode, pcur, thr, mtr)) { + return false; } } else { if (btr_pcur_open(entry, PAGE_CUR_LE, mode, pcur, 0, mtr) != DB_SUCCESS) { - return ROW_NOT_FOUND; + return false; } } - switch (btr_pcur_get_btr_cur(pcur)->flag) { - case BTR_CUR_DELETE_REF: - ut_ad(!(~mode & BTR_DELETE)); - ut_ad(!pcur->index()->is_spatial()); - return(ROW_NOT_DELETED_REF); - - case BTR_CUR_DEL_MARK_IBUF: - case BTR_CUR_DELETE_IBUF: - case BTR_CUR_INSERT_TO_IBUF: - return(ROW_BUFFERED); - - case BTR_CUR_HASH: - case BTR_CUR_HASH_FAIL: - case BTR_CUR_BINARY: - break; - } - - low_match = btr_pcur_get_low_match(pcur); - - rec = btr_pcur_get_rec(pcur); - - n_fields = dtuple_get_n_fields(entry); - - if (page_rec_is_infimum(rec)) { - - return(ROW_NOT_FOUND); - } else if (low_match != n_fields) { - - return(ROW_NOT_FOUND); - } - - return(ROW_FOUND); + return !btr_pcur_is_before_first_on_page(pcur) + && btr_pcur_get_low_match(pcur) == dtuple_get_n_fields(entry); } /*******************************************************************//** diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 9d7259ba20c95..5f5c6fe6c44dd 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -2,7 +2,7 @@ Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -4768,14 +4768,13 @@ row_search_mvcc( } } else if (dtuple_get_n_fields(search_tuple) > 0) { - pcur->btr_cur.thr = thr; pcur->old_rec = nullptr; if (dict_index_is_spatial(index)) { if (!prebuilt->rtr_info) { prebuilt->rtr_info = rtr_create_rtr_info( - set_also_gap_locks, true, - btr_pcur_get_btr_cur(pcur), index); + set_also_gap_locks, true, thr, + btr_pcur_get_btr_cur(pcur)); prebuilt->rtr_info->search_tuple = search_tuple; prebuilt->rtr_info->search_mode = mode; rtr_info_update_btr(btr_pcur_get_btr_cur(pcur), diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc index 6567019a33d12..3e20503d39c37 100644 --- a/storage/innobase/row/row0uins.cc +++ b/storage/innobase/row/row0uins.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -40,7 +40,6 @@ Created 2/25/1997 Heikki Tuuri #include "row0row.h" #include "row0upd.h" #include "que0que.h" -#include "ibuf0ibuf.h" #include "log0log.h" #include "fil0fil.h" #include @@ -266,7 +265,7 @@ row_undo_ins_remove_sec_low( const bool modify_leaf = mode == BTR_MODIFY_LEAF; pcur.btr_cur.page_cur.index = index; - row_mtr_start(&mtr, index, !modify_leaf); + row_mtr_start(&mtr, index); if (modify_leaf) { mode = BTR_MODIFY_LEAF_ALREADY_LATCHED; @@ -282,19 +281,9 @@ row_undo_ins_remove_sec_low( | BTR_RTREE_DELETE_MARK | BTR_RTREE_UNDO_INS) : btr_latch_mode(BTR_PURGE_TREE | BTR_RTREE_UNDO_INS); - btr_pcur_get_btr_cur(&pcur)->thr = thr; } - switch (row_search_index_entry(entry, mode, &pcur, &mtr)) { - case ROW_BUFFERED: - case ROW_NOT_DELETED_REF: - /* These are invalid outcomes, because the mode passed - to row_search_index_entry() did not include any of the - flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */ - ut_error; - case ROW_NOT_FOUND: - break; - case ROW_FOUND: + if (row_search_index_entry(entry, mode, &pcur, thr, &mtr)) { if (dict_index_is_spatial(index) && rec_get_deleted_flag( btr_pcur_get_rec(&pcur), diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index 2d04dca400352..2eadb05eccc62 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -33,7 +33,6 @@ Created 2/27/1997 Heikki Tuuri #include "trx0purge.h" #include "btr0btr.h" #include "mach0data.h" -#include "ibuf0ibuf.h" #include "row0undo.h" #include "row0vers.h" #include "trx0trx.h" @@ -490,10 +489,9 @@ row_undo_mod_del_mark_or_remove_sec_low( dberr_t err = DB_SUCCESS; mtr_t mtr; mtr_t mtr_vers; - row_search_result search_result; const bool modify_leaf = mode == BTR_MODIFY_LEAF; - row_mtr_start(&mtr, index, !modify_leaf); + row_mtr_start(&mtr, index); pcur.btr_cur.page_cur.index = index; btr_cur = btr_pcur_get_btr_cur(&pcur); @@ -504,7 +502,6 @@ row_undo_mod_del_mark_or_remove_sec_low( | BTR_RTREE_DELETE_MARK | BTR_RTREE_UNDO_INS) : btr_latch_mode(BTR_PURGE_TREE | BTR_RTREE_UNDO_INS); - btr_cur->thr = thr; } else if (!index->is_committed()) { /* The index->online_status may change if the index is or was being created online, but not committed yet. It @@ -523,10 +520,7 @@ row_undo_mod_del_mark_or_remove_sec_low( ut_ad(!dict_index_is_online_ddl(index)); } - search_result = row_search_index_entry(entry, mode, &pcur, &mtr); - - switch (UNIV_EXPECT(search_result, ROW_FOUND)) { - case ROW_NOT_FOUND: + if (!row_search_index_entry(entry, mode, &pcur, thr, &mtr)) { /* In crash recovery, the secondary index record may be missing if the UPDATE did not have time to insert the secondary index records before the crash. When we @@ -537,14 +531,6 @@ row_undo_mod_del_mark_or_remove_sec_low( before it has inserted all updated secondary index records, then the undo will not find those records. */ goto func_exit; - case ROW_FOUND: - break; - case ROW_BUFFERED: - case ROW_NOT_DELETED_REF: - /* These are invalid outcomes, because the mode passed - to row_search_index_entry() did not include any of the - flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */ - ut_error; } /* We should remove the index record if no prior version of the row, @@ -665,7 +651,6 @@ row_undo_mod_del_unmark_sec_and_undo_update( trx_t* trx = thr_get_trx(thr); const ulint flags = BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG; - row_search_result search_result; const auto orig_mode = mode; pcur.btr_cur.page_cur.index = index; @@ -682,23 +667,12 @@ row_undo_mod_del_unmark_sec_and_undo_update( } try_again: - row_mtr_start(&mtr, index, mode & 8); - - btr_cur->thr = thr; + row_mtr_start(&mtr, index); - search_result = row_search_index_entry(entry, mode, &pcur, &mtr); + mem_heap_t* offsets_heap = nullptr; + rec_offs* offsets = nullptr; - switch (search_result) { - mem_heap_t* heap; - mem_heap_t* offsets_heap; - rec_offs* offsets; - case ROW_BUFFERED: - case ROW_NOT_DELETED_REF: - /* These are invalid outcomes, because the mode passed - to row_search_index_entry() did not include any of the - flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */ - ut_error; - case ROW_NOT_FOUND: + if (!row_search_index_entry(entry, mode, &pcur, thr, &mtr)) { /* For spatial index, if first search didn't find an undel-marked rec, try to find a del-marked rec. */ if (dict_index_is_spatial(index) && btr_cur->rtr_info->fd_del) { @@ -720,7 +694,7 @@ row_undo_mod_del_unmark_sec_and_undo_update( << " at: " << rec_index_print( btr_cur_get_rec(btr_cur), index); err = DB_DUPLICATE_KEY; - break; + goto func_exit; } ib::warn() << "Record in index " << index->name @@ -734,8 +708,6 @@ row_undo_mod_del_unmark_sec_and_undo_update( delete-unmark. */ big_rec_t* big_rec; rec_t* insert_rec; - offsets = NULL; - offsets_heap = NULL; err = btr_cur_optimistic_insert( flags, btr_cur, &offsets, &offsets_heap, @@ -764,15 +736,13 @@ row_undo_mod_del_unmark_sec_and_undo_update( if (offsets_heap) { mem_heap_free(offsets_heap); } - - break; - case ROW_FOUND: + } else { + mem_heap_t* heap; btr_rec_set_deleted(btr_cur_get_block(btr_cur), btr_cur_get_rec(btr_cur), &mtr); heap = mem_heap_create( sizeof(upd_t) + dtuple_get_n_fields(entry) * sizeof(upd_field_t)); - offsets_heap = NULL; offsets = rec_get_offsets( btr_cur_get_rec(btr_cur), index, nullptr, index->n_core_fields, ULINT_UNDEFINED, @@ -811,6 +781,7 @@ row_undo_mod_del_unmark_sec_and_undo_update( mem_heap_free(offsets_heap); } +func_exit: btr_pcur_close(&pcur); mtr_commit(&mtr); diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index a3f940adff5ef..3cdc8d1cfb9cc 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1842,7 +1842,6 @@ row_upd_sec_index_entry( trx_t* trx = thr_get_trx(thr); btr_latch_mode mode; ulint flags; - enum row_search_result search_result; ut_ad(trx->id != 0); @@ -1884,41 +1883,29 @@ row_upd_sec_index_entry( default: index->set_modified(mtr); /* fall through */ - case IBUF_SPACE_ID: + case 0: flags = index->table->no_rollback() ? BTR_NO_ROLLBACK : 0; /* We can only buffer delete-mark operations if there are no foreign key constraints referring to the index. */ mode = index->is_spatial() ? btr_latch_mode(BTR_MODIFY_LEAF | BTR_RTREE_DELETE_MARK) - : referenced - ? BTR_MODIFY_LEAF : BTR_DELETE_MARK_LEAF; + : BTR_MODIFY_LEAF; break; } - /* Set the query thread, so that ibuf_insert_low() will be - able to invoke thd_get_trx(). */ - btr_pcur_get_btr_cur(&pcur)->thr = thr; pcur.btr_cur.page_cur.index = index; - search_result = row_search_index_entry(entry, mode, &pcur, &mtr); + bool found = row_search_index_entry(entry, mode, &pcur, thr, &mtr); btr_cur = btr_pcur_get_btr_cur(&pcur); rec = btr_cur_get_rec(btr_cur); - switch (search_result) { - case ROW_NOT_DELETED_REF: /* should only occur for BTR_DELETE */ - ut_error; - break; - case ROW_BUFFERED: - /* Entry was delete marked already. */ - break; - - case ROW_NOT_FOUND: + if (!found) { if (dict_index_is_spatial(index) && btr_cur->rtr_info->fd_del) { /* We found the record, but a delete marked */ - break; + goto done; } ib::error() @@ -1932,8 +1919,7 @@ row_upd_sec_index_entry( ut_ad(btr_validate_index(index, 0) == DB_SUCCESS); ut_ad(0); #endif /* UNIV_DEBUG */ - break; - case ROW_FOUND: + } else { ut_ad(err == DB_SUCCESS); /* Delete mark the old index record; it can already be @@ -1946,7 +1932,7 @@ row_upd_sec_index_entry( btr_cur_get_block(btr_cur), btr_cur_get_rec(btr_cur), index, thr, &mtr); if (err != DB_SUCCESS) { - break; + goto done; } btr_rec_set_deleted(btr_cur_get_block(btr_cur), @@ -2009,6 +1995,7 @@ row_upd_sec_index_entry( } } +done: btr_pcur_close(&pcur); mtr_commit(&mtr); diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index f362708093a85..f277ec4ec95b2 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -2,7 +2,7 @@ Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -27,7 +27,6 @@ Created 12/9/2009 Jimmy Yang #include "buf0buf.h" #include "dict0mem.h" -#include "ibuf0ibuf.h" #include "lock0lock.h" #include "mach0data.h" #include "os0file.h" @@ -527,23 +526,10 @@ static monitor_info_t innodb_counter_info[] = MONITOR_BUF_PAGE_READ("index_non_leaf","Index Non-leaf", INDEX_NON_LEAF), - MONITOR_BUF_PAGE_READ("index_ibuf_leaf", "Insert Buffer Index Leaf", - INDEX_IBUF_LEAF), - - MONITOR_BUF_PAGE_READ("index_ibuf_non_leaf", - "Insert Buffer Index Non-Leaf", - INDEX_IBUF_NON_LEAF), - MONITOR_BUF_PAGE_READ("undo_log", "Undo Log", UNDO_LOG), MONITOR_BUF_PAGE_READ("index_inode", "Index Inode", INODE), - MONITOR_BUF_PAGE_READ("ibuf_free_list", "Insert Buffer Free List", - IBUF_FREELIST), - - MONITOR_BUF_PAGE_READ("ibuf_bitmap", "Insert Buffer Bitmap", - IBUF_BITMAP), - MONITOR_BUF_PAGE_READ("system_page", "System", SYSTEM), MONITOR_BUF_PAGE_READ("trx_system", "Transaction System", TRX_SYSTEM), @@ -566,23 +552,10 @@ static monitor_info_t innodb_counter_info[] = MONITOR_BUF_PAGE_WRITTEN("index_non_leaf","Index Non-leaf", INDEX_NON_LEAF), - MONITOR_BUF_PAGE_WRITTEN("index_ibuf_leaf", "Insert Buffer Index Leaf", - INDEX_IBUF_LEAF), - - MONITOR_BUF_PAGE_WRITTEN("index_ibuf_non_leaf", - "Insert Buffer Index Non-Leaf", - INDEX_IBUF_NON_LEAF), - MONITOR_BUF_PAGE_WRITTEN("undo_log", "Undo Log", UNDO_LOG), MONITOR_BUF_PAGE_WRITTEN("index_inode", "Index Inode", INODE), - MONITOR_BUF_PAGE_WRITTEN("ibuf_free_list", "Insert Buffer Free List", - IBUF_FREELIST), - - MONITOR_BUF_PAGE_WRITTEN("ibuf_bitmap", "Insert Buffer Bitmap", - IBUF_BITMAP), - MONITOR_BUF_PAGE_WRITTEN("system_page", "System", SYSTEM), MONITOR_BUF_PAGE_WRITTEN("trx_system", "Transaction System", @@ -948,57 +921,6 @@ static monitor_info_t innodb_counter_info[] = MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), MONITOR_DEFAULT_START, MONITOR_OVLD_N_FILE_OPENED}, - /* ========== Counters for Change Buffer ========== */ - {"module_ibuf_system", "change_buffer", "InnoDB Change Buffer", - MONITOR_MODULE, - MONITOR_DEFAULT_START, MONITOR_MODULE_IBUF_SYSTEM}, - - {"ibuf_merges_insert", "change_buffer", - "Number of inserted records merged by change buffering", - static_cast( - MONITOR_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_INSERT}, - - {"ibuf_merges_delete_mark", "change_buffer", - "Number of deleted records merged by change buffering", - static_cast( - MONITOR_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DELETE}, - - {"ibuf_merges_delete", "change_buffer", - "Number of purge records merged by change buffering", - static_cast( - MONITOR_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_PURGE}, - - {"ibuf_merges_discard_insert", "change_buffer", - "Number of insert merged operations discarded", - static_cast( - MONITOR_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT}, - - {"ibuf_merges_discard_delete_mark", "change_buffer", - "Number of deleted merged operations discarded", - static_cast( - MONITOR_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE}, - - {"ibuf_merges_discard_delete", "change_buffer", - "Number of purge merged operations discarded", - static_cast( - MONITOR_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE}, - - {"ibuf_merges", "change_buffer", "Number of change buffer merges", - static_cast( - MONITOR_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGES}, - - {"ibuf_size", "change_buffer", "Change buffer size in pages", - static_cast( - MONITOR_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_SIZE}, - /* ========== Counters for server operations ========== */ {"module_innodb", "innodb", "Counter for general InnoDB server wide operations and properties", @@ -1529,38 +1451,6 @@ srv_mon_process_existing_counter( value = fil_system.n_open; break; - case MONITOR_OVLD_IBUF_MERGE_INSERT: - value = ibuf.n_merged_ops[IBUF_OP_INSERT]; - break; - - case MONITOR_OVLD_IBUF_MERGE_DELETE: - value = ibuf.n_merged_ops[IBUF_OP_DELETE_MARK]; - break; - - case MONITOR_OVLD_IBUF_MERGE_PURGE: - value = ibuf.n_merged_ops[IBUF_OP_DELETE]; - break; - - case MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT: - value = ibuf.n_discarded_ops[IBUF_OP_INSERT]; - break; - - case MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE: - value = ibuf.n_discarded_ops[IBUF_OP_DELETE_MARK]; - break; - - case MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE: - value = ibuf.n_discarded_ops[IBUF_OP_DELETE]; - break; - - case MONITOR_OVLD_IBUF_MERGES: - value = ibuf.n_merges; - break; - - case MONITOR_OVLD_IBUF_SIZE: - value = ibuf.size; - break; - case MONITOR_OVLD_SERVER_ACTIVITY: value = srv_get_activity_count(); break; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index ffb7f53c15cd6..7c4e5a0d8906c 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -3,7 +3,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -48,7 +48,6 @@ Created 10/8/1995 Heikki Tuuri #include "buf0lru.h" #include "dict0boot.h" #include "dict0load.h" -#include "ibuf0ibuf.h" #include "lock0lock.h" #include "log0recv.h" #include "mem0mem.h" @@ -126,9 +125,9 @@ my_bool srv_read_only_mode; /** store to its own file each table created by an user; data dictionary tables are in the system tablespace 0 */ my_bool srv_file_per_table; -/** Set if InnoDB operates in read-only mode or innodb-force-recovery -is greater than SRV_FORCE_NO_TRX_UNDO. */ -my_bool high_level_read_only; +/** Set if innodb_read_only is set or innodb_force_recovery +is SRV_FORCE_NO_UNDO_LOG_SCAN or greater. */ +bool high_level_read_only; /** Sort buffer size in index creation */ ulong srv_sort_buf_size; @@ -223,9 +222,6 @@ ulong srv_read_ahead_threshold; buffer in terms of percentage of the buffer pool. */ uint srv_change_buffer_max_size; -ulong srv_file_flush_method; - - /** copy of innodb_open_files; @see innodb_init_params() */ ulint srv_max_n_open_files; @@ -282,7 +278,7 @@ my_bool srv_print_all_deadlocks; INFORMATION_SCHEMA.innodb_cmp_per_index */ my_bool srv_cmp_per_index_enabled; -/** innodb_fast_shutdown=1 skips purge and change buffer merge. +/** innodb_fast_shutdown=1 skips the purge of transaction history. innodb_fast_shutdown=2 effectively crashes the server (no log checkpoint). innodb_fast_shutdown=3 is a clean shutdown that skips the rollback of active transaction (to be done on restart). */ @@ -384,8 +380,6 @@ FILE* srv_misc_tmpfile; ulint srv_main_active_loops; /** Iterations of the loop bounded by the 'srv_idle' label. */ ulint srv_main_idle_loops; -/** Iterations of the loop bounded by the 'srv_shutdown' label. */ -static ulint srv_main_shutdown_loops; /** Log writes involving flush. */ ulint srv_log_writes_and_flush; @@ -580,10 +574,9 @@ srv_print_master_thread_info( FILE *file) /* in: output stream */ { fprintf(file, "srv_master_thread loops: " ULINTPF " srv_active, " - ULINTPF " srv_shutdown, " ULINTPF " srv_idle\n" + ULINTPF " srv_idle\n" "srv_master_thread log flush and writes: " ULINTPF "\n", srv_main_active_loops, - srv_main_shutdown_loops, srv_main_idle_loops, srv_log_writes_and_flush); } @@ -801,8 +794,6 @@ srv_printf_innodb_monitor( "--------\n", file); os_aio_print(file); - ibuf_print(file); - #ifdef BTR_CUR_HASH_ADAPT if (btr_search_enabled) { fputs("-------------------\n" @@ -1343,31 +1334,6 @@ static void srv_sync_log_buffer_in_background() } } -/** Report progress during shutdown. -@param last time of last output -@param n_read number of page reads initiated for change buffer merge */ -static void srv_shutdown_print(time_t &last, ulint n_read) -{ - time_t now= time(nullptr); - if (now - last >= 15) - { - last= now; - - const ulint ibuf_size= ibuf.size; - sql_print_information("Completing change buffer merge;" - " %zu page reads initiated;" - " %zu change buffer pages remain", - n_read, ibuf_size); -#if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY - service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, - "Completing change buffer merge;" - " %zu page reads initiated;" - " %zu change buffer pages remain", - n_read, ibuf_size); -#endif - } -} - /** Perform periodic tasks whenever the server is active. @param counter_time microsecond_interval_timer() */ static void srv_master_do_active_tasks(ulonglong counter_time) @@ -1405,32 +1371,6 @@ static void srv_master_do_idle_tasks(ulonglong counter_time) MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time); } -/** -Complete the shutdown tasks such as background DROP TABLE, -and optionally change buffer merge (on innodb_fast_shutdown=0). */ -void srv_shutdown(bool ibuf_merge) -{ - ulint n_read = 0; - time_t now = time(NULL); - - do { - ut_ad(!srv_read_only_mode); - ut_ad(srv_shutdown_state == SRV_SHUTDOWN_CLEANUP); - ++srv_main_shutdown_loops; - - if (ibuf_merge) { - srv_main_thread_op_info = "doing insert buffer merge"; - /* Disallow the use of change buffer to - avoid a race condition with - ibuf_read_merge_pages() */ - ibuf_max_size_update(0); - log_free_check(); - n_read = ibuf_contract(); - srv_shutdown_print(now, n_read); - } - } while (n_read); -} - /** The periodic master task controlling the server. */ void srv_master_callback(void*) { diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index cb60da24728de..75116a0201a72 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -3,7 +3,7 @@ Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2022, MariaDB Corporation. +Copyright (c) 2013, 2023, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -69,7 +69,6 @@ Created 2/16/1996 Heikki Tuuri #include "btr0btr.h" #include "btr0cur.h" #include "rem0rec.h" -#include "ibuf0ibuf.h" #include "srv0start.h" #include "srv0srv.h" #include "btr0defragment.h" @@ -95,6 +94,7 @@ Created 2/16/1996 Heikki Tuuri #include "row0row.h" #include "row0mysql.h" #include "btr0pcur.h" +#include "ibuf0ibuf.h" #include "zlib.h" #include "log.h" @@ -323,33 +323,261 @@ static dberr_t srv_undo_tablespace_create(const char* name) return(err); } -/* Validate the number of undo opened undo tablespace and user given -undo tablespace +inline dberr_t trx_sys_t::reset_page(mtr_t *mtr) +{ + dberr_t err= DB_SUCCESS; + buf_block_t *sys_header= buf_page_get_gen( + page_id_t(TRX_SYS_SPACE, TRX_SYS_PAGE_NO), 0, RW_X_LATCH, nullptr, + BUF_GET, mtr, &err); + + if (!sys_header) return err; + + const bool dblwr_enabled= + mach_read_from_4(TRX_SYS_DOUBLEWRITE_MAGIC + TRX_SYS_DOUBLEWRITE + + sys_header->page.frame) + == TRX_SYS_DOUBLEWRITE_MAGIC_N; + + char doublewrite[TRX_SYS_DOUBLEWRITE_BLOCK2 + 4]; + memcpy(doublewrite, TRX_SYS_DOUBLEWRITE + sys_header->page.frame, + sizeof doublewrite); + + fsp_init_file_page(fil_system.sys_space, sys_header, mtr); + + mtr->write<2>(*sys_header, FIL_PAGE_TYPE + sys_header->page.frame, + FIL_PAGE_TYPE_TRX_SYS); + + mtr->write<4>(*sys_header, + TRX_SYS + TRX_SYS_RSEGS + TRX_SYS_RSEG_PAGE_NO + + sys_header->page.frame, FSP_FIRST_RSEG_PAGE_NO); + mtr->memset(sys_header, + TRX_SYS + TRX_SYS_RSEGS + TRX_SYS_RSEG_SLOT_SIZE, + 254 * TRX_SYS_RSEG_SLOT_SIZE, 0xff); + + static_assert(TRX_SYS_RSEG_SLOT_SIZE == 8, ""); + + if (dblwr_enabled) + { + mtr->memcpy( + *sys_header, sys_header->page.frame + TRX_SYS_DOUBLEWRITE, + doublewrite, sizeof doublewrite); + mtr->memmove( + *sys_header, + TRX_SYS_DOUBLEWRITE + FSEG_HEADER_SIZE + TRX_SYS_DOUBLEWRITE_REPEAT, + TRX_SYS_DOUBLEWRITE + FSEG_HEADER_SIZE, 12); + memcpy( + sys_header->page.frame + TRX_SYS_DOUBLEWRITE + + FSEG_HEADER_SIZE + TRX_SYS_DOUBLEWRITE_REPEAT, + sys_header->page.frame + TRX_SYS_DOUBLEWRITE + FSEG_HEADER_SIZE, 12); + } + + return DB_SUCCESS; +} + +/** Delete the old undo tablespaces present in the undo log directory */ +static dberr_t srv_undo_delete_old_tablespaces() +{ + /* Delete the old undo tablespaces*/ + for (uint32_t i= 0; i < srv_undo_tablespaces_open; ++i) + fil_close_tablespace(srv_undo_space_id_start + i); + + DBUG_EXECUTE_IF("after_deleting_old_undo_abort", return DB_ERROR;); + + /* Do checkpoint to get rid of old undo log tablespaces redo logs */ + log_make_checkpoint(); + + DBUG_EXECUTE_IF("after_deleting_old_undo_success", return DB_ERROR;); + + for (uint32_t i= 0; i < srv_undo_tablespaces_open; ++i) + { + char name[OS_FILE_MAX_PATH]; + snprintf(name, sizeof name, "%s/undo%03" PRIu32, srv_undo_dir, i + 1); + os_file_delete_if_exists(innodb_data_file_key, name, nullptr); + } + + return DB_SUCCESS; +} + +/** Recreate the undo log tablespaces */ +static dberr_t srv_undo_tablespaces_reinit() +{ + mtr_t mtr; + dberr_t err; + buf_block_t *first_rseg_hdr; + uint32_t latest_space_id; + + mtr.start(); + + buf_block_t *dict_hdr= buf_page_get_gen( + page_id_t(DICT_HDR_SPACE, DICT_HDR_PAGE_NO), 0, RW_X_LATCH, + nullptr, BUF_GET, &mtr, &err); + + if (!dict_hdr) + goto func_exit; + + /* Assign the new space id for the first undo tablespace */ + latest_space_id= mach_read_from_4( + DICT_HDR + DICT_HDR_MAX_SPACE_ID + dict_hdr->page.frame); + + if (latest_space_id + srv_undo_tablespaces > SRV_SPACE_ID_UPPER_BOUND) + { + err= DB_ERROR; + sql_print_error("InnoDB: Running out of tablespace id"); + goto func_exit; + } + + first_rseg_hdr= + buf_page_get_gen(trx_sys.rseg_array[0].page_id(), 0, RW_X_LATCH, + nullptr, BUF_GET, &mtr, &err); + if (!first_rseg_hdr) + goto func_exit; + + /* Reset TRX_SYS page */ + err= trx_sys.reset_page(&mtr); + + if (err) + goto func_exit; + + if (srv_undo_tablespaces_open == 0) + { + /* Free the system rollback segment */ + for (ulint i= 1; i < TRX_SYS_N_RSEGS; i++) + { + trx_rseg_t *rseg= &trx_sys.rseg_array[i]; + if (rseg->space != fil_system.sys_space) + continue; + buf_block_t *block= buf_page_get_gen( + rseg->page_id(), 0, RW_X_LATCH, nullptr, BUF_GET, &mtr); + if (!block) break; + while (!fseg_free_step(TRX_RSEG + TRX_RSEG_FSEG_HEADER + + block->page.frame, &mtr)); + } + } + + for (ulint rseg_id= 1; rseg_id < TRX_SYS_N_RSEGS; rseg_id++) + { + trx_rseg_t *rseg= &trx_sys.rseg_array[rseg_id]; + rseg->destroy(); + rseg->init(nullptr, FIL_NULL); + } + + if (trx_sys.recovered_binlog_lsn +#ifdef WITH_WSREP + || !trx_sys.recovered_wsrep_xid.is_null() +#endif /* WITH_WSREP */ + ) + { + /* Update binlog offset, binlog file name & wsrep xid in + system tablespace rollback segment */ + if (trx_sys.recovered_binlog_lsn) + { + ut_d(const size_t len = strlen(trx_sys.recovered_binlog_filename) + 1); + ut_ad(len > 1); + ut_ad(len <= TRX_RSEG_BINLOG_NAME_LEN); + trx_rseg_update_binlog_offset( + first_rseg_hdr, trx_sys.recovered_binlog_filename, + trx_sys.recovered_binlog_offset, &mtr); + } + +#ifdef WITH_WSREP + if (!trx_sys.recovered_wsrep_xid.is_null()) + trx_rseg_update_wsrep_checkpoint( + first_rseg_hdr, &trx_sys.recovered_wsrep_xid, &mtr); +#endif /* WITH_WSREP */ + } + + dict_hdr->page.fix(); + + mtr.commit(); + + DBUG_EXECUTE_IF("after_rseg_reset_abort", + log_write_up_to(mtr.commit_lsn(), true); + dict_hdr->page.unfix(); + return DB_ERROR;); + + sql_print_information( + "InnoDB: Reinitializing innodb_undo_tablespaces= %u from %u", + srv_undo_tablespaces, srv_undo_tablespaces_open); + + /* Delete the old undo tablespaces */ + err= srv_undo_delete_old_tablespaces(); + if (err) + { + dict_hdr->page.unfix(); + return err; + } + + mtr.start(); + + dict_hdr->page.lock.x_lock(); + mtr.memo_push(dict_hdr, MTR_MEMO_PAGE_X_FIX); + + if (srv_undo_tablespaces == 0) + { + srv_undo_space_id_start= 0; + srv_undo_tablespaces_open= 0; + goto func_exit; + } + + srv_undo_space_id_start= latest_space_id; + if (fil_assign_new_space_id(&srv_undo_space_id_start)) + mtr.write<4>(*dict_hdr, DICT_HDR + DICT_HDR_MAX_SPACE_ID + + dict_hdr->page.frame, srv_undo_space_id_start); + + /* Re-create the new undo tablespaces */ + err= srv_undo_tablespaces_init(true, &mtr); +func_exit: + mtr.commit(); + + DBUG_EXECUTE_IF("after_reinit_undo_abort", + log_write_up_to(mtr.commit_lsn(), true); + err= DB_ERROR;); + + if (err == DB_SUCCESS) + { + /* Usually, recovery must work no matter when + log_checkpoints are triggered. This is a special case, + because this code is executed as part of InnoDB startup. + Backup requires that the server has been started up, + backup should never observe the log records that + were written in mtr and also srv_undo_tablespaces_init() + initializes the undo tablespace start id based on page0 + content before reading the redo log */ + log_make_checkpoint(); + + DBUG_EXECUTE_IF("after_reinit_undo_success", err= DB_ERROR;); + srv_undo_tablespaces_active= srv_undo_tablespaces; + } + return err; +} + +/** Reinitialize the undo tablespaces when there is no undo log +left to purge/rollback and validate the number of undo opened +undo tablespace and user given undo tablespace @return DB_SUCCESS if it is valid */ -static dberr_t srv_validate_undo_tablespaces() +static dberr_t srv_undo_tablespaces_reinitialize() { + + /* Re-create the undo tablespaces if it has no undo logs + left to purge/rollback */ + if (srv_undo_tablespaces != srv_undo_tablespaces_open && + trx_sys.is_undo_empty()) + return srv_undo_tablespaces_reinit(); + /* If the user says that there are fewer than what we find we tolerate that discrepancy but not the inverse. Because there could be unused undo tablespaces for future use. */ - if (srv_undo_tablespaces > srv_undo_tablespaces_open) + if (srv_undo_tablespaces != srv_undo_tablespaces_open) { - ib::error() << "Expected to open innodb_undo_tablespaces=" - << srv_undo_tablespaces - << " but was able to find only " - << srv_undo_tablespaces_open; - - return DB_ERROR; + sql_print_warning("InnoDB: Cannot change innodb_undo_tablespaces=%u " + "because previous shutdown was not with " + "innodb_fast_shutdown=0", srv_undo_tablespaces); + srv_undo_tablespaces= srv_undo_tablespaces_open; } else if (srv_undo_tablespaces_open > 0) - { - ib::info() << "Opened " << srv_undo_tablespaces_open - << " undo tablespaces"; + sql_print_information("InnoDB: Opened " UINT32PF " undo tablespaces", + srv_undo_tablespaces_open); - if (srv_undo_tablespaces == 0) - ib::warn() << "innodb_undo_tablespaces=0 disables" - " dedicated undo log tablespaces"; - } return DB_SUCCESS; } @@ -537,25 +765,25 @@ srv_check_undo_redo_logs_exists() return(DB_SUCCESS); } -static dberr_t srv_all_undo_tablespaces_open(bool create_new_db, - uint32_t n_undo) +static dberr_t srv_all_undo_tablespaces_open(bool create_new_undo, + uint32_t n_undo) { /* Open all the undo tablespaces that are currently in use. If we fail to open any of these it is a fatal error. The tablespace ids should be contiguous. It is a fatal error because they are required for recovery and are referenced by the UNDO logs (a.k.a RBS). */ - uint32_t prev_id= create_new_db ? srv_undo_space_id_start - 1 : 0; + uint32_t prev_id= create_new_undo ? srv_undo_space_id_start - 1 : 0; for (uint32_t i= 0; i < n_undo; ++i) { char name[OS_FILE_MAX_PATH]; snprintf(name, sizeof name, "%s/undo%03u", srv_undo_dir, i + 1); - uint32_t space_id= srv_undo_tablespace_open(create_new_db, name, i); + uint32_t space_id= srv_undo_tablespace_open(create_new_undo, name, i); if (!space_id) { - if (!create_new_db) - break; + if (!create_new_undo) + break; ib::error() << "Unable to open create tablespace '" << name << "'."; return DB_ERROR; } @@ -581,23 +809,27 @@ static dberr_t srv_all_undo_tablespaces_open(bool create_new_db, { char name[OS_FILE_MAX_PATH]; snprintf(name, sizeof name, "%s/undo%03u", srv_undo_dir, i); - if (!srv_undo_tablespace_open(create_new_db, name, i)) + uint32_t space_id= srv_undo_tablespace_open(create_new_undo, name, i); + if (!space_id) break; - ++srv_undo_tablespaces_open; + if (0 == srv_undo_tablespaces_open++) + srv_undo_space_id_start= space_id; } - return srv_validate_undo_tablespaces(); + return DB_SUCCESS; } /** Open the configured number of dedicated undo tablespaces. -@param[in] create_new_db whether the database is being initialized +@param[in] create_new_undo whether the undo tablespaces has to be created +@param[in,out] mtr mini-transaction @return DB_SUCCESS or error code */ -dberr_t srv_undo_tablespaces_init(bool create_new_db) +dberr_t srv_undo_tablespaces_init(bool create_new_undo, mtr_t *mtr) { srv_undo_tablespaces_open= 0; + ut_ad(!create_new_undo || mtr); ut_a(srv_undo_tablespaces <= TRX_SYS_N_RSEGS); - ut_a(!create_new_db || srv_operation == SRV_OPERATION_NORMAL); + ut_a(!create_new_undo || srv_operation == SRV_OPERATION_NORMAL); if (srv_undo_tablespaces == 1) srv_undo_tablespaces= 0; @@ -605,9 +837,8 @@ dberr_t srv_undo_tablespaces_init(bool create_new_db) /* Create the undo spaces only if we are creating a new instance. We don't allow creating of new undo tablespaces in an existing instance (yet). */ - if (create_new_db) + if (create_new_undo) { - srv_undo_space_id_start= 1; DBUG_EXECUTE_IF("innodb_undo_upgrade", srv_undo_space_id_start= 3;); for (ulint i= 0; i < srv_undo_tablespaces; ++i) @@ -628,11 +859,11 @@ dberr_t srv_undo_tablespaces_init(bool create_new_db) already exist. */ srv_undo_tablespaces_active= srv_undo_tablespaces; - uint32_t n_undo= (create_new_db || srv_operation == SRV_OPERATION_BACKUP || - srv_operation == SRV_OPERATION_RESTORE_DELTA) + uint32_t n_undo= (create_new_undo || srv_operation == SRV_OPERATION_BACKUP || + srv_operation == SRV_OPERATION_RESTORE_DELTA) ? srv_undo_tablespaces : TRX_SYS_N_RSEGS; - if (dberr_t err= srv_all_undo_tablespaces_open(create_new_db, n_undo)) + if (dberr_t err= srv_all_undo_tablespaces_open(create_new_undo, n_undo)) return err; /* Initialize srv_undo_space_id_start=0 when there are no @@ -640,17 +871,13 @@ dberr_t srv_undo_tablespaces_init(bool create_new_db) if (srv_undo_tablespaces_open == 0) srv_undo_space_id_start= 0; - if (create_new_db) + if (create_new_undo) { - mtr_t mtr; for (uint32_t i= 0; i < srv_undo_tablespaces; ++i) { - mtr.start(); dberr_t err= fsp_header_init(fil_space_get(srv_undo_space_id_start + i), - SRV_UNDO_TABLESPACE_SIZE_IN_PAGES, &mtr); - mtr.commit(); - if (err) - return err; + SRV_UNDO_TABLESPACE_SIZE_IN_PAGES, mtr); + if (err) return err; } } @@ -794,7 +1021,7 @@ srv_init_abort_low( /** Prepare to delete the redo log file. Flush the dirty pages from all the buffer pools. Flush the redo log buffer to the redo log file. @return lsn upto which data pages have been flushed. */ -static lsn_t srv_prepare_to_delete_redo_log_file() +ATTRIBUTE_COLD static lsn_t srv_prepare_to_delete_redo_log_file() { DBUG_ENTER("srv_prepare_to_delete_redo_log_file"); @@ -863,6 +1090,67 @@ static lsn_t srv_prepare_to_delete_redo_log_file() DBUG_RETURN(flushed_lsn); } +/** Upgrade the redo log to the latest format, or change its size +or encryption, before starting to write any log records. */ +ATTRIBUTE_COLD static dberr_t srv_log_rebuild() +{ + /* Prepare to delete the old redo log file */ + const lsn_t lsn{srv_prepare_to_delete_redo_log_file()}; + + DBUG_EXECUTE_IF("innodb_log_abort_1", return DB_ERROR;); + /* Prohibit redo log writes from any other threads until creating a + log checkpoint at the end of create_log_file(). */ + ut_d(recv_no_log_write= true); + DBUG_ASSERT(!buf_pool.any_io_pending()); + + /* Close the redo log file, so that we can replace it */ + log_sys.close_file(); + + DBUG_EXECUTE_IF("innodb_log_abort_5", return DB_ERROR;); + + dberr_t err= create_log_file(false, lsn); + + if (err == DB_SUCCESS && log_sys.resize_rename()) + err = DB_ERROR; + + return err; +} + +/** Rebuild the redo log if needed. */ +static dberr_t srv_log_rebuild_if_needed() +{ + if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) + /* Completely ignore the redo log. */ + return DB_SUCCESS; + if (srv_read_only_mode) + /* Leave the redo log alone. */ + return DB_SUCCESS; + + if (log_sys.file_size == srv_log_file_size && + log_sys.format == + (srv_encrypt_log ? log_t::FORMAT_ENC_10_8 : log_t::FORMAT_10_8)) + { + /* No need to add or remove encryption, upgrade, or resize. */ + delete_log_files(); + return DB_SUCCESS; + } + + return srv_log_rebuild(); +} + +ATTRIBUTE_COLD static dberr_t ibuf_log_rebuild_if_needed() +{ + mysql_mutex_lock(&recv_sys.mutex); + recv_sys.apply(true); + mysql_mutex_unlock(&recv_sys.mutex); + + if (recv_sys.is_corrupt_log() || recv_sys.is_corrupt_fs()) + return DB_CORRUPTION; + + recv_sys.debug_free(); + return srv_log_rebuild_if_needed(); +} + static tpool::task_group rollback_all_recovered_group(1); static tpool::task rollback_all_recovered_task(trx_rollback_all_recovered, nullptr, @@ -901,10 +1189,6 @@ dberr_t srv_start(bool create_new_db) ib::info() << "!!!!!!!! UNIV_DEBUG switched on !!!!!!!!!"; #endif -#ifdef UNIV_IBUF_DEBUG - ib::info() << "!!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!"; -#endif - ib::info() << "Compressed tables use zlib " ZLIB_VERSION #ifdef UNIV_ZIP_DEBUG " with validation" @@ -1000,11 +1284,6 @@ dberr_t srv_start(bool create_new_db) return(srv_init_abort(err)); } - if (srv_read_only_mode) { - ib::info() << "Disabling background log and ibuf IO write" - << " threads."; - } - if (os_aio_init()) { ib::error() << "Cannot initialize AIO sub-system"; @@ -1112,15 +1391,23 @@ dberr_t srv_start(bool create_new_db) } return srv_init_abort(err); } + + srv_undo_space_id_start= 1; } /* Open log file and data files in the systemtablespace: we keep them open until database shutdown */ ut_d(fil_system.sys_space->recv_size = srv_sys_space_size_debug); - err = fil_system.sys_space->open(create_new_db) - ? srv_undo_tablespaces_init(create_new_db) - : DB_ERROR; + if (fil_system.sys_space->open(create_new_db)) { + mtr_t mtr; + mtr.start(); + err= srv_undo_tablespaces_init(create_new_db, &mtr); + mtr.commit(); + } + else { + err= DB_ERROR; + } /* If the force recovery is set very high then we carry on regardless of all errors. Basically this is fingers crossed mode. */ @@ -1142,31 +1429,41 @@ dberr_t srv_start(bool create_new_db) if (create_new_db) { ut_ad(!srv_read_only_mode); - mtr_start(&mtr); + mtr.start(); ut_ad(fil_system.sys_space->id == 0); compile_time_assert(TRX_SYS_SPACE == 0); - compile_time_assert(IBUF_SPACE_ID == 0); - ut_a(fsp_header_init(fil_system.sys_space, - uint32_t(sum_of_new_sizes), &mtr) - == DB_SUCCESS); - - ulint ibuf_root = btr_create( - DICT_CLUSTERED | DICT_IBUF, fil_system.sys_space, - DICT_IBUF_ID_MIN, nullptr, &mtr, &err); - - mtr_commit(&mtr); - - if (ibuf_root == FIL_NULL) { - return srv_init_abort(err); + err = fsp_header_init(fil_system.sys_space, + uint32_t(sum_of_new_sizes), &mtr); + /* Allocate dummy change buffer pages for backward + compatibility and to prevent a downgrade. */ + if (err != DB_SUCCESS) { + } else if (buf_block_t *b = + fseg_create(fil_system.sys_space, PAGE_DATA, &mtr, + &err)) { + ut_ad(b->page.id() + == page_id_t(0, FSP_IBUF_HEADER_PAGE_NO)); + b = fseg_alloc_free_page_general( + b->page.frame + PAGE_DATA, + FSP_IBUF_TREE_ROOT_PAGE_NO, FSP_UP, false, + &mtr, &mtr, &err); + if (b) { + ut_ad(b->page.id() == page_id_t + (0, FSP_IBUF_TREE_ROOT_PAGE_NO)); + mtr.set_modified(*b); + fsp_init_file_page(fil_system.sys_space, b, + &mtr); + } else { + ut_ad(err != DB_SUCCESS); + } } - - ut_ad(ibuf_root == IBUF_TREE_ROOT_PAGE_NO); - /* To maintain backward compatibility we create only the first rollback segment before the double write buffer. All the remaining rollback segments will be created later, after the double write buffer has been created. */ - err = trx_sys_create_sys_pages(&mtr); + if (err == DB_SUCCESS) { + err = trx_sys_create_sys_pages(&mtr); + } + mtr.commit(); if (err != DB_SUCCESS) { return(srv_init_abort(err)); @@ -1200,41 +1497,58 @@ dberr_t srv_start(bool create_new_db) recv_sys.dblwr.pages.clear(); - if (err != DB_SUCCESS) { - return(srv_init_abort(err)); - } + bool must_upgrade_ibuf = false; switch (srv_operation) { case SRV_OPERATION_NORMAL: case SRV_OPERATION_RESTORE_EXPORT: - /* Initialize the change buffer. */ - err = dict_boot(); if (err != DB_SUCCESS) { - return(srv_init_abort(err)); + break; + } + + err = ibuf_upgrade_needed(); + + if (UNIV_UNLIKELY(err == DB_FAIL)) { + must_upgrade_ibuf = true; + err = ibuf_log_rebuild_if_needed(); + } + + if (err != DB_SUCCESS) { + break; } + + err = dict_boot(); /* fall through */ case SRV_OPERATION_RESTORE: - /* This must precede recv_sys.apply(true). */ - srv_undo_tablespaces_active - = trx_rseg_get_n_undo_tablespaces(); - err = srv_validate_undo_tablespaces(); if (err != DB_SUCCESS) { - return srv_init_abort(err); + break; } + + srv_undo_tablespaces_active + = trx_rseg_get_n_undo_tablespaces(); + if (srv_operation != SRV_OPERATION_RESTORE) { dict_sys.load_sys_tables(); } - err = trx_lists_init_at_db_start(); - if (err != DB_SUCCESS) { - return srv_init_abort(err); + + if (UNIV_UNLIKELY(must_upgrade_ibuf)) { + dict_load_tablespaces(); + err = ibuf_upgrade(); + if (err != DB_SUCCESS) { + break; + } } + + err = trx_lists_init_at_db_start(); break; - case SRV_OPERATION_RESTORE_DELTA: - case SRV_OPERATION_BACKUP: - case SRV_OPERATION_BACKUP_NO_DEFER: + default: ut_ad("wrong mariabackup mode" == 0); } + if (err != DB_SUCCESS) { + return srv_init_abort(err); + } + if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { /* Apply the hashed log records to the respective file pages, for the last batch of @@ -1260,8 +1574,8 @@ dberr_t srv_start(bool create_new_db) if (!srv_read_only_mode) { const uint32_t flags = FSP_FLAGS_PAGE_SSIZE(); - for (uint32_t id = 0; id <= srv_undo_tablespaces; - id++) { + for (uint32_t id = srv_undo_space_id_start; + id <= srv_undo_tablespaces; id++) { if (fil_space_t* space = fil_space_get(id)) { fsp_flags_try_adjust(space, flags); } @@ -1354,47 +1668,10 @@ dberr_t srv_start(bool create_new_db) /* Upgrade or resize or rebuild the redo logs before generating any dirty pages, so that the old redo log file will not be written to. */ + err = srv_log_rebuild_if_needed(); - if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) { - /* Completely ignore the redo log. */ - } else if (srv_read_only_mode) { - /* Leave the redo log alone. */ - } else if (log_sys.file_size == srv_log_file_size - && log_sys.format - == (srv_encrypt_log - ? log_t::FORMAT_ENC_10_8 - : log_t::FORMAT_10_8)) { - /* No need to add or remove encryption, - upgrade, or resize. */ - delete_log_files(); - } else { - /* Prepare to delete the old redo log file */ - const lsn_t lsn{srv_prepare_to_delete_redo_log_file()}; - - DBUG_EXECUTE_IF("innodb_log_abort_1", - return(srv_init_abort(DB_ERROR));); - /* Prohibit redo log writes from any other - threads until creating a log checkpoint at the - end of create_log_file(). */ - ut_d(recv_no_log_write = true); - DBUG_ASSERT(!buf_pool.any_io_pending()); - - /* Close the redo log file, so that we can replace it */ - log_sys.close_file(); - - DBUG_EXECUTE_IF("innodb_log_abort_5", - return(srv_init_abort(DB_ERROR));); - DBUG_PRINT("ib_log", ("After innodb_log_abort_5")); - - err = create_log_file(false, lsn); - - if (err == DB_SUCCESS && log_sys.resize_rename()) { - err = DB_ERROR; - } - - if (err != DB_SUCCESS) { - return(srv_init_abort(err)); - } + if (err != DB_SUCCESS) { + return(srv_init_abort(err)); } } @@ -1407,6 +1684,16 @@ dberr_t srv_start(bool create_new_db) return(srv_init_abort(DB_ERROR)); } + /* Recreate the undo tablespaces */ + if (!high_level_read_only) { + err = srv_undo_tablespaces_reinitialize(); + if (err) { + return srv_init_abort(err); + } + } + + srv_undo_tablespaces = srv_undo_tablespaces_open; + /* Here the double write buffer has already been created and so any new rollback segments will be allocated after the double write buffer. The default segment should already exist. @@ -1436,8 +1723,7 @@ dberr_t srv_start(bool create_new_db) /* Bitmap page types will be reset in buf_dblwr_check_block() without redo logging. */ block = buf_page_get( - page_id_t(IBUF_SPACE_ID, - FSP_IBUF_HEADER_PAGE_NO), + page_id_t(0, FSP_IBUF_HEADER_PAGE_NO), 0, RW_X_LATCH, &mtr); if (UNIV_UNLIKELY(!block)) { corrupted_old_page: @@ -1495,21 +1781,7 @@ dberr_t srv_start(bool create_new_db) } if (srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN) { - /* The following call is necessary for the insert - buffer to work with multiple tablespaces. We must - know the mapping between space id's and .ibd file - names. - - In a crash recovery, we check that the info in data - dictionary is consistent with what we already know - about space id's from the calls to fil_ibd_load(). - - In a normal startup, we create the space objects for - every table in the InnoDB data dictionary that has - an .ibd file. - - We also determine the maximum tablespace id used. */ - dict_check_tablespaces_and_store_max_id(); + dict_load_tablespaces(); } if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO @@ -1591,13 +1863,6 @@ dberr_t srv_start(bool create_new_db) trx_sys.get_max_trx_id()); } - if (srv_force_recovery == 0) { - /* In the change buffer we may have even bigger tablespace - id's, because we may have dropped those tablespaces, but - the buffered records have not been cleaned yet. */ - ibuf_update_max_tablespace_id(); - } - if (!srv_read_only_mode) { if (create_new_db) { srv_buffer_pool_load_at_startup = FALSE; @@ -1652,10 +1917,6 @@ void innodb_preshutdown() return; if (!srv_fast_shutdown && srv_operation == SRV_OPERATION_NORMAL) { - /* Because a slow shutdown must empty the change buffer, we had - better prevent any further changes from being buffered. */ - innodb_change_buffering= 0; - if (trx_sys.is_initialised()) while (trx_sys.any_active_transactions()) std::this_thread::sleep_for(std::chrono::milliseconds(1)); @@ -1721,8 +1982,6 @@ void innodb_shutdown() || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO); ut_ad(lock_sys.is_initialised() || !srv_was_started); ut_ad(log_sys.is_initialised() || !srv_was_started); - ut_ad(ibuf.index || !srv_was_started - || srv_force_recovery >= SRV_FORCE_NO_DDL_UNDO); dict_stats_deinit(); @@ -1743,7 +2002,6 @@ void innodb_shutdown() btr_search_disable(); } #endif /* BTR_CUR_HASH_ADAPT */ - ibuf_close(); log_sys.close(); purge_sys.close(); trx_sys.close(); diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 22782cc0d1e5f..e162456e63fd1 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -332,7 +332,9 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr) /* Update the latest MySQL binlog name and offset info in rollback segment header if MySQL binlogging is on or the database server is a MySQL replication save. */ - trx_rseg_update_binlog_offset(rseg_header, trx, mtr); + trx_rseg_update_binlog_offset( + rseg_header, trx->mysql_log_file_name, + trx->mysql_log_offset, mtr); } /* Add the log as the first in the history list */ diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc index 760c4e707ce52..3885544331544 100644 --- a/storage/innobase/trx/trx0rseg.cc +++ b/storage/innobase/trx/trx0rseg.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -30,6 +30,7 @@ Created 3/26/1996 Heikki Tuuri #include "srv0srv.h" #include "trx0purge.h" #include "srv0mon.h" +#include "log.h" #ifdef WITH_WSREP # include @@ -369,7 +370,7 @@ void trx_rseg_t::destroy() void trx_rseg_t::init(fil_space_t *space, uint32_t page) { latch.SRW_LOCK_INIT(trx_rseg_latch_key); - ut_ad(!this->space); + ut_ad(!this->space || this->space != space); this->space= space; page_no= page; last_page_no= FIL_NULL; @@ -414,6 +415,7 @@ static dberr_t trx_undo_lists_init(trx_rseg_t *rseg, trx_id_t &max_trx_id, const buf_block_t *rseg_header) { ut_ad(srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN); + bool is_undo_empty= true; for (ulint i= 0; i < TRX_RSEG_N_SLOTS; i++) { @@ -424,11 +426,14 @@ static dberr_t trx_undo_lists_init(trx_rseg_t *rseg, trx_id_t &max_trx_id, max_trx_id); if (!undo) return DB_CORRUPTION; + if (is_undo_empty) + is_undo_empty= !undo->size || undo->state == TRX_UNDO_CACHED; rseg->curr_size+= undo->size; MONITOR_INC(MONITOR_NUM_UNDO_SLOT_USED); } } + trx_sys.set_undo_non_empty(!is_undo_empty); return DB_SUCCESS; } @@ -444,7 +449,7 @@ static dberr_t trx_rseg_mem_restore(trx_rseg_t *rseg, trx_id_t &max_trx_id, return DB_TABLESPACE_NOT_FOUND; dberr_t err; const buf_block_t *rseg_hdr= - buf_page_get_gen(rseg->page_id(), 0, RW_S_LATCH, nullptr, BUF_GET, mtr, + buf_page_get_gen(rseg->page_id(), 0, RW_X_LATCH, nullptr, BUF_GET, mtr, &err); if (!rseg_hdr) return err; @@ -532,6 +537,7 @@ static dberr_t trx_rseg_mem_restore(trx_rseg_t *rseg, trx_id_t &max_trx_id, purge_sys.purge_queue.push(*rseg); } + trx_sys.set_undo_non_empty(rseg->history_size > 0); return err; } @@ -574,7 +580,7 @@ dberr_t trx_rseg_array_init() for (ulint rseg_id = 0; rseg_id < TRX_SYS_N_RSEGS; rseg_id++) { mtr.start(); - if (const buf_block_t* sys = trx_sysf_get(&mtr, false)) { + if (const buf_block_t* sys = trx_sysf_get(&mtr, true)) { if (rseg_id == 0) { /* In case this is an upgrade from before MariaDB 10.3.5, fetch the base @@ -592,10 +598,24 @@ dberr_t trx_rseg_array_init() sys, rseg_id); if (page_no != FIL_NULL) { trx_rseg_t& rseg = trx_sys.rseg_array[rseg_id]; - rseg.init(fil_space_get( - trx_sysf_rseg_get_space( - sys, rseg_id)), - page_no); + uint32_t space_id= + trx_sysf_rseg_get_space( + sys, rseg_id); + + fil_space_t *rseg_space = + fil_space_get(space_id); + if (!rseg_space) { + mtr.commit(); + err = DB_ERROR; + sql_print_error( + "InnoDB: Failed to open the undo " + "tablespace undo%03" PRIu32, + (space_id - + srv_undo_space_id_start + 1)); + break; + } + + rseg.init(rseg_space, page_no); ut_ad(rseg.is_persistent()); if ((err = trx_rseg_mem_restore( &rseg, max_trx_id, &mtr)) @@ -685,29 +705,28 @@ which corresponds to the transaction just being committed. In a replication slave, this updates the master binlog position up to which replication has proceeded. @param[in,out] rseg_header rollback segment header -@param[in] trx committing transaction +@param[in] log_file_name binlog file name +@param[in] log_offset binlog file offset @param[in,out] mtr mini-transaction */ -void trx_rseg_update_binlog_offset(buf_block_t *rseg_header, const trx_t *trx, +void trx_rseg_update_binlog_offset(buf_block_t *rseg_header, + const char *log_file_name, + ulonglong log_offset, mtr_t *mtr) { - DBUG_LOG("trx", "trx_mysql_binlog_offset: " << trx->mysql_log_offset); + DBUG_PRINT("trx", ("trx_mysql_binlog_offset %llu", log_offset)); + const size_t len= strlen(log_file_name) + 1; + ut_ad(len > 1); - const size_t len = strlen(trx->mysql_log_file_name) + 1; + if (UNIV_UNLIKELY(len > TRX_RSEG_BINLOG_NAME_LEN)) + return; - ut_ad(len > 1); + mtr->write<8,mtr_t::MAYBE_NOP>( + *rseg_header, + TRX_RSEG + TRX_RSEG_BINLOG_OFFSET + rseg_header->page.frame, + log_offset); - if (UNIV_UNLIKELY(len > TRX_RSEG_BINLOG_NAME_LEN)) { - return; - } - - mtr->write<8,mtr_t::MAYBE_NOP>(*rseg_header, - TRX_RSEG + TRX_RSEG_BINLOG_OFFSET - + rseg_header->page.frame, - trx->mysql_log_offset); + byte *name= TRX_RSEG + TRX_RSEG_BINLOG_NAME + rseg_header->page.frame; - void* name = TRX_RSEG + TRX_RSEG_BINLOG_NAME + rseg_header->page.frame; - - if (memcmp(trx->mysql_log_file_name, name, len)) { - mtr->memcpy(*rseg_header, name, trx->mysql_log_file_name, len); - } + if (memcmp(log_file_name, name, len)) + mtr->memcpy(*rseg_header, name, log_file_name, len); } diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index ee27e8f51c14a..ab8c0b34e7d3c 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2022, MariaDB Corporation. +Copyright (c) 2017, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -105,7 +105,6 @@ trx_sysf_get_n_rseg_slots() /** Initialize the transaction system when creating the database. */ dberr_t trx_sys_create_sys_pages(mtr_t *mtr) { - mtr->start(); mtr->x_lock_space(fil_system.sys_space); static_assert(TRX_SYS_SPACE == 0, "compatibility"); @@ -114,11 +113,7 @@ dberr_t trx_sys_create_sys_pages(mtr_t *mtr) buf_block_t *block= fseg_create(fil_system.sys_space, TRX_SYS + TRX_SYS_FSEG_HEADER, mtr, &err); if (UNIV_UNLIKELY(!block)) - { - error: - mtr->commit(); return err; - } ut_a(block->page.id() == page_id_t(0, TRX_SYS_PAGE_NO)); mtr->write<2>(*block, FIL_PAGE_TYPE + block->page.frame, @@ -138,9 +133,8 @@ dberr_t trx_sys_create_sys_pages(mtr_t *mtr) buf_block_t *r= trx_rseg_header_create(fil_system.sys_space, 0, 0, mtr, &err); if (UNIV_UNLIKELY(!r)) - goto error; + return err; ut_a(r->page.id() == page_id_t(0, FSP_FIRST_RSEG_PAGE_NO)); - mtr->commit(); return trx_lists_init_at_db_start(); } @@ -291,10 +285,9 @@ bool trx_sys_create_rsegs() /* Increase the number of active undo tablespace in case new rollback segment assigned to new undo tablespace. */ - if (space > srv_undo_tablespaces_active) { + if (space > (srv_undo_space_id_start + + srv_undo_tablespaces_active - 1)) { srv_undo_tablespaces_active++; - - ut_ad(srv_undo_tablespaces_active == space); } } diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 0f471402e73ca..e5e6de97987bd 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2022, MariaDB Corporation. +Copyright (c) 2015, 2023, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -410,12 +410,12 @@ void trx_t::free() #endif read_view.mem_noaccess(); MEM_NOACCESS(&lock, sizeof lock); - MEM_NOACCESS(&op_info, sizeof op_info); - MEM_NOACCESS(&isolation_level, sizeof isolation_level); - MEM_NOACCESS(&check_foreigns, sizeof check_foreigns); + MEM_NOACCESS(&op_info, sizeof op_info + + sizeof(unsigned) /* isolation_level, + check_foreigns, check_unique_secondary, + bulk_insert */); MEM_NOACCESS(&is_registered, sizeof is_registered); MEM_NOACCESS(&active_commit_ordered, sizeof active_commit_ordered); - MEM_NOACCESS(&check_unique_secondary, sizeof check_unique_secondary); MEM_NOACCESS(&flush_log_later, sizeof flush_log_later); MEM_NOACCESS(&must_flush_log_later, sizeof must_flush_log_later); MEM_NOACCESS(&duplicates, sizeof duplicates); @@ -728,6 +728,12 @@ dberr_t trx_lists_init_at_db_start() return err; } + if (trx_sys.is_undo_empty()) { +func_exit: + purge_sys.clone_oldest_view(); + return DB_SUCCESS; + } + /* Look from the rollback segments if there exist undo logs for transactions. */ const time_t start_time = time(NULL); @@ -788,8 +794,7 @@ dberr_t trx_lists_init_at_db_start() ib::info() << "Trx id counter is " << trx_sys.get_max_trx_id(); } - purge_sys.clone_oldest_view(); - return DB_SUCCESS; + goto func_exit; } /** Assign a persistent rollback segment in a round-robin fashion, @@ -846,8 +851,7 @@ static trx_rseg_t* trx_assign_rseg_low() ut_ad(rseg->is_persistent()); if (rseg->space != fil_system.sys_space) { - if (rseg->skip_allocation() - || !srv_undo_tablespaces) { + if (rseg->skip_allocation()) { continue; } } else if (const fil_space_t *space = @@ -1164,7 +1168,7 @@ static void trx_flush_log_if_needed_low(lsn_t lsn, const trx_t *trx) callback= &cb; } - log_write_up_to(lsn, srv_file_flush_method != SRV_NOSYNC && + log_write_up_to(lsn, !my_disable_sync && (srv_flush_log_at_trx_commit & 1), callback); } diff --git a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result index de5ed76ad2785..9d67a60cee9d3 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result @@ -98,12 +98,8 @@ buffer_LRU_unzip_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL N buffer_LRU_unzip_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 set_member Page scanned per single LRU unzip search buffer_page_read_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Leaf Pages read buffer_page_read_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Non-leaf Pages read -buffer_page_read_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Leaf Pages read -buffer_page_read_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Non-Leaf Pages read buffer_page_read_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Undo Log Pages read buffer_page_read_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Inode Pages read -buffer_page_read_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Free List Pages read -buffer_page_read_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Bitmap Pages read buffer_page_read_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of System Pages read buffer_page_read_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Transaction System Pages read buffer_page_read_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of File Space Header Pages read @@ -114,12 +110,8 @@ buffer_page_read_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NU buffer_page_read_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of other/unknown (old version of InnoDB) Pages read buffer_page_written_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Leaf Pages written buffer_page_written_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Non-leaf Pages written -buffer_page_written_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Leaf Pages written -buffer_page_written_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Index Non-Leaf Pages written buffer_page_written_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Undo Log Pages written buffer_page_written_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Index Inode Pages written -buffer_page_written_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Free List Pages written -buffer_page_written_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Insert Buffer Bitmap Pages written buffer_page_written_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of System Pages written buffer_page_written_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Transaction System Pages written buffer_page_written_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of File Space Header Pages written @@ -187,14 +179,6 @@ adaptive_hash_rows_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL adaptive_hash_rows_deleted_no_hash_entry adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of rows deleted that did not have corresponding Adaptive Hash Index entries adaptive_hash_rows_updated adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of Adaptive Hash Index rows updated file_num_open_files file_system 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of files currently open (innodb_num_open_files) -ibuf_merges_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of inserted records merged by change buffering -ibuf_merges_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of deleted records merged by change buffering -ibuf_merges_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of purge records merged by change buffering -ibuf_merges_discard_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of insert merged operations discarded -ibuf_merges_discard_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of deleted merged operations discarded -ibuf_merges_discard_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of purge merged operations discarded -ibuf_merges change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of change buffer merges -ibuf_size change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Change buffer size in pages innodb_master_thread_sleeps server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times (seconds) master thread sleeps innodb_activity_count server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Current server activity count innodb_master_active_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times master thread performs its tasks when server is active diff --git a/storage/rocksdb/mysql-test/rocksdb/r/mysqlbinlog_gtid_skip_empty_trans_rocksdb.result b/storage/rocksdb/mysql-test/rocksdb/r/mysqlbinlog_gtid_skip_empty_trans_rocksdb.result index 835361eea352e..f128567efc9c4 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/mysqlbinlog_gtid_skip_empty_trans_rocksdb.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/mysqlbinlog_gtid_skip_empty_trans_rocksdb.result @@ -39,7 +39,7 @@ commit; FLUSH LOGS; ==== Output of mysqlbinlog with --short-form --skip-empty-trans, --database and --skip-gtids options ==== /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; @@ -90,7 +90,7 @@ FLUSH LOGS; ==== Output of mysqlbinlog with --short-form --skip-empty-trans, --database and --skip-gtids options ==== ==== DB changed in the middle of the transaction, which belongs to the selected database /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; SET TIMESTAMP=1000000000/*!*/; @@ -121,7 +121,7 @@ FLUSH LOGS; ==== Output of mysqlbinlog with --short-form --skip-empty-trans, --database and --skip-gtids options ==== ==== DB changed in the middle of the transaction, which belongs to the non-selected database /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; -/*!40019 SET @@session.max_insert_delayed_threads=0*/; +/*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; DELIMITER ; diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 490e7195ef6c1..233ab29101132 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -238,7 +238,6 @@ int ha_spider::open( DBUG_PRINT("info",("spider this=%p", this)); dup_key_idx = (uint) -1; - conn_kinds = SPIDER_CONN_KIND_MYSQL; table->file->get_no_parts("", &part_num); if (part_num) { @@ -590,22 +589,7 @@ int ha_spider::check_access_kind_for_connection( int error_num, roop_count; DBUG_ENTER("ha_spider::check_access_kind_for_connection"); DBUG_PRINT("info",("spider this=%p", this)); - conn_kinds = 0; - switch (wide_handler->sql_command) - { - case SQLCOM_UPDATE: - case SQLCOM_UPDATE_MULTI: - case SQLCOM_DELETE: - case SQLCOM_DELETE_MULTI: - default: - conn_kinds |= SPIDER_CONN_KIND_MYSQL; - for (roop_count = 0; roop_count < (int) share->link_count; roop_count++) - { - conn_kind[roop_count] = SPIDER_CONN_KIND_MYSQL; - } - break; - } - if ((error_num = spider_check_trx_and_get_conn(thd, this, TRUE))) + if ((error_num= spider_check_trx_and_get_conn(thd, this))) { DBUG_RETURN(error_num); } @@ -1037,8 +1021,6 @@ int ha_spider::reset() for (roop_count = share->link_count - 1; roop_count >= 0; roop_count--) { result_list.update_sqls[roop_count].length(0); - - conn_kind[roop_count] = SPIDER_CONN_KIND_MYSQL; } result_list.bulk_update_mode = 0; result_list.bulk_update_size = 0; @@ -1064,7 +1046,6 @@ int ha_spider::reset() result_list.use_union = FALSE; result_list.use_both_key = FALSE; pt_clone_last_searcher = NULL; - conn_kinds = SPIDER_CONN_KIND_MYSQL; use_index_merge = FALSE; init_rnd_handler = FALSE; if (multi_range_keys) @@ -6682,8 +6663,7 @@ int ha_spider::info( pthread_mutex_lock(&share->sts_mutex); if (difftime(tmp_time, share->sts_get_time) >= sts_interval) { - if ((error_num = spider_check_trx_and_get_conn(ha_thd(), this, - FALSE))) + if ((error_num= spider_check_trx_and_get_conn(ha_thd(), this))) { pthread_mutex_unlock(&share->sts_mutex); if (!share->sts_init) @@ -7268,7 +7248,7 @@ int ha_spider::check_crd() } if (crd_mode == 3) crd_mode = 1; - if ((error_num = spider_check_trx_and_get_conn(ha_thd(), this, FALSE))) + if ((error_num= spider_check_trx_and_get_conn(ha_thd(), this))) { DBUG_RETURN(check_error_mode(error_num)); } @@ -8482,7 +8462,7 @@ int ha_spider::truncate() DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } wide_handler->sql_command = SQLCOM_TRUNCATE; - if ((error_num = spider_check_trx_and_get_conn(thd, this, FALSE))) + if ((error_num= spider_check_trx_and_get_conn(thd, this))) { DBUG_RETURN(error_num); } @@ -12068,8 +12048,7 @@ int ha_spider::append_lock_tables_list() DBUG_PRINT("info",("spider lock_table_type=%u", wide_handler->lock_table_type)); - if ((error_num = spider_check_trx_and_get_conn(wide_handler->trx->thd, this, - FALSE))) + if ((error_num= spider_check_trx_and_get_conn(wide_handler->trx->thd, this))) { DBUG_RETURN(error_num); } diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 4dffdf7855390..f6efc62dfe673 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -60,8 +60,6 @@ class ha_spider final : public handler const char *mem_calc_file_name; ulong mem_calc_line_no; ulonglong *connection_ids; - uint conn_kinds; - uint *conn_kind; char *conn_keys_first_ptr; char **conn_keys; SPIDER_CONN **conns; diff --git a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc index 09ab2934aea4d..337979a4f3d49 100644 --- a/storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc +++ b/storage/spider/mysql-test/spider/bugfix/include/sql_mode_init.inc @@ -5,21 +5,7 @@ --enable_result_log --enable_query_log --enable_warnings ---let $SQL_MODES= real_as_float,pipes_as_concat,ansi_quotes,ignore_space,ignore_bad_table_options,only_full_group_by,no_unsigned_subtraction,no_dir_in_create,postgresql,oracle,mssql,db2,maxdb,no_key_options,no_table_options,no_field_options,mysql323,mysql40,ansi,no_auto_value_on_zero,no_backslash_escapes,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,traditional,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length -if (`SELECT IF(STRCMP('$SERVER_NAME', 'MariaDB') = 0, 1, 0)`) -{ - if (`SELECT IF($SERVER_MAJOR_VERSION = 10, 1, 0)`) - { - if (`SELECT IF($SERVER_MINOR_VERSION >= 3, 1, 0)`) - { - --let $SQL_MODES= $SQL_MODES,empty_string_is_null,simultaneous_assignment - } - if (`SELECT IF($SERVER_MINOR_VERSION >= 4, 1, 0)`) - { - --let $SQL_MODES= $SQL_MODES,time_round_fractional - } - } -} +--let $SQL_MODES= real_as_float,pipes_as_concat,ansi_quotes,ignore_space,ignore_bad_table_options,only_full_group_by,no_unsigned_subtraction,no_dir_in_create,postgresql,oracle,mssql,db2,maxdb,no_key_options,no_table_options,no_field_options,mysql323,mysql40,ansi,no_auto_value_on_zero,no_backslash_escapes,strict_trans_tables,strict_all_tables,no_zero_in_date,no_zero_date,allow_invalid_dates,error_for_division_by_zero,traditional,no_auto_create_user,high_not_precedence,no_engine_substitution,pad_char_to_full_length,empty_string_is_null,simultaneous_assignment,time_round_fractional --connection master_1 set @old_sql_mode= @@sql_mode; eval set session sql_mode= '$SQL_MODES'; diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index a1d80ae8670fc..4941c2890f552 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -108,7 +108,6 @@ uchar *spider_conn_get_key( ) { DBUG_ENTER("spider_conn_get_key"); *length = conn->conn_key_length; - DBUG_PRINT("info",("spider conn_kind=%u", conn->conn_kind)); #ifdef DBUG_TRACE spider_print_keys(conn->conn_key, conn->conn_key_length); #endif @@ -382,7 +381,6 @@ SPIDER_CONN *spider_create_conn( ha_spider *spider, int link_idx, int base_link_idx, - uint conn_kind, int *error_num ) { int *need_mon; @@ -595,7 +593,6 @@ SPIDER_CONN *spider_create_conn( conn->semi_trx_isolation_chk = FALSE; conn->semi_trx_chk = FALSE; conn->link_idx = base_link_idx; - conn->conn_kind = conn_kind; conn->conn_need_mon = need_mon; if (spider) conn->need_mon = &spider->need_mons[base_link_idx]; @@ -682,13 +679,11 @@ SPIDER_CONN *spider_get_conn( ha_spider *spider, bool another, bool thd_chg, - uint conn_kind, int *error_num ) { SPIDER_CONN *conn = NULL; int base_link_idx = link_idx; DBUG_ENTER("spider_get_conn"); - DBUG_PRINT("info",("spider conn_kind=%u", conn_kind)); if (spider) link_idx = spider->conn_link_idx[base_link_idx]; @@ -727,7 +722,8 @@ SPIDER_CONN *spider_get_conn( pthread_mutex_unlock(&spider_conn_mutex); if (spider_param_max_connections()) { /* enable connection pool */ - conn = spider_get_conn_from_idle_connection(share, link_idx, conn_key, spider, conn_kind, base_link_idx, error_num); + conn= spider_get_conn_from_idle_connection( + share, link_idx, conn_key, spider, base_link_idx, error_num); /* failed get conn, goto error */ if (!conn) goto error; @@ -736,8 +732,8 @@ SPIDER_CONN *spider_get_conn( else { /* did not enable conncetion pool , create_conn */ DBUG_PRINT("info",("spider create new conn")); - if (!(conn = spider_create_conn(share, spider, link_idx, - base_link_idx, conn_kind, error_num))) + if (!(conn= spider_create_conn(share, spider, link_idx, + base_link_idx, error_num))) goto error; *conn->conn_key = *conn_key; if (spider) @@ -761,8 +757,8 @@ SPIDER_CONN *spider_get_conn( } else { DBUG_PRINT("info",("spider create new conn")); /* conn_recycle_strict = 0 and conn_recycle_mode = 0 or 2 */ - if (!(conn = spider_create_conn(share, spider, link_idx, base_link_idx, - conn_kind, error_num))) + if (!(conn= spider_create_conn(share, spider, link_idx, base_link_idx, + error_num))) goto error; *conn->conn_key = *conn_key; if (spider) @@ -885,13 +881,10 @@ int spider_check_and_get_casual_read_conn( char first_byte_bak = *spider->conn_keys[link_idx]; *spider->conn_keys[link_idx] = '0' + spider->result_list.casual_read[link_idx]; - if ( - !(spider->conns[link_idx] = - spider_get_conn(spider->share, link_idx, - spider->conn_keys[link_idx], spider->wide_handler->trx, - spider, FALSE, TRUE, SPIDER_CONN_KIND_MYSQL, - &error_num)) - ) { + if (!(spider->conns[link_idx]= spider_get_conn( + spider->share, link_idx, spider->conn_keys[link_idx], + spider->wide_handler->trx, spider, FALSE, TRUE, &error_num))) + { *spider->conn_keys[link_idx] = first_byte_bak; DBUG_RETURN(error_num); } @@ -3010,9 +3003,8 @@ void *spider_bg_sts_action( if (!conns[spider.search_link_idx]) { spider_get_conn(share, spider.search_link_idx, - share->conn_keys[spider.search_link_idx], - trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, - &error_num); + share->conn_keys[spider.search_link_idx], trx, + &spider, FALSE, FALSE, &error_num); conns[spider.search_link_idx]->error_mode = 0; /* if ( @@ -3335,9 +3327,8 @@ void *spider_bg_crd_action( if (!conns[spider.search_link_idx]) { spider_get_conn(share, spider.search_link_idx, - share->conn_keys[spider.search_link_idx], - trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, - &error_num); + share->conn_keys[spider.search_link_idx], trx, + &spider, FALSE, FALSE, &error_num); conns[spider.search_link_idx]->error_mode = 0; /* if ( @@ -3904,7 +3895,6 @@ SPIDER_CONN* spider_get_conn_from_idle_connection( int link_idx, char *conn_key, ha_spider *spider, - uint conn_kind, int base_link_idx, int *error_num ) @@ -3992,7 +3982,8 @@ SPIDER_CONN* spider_get_conn_from_idle_connection( if (ip_port_conn) pthread_mutex_unlock(&ip_port_conn->mutex); DBUG_PRINT("info",("spider create new conn")); - if (!(conn = spider_create_conn(share, spider, link_idx, base_link_idx, conn_kind, error_num))) + if (!(conn= spider_create_conn(share, spider, link_idx, base_link_idx, + error_num))) DBUG_RETURN(conn); *conn->conn_key = *conn_key; if (spider) diff --git a/storage/spider/spd_conn.h b/storage/spider/spd_conn.h index 807e1474ed2c4..1759f06baa67c 100644 --- a/storage/spider/spd_conn.h +++ b/storage/spider/spd_conn.h @@ -84,7 +84,6 @@ SPIDER_CONN *spider_create_conn( ha_spider *spider, int link_id, int base_link_id, - uint conn_kind, int *error_num ); @@ -96,7 +95,6 @@ SPIDER_CONN *spider_get_conn( ha_spider *spider, bool another, bool thd_chg, - uint conn_kind, int *error_num ); @@ -397,7 +395,6 @@ SPIDER_CONN* spider_get_conn_from_idle_connection int link_idx, char *conn_key, ha_spider *spider, - uint conn_kind, int base_link_idx, int *error_num ); diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc index eb2454b2f298a..5e28b5903092a 100644 --- a/storage/spider/spd_copy_tables.cc +++ b/storage/spider/spd_copy_tables.cc @@ -593,11 +593,10 @@ int spider_udf_get_copy_tgt_conns( while (table_conn) { share = table_conn->share; - if ( - !(table_conn->conn = spider_get_conn( - share, 0, share->conn_keys[0], trx, NULL, FALSE, FALSE, - SPIDER_CONN_KIND_MYSQL, &error_num)) - ) { + if (!(table_conn->conn= + spider_get_conn(share, 0, share->conn_keys[0], trx, NULL, + FALSE, FALSE, &error_num))) + { my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), share->server_names[0]); DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE); } diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index b64aaab4d5857..9c91d666c0ab1 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -80,7 +80,7 @@ int spider_db_connect( THD* thd = current_thd; longlong connect_retry_interval; DBUG_ENTER("spider_db_connect"); - DBUG_ASSERT(conn->conn_kind != SPIDER_CONN_KIND_MYSQL || conn->need_mon); + DBUG_ASSERT(conn->need_mon); DBUG_PRINT("info",("spider link_idx=%d", link_idx)); DBUG_PRINT("info",("spider conn=%p", conn)); @@ -240,7 +240,6 @@ void spider_db_disconnect( ) { DBUG_ENTER("spider_db_disconnect"); DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider conn->conn_kind=%u", conn->conn_kind)); if (conn->db_conn->is_connected()) { conn->db_conn->disconnect(); diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 02d0c38951571..8f8cf6c97bcc1 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -168,8 +168,6 @@ typedef st_spider_result SPIDER_RESULT; #define SPIDER_SQL_LOP_CHK_PRM_PRF_STR "spider_lc_" #define SPIDER_SQL_LOP_CHK_PRM_PRF_LEN (sizeof(SPIDER_SQL_LOP_CHK_PRM_PRF_STR) - 1) -#define SPIDER_CONN_KIND_MYSQL (1 << 0) - #define SPIDER_SQL_TYPE_SELECT_SQL (1 << 0) #define SPIDER_SQL_TYPE_INSERT_SQL (1 << 1) #define SPIDER_SQL_TYPE_UPDATE_SQL (1 << 2) diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 78236243bf209..21c2e6bb4342a 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -5839,88 +5839,7 @@ int spider_db_mbase_util::open_item_func( alias, alias_length, dbton_id, use_fields, fields)); } else if (!strncasecmp("timestampdiff", func_name, func_name_length)) { -#ifdef ITEM_FUNC_TIMESTAMPDIFF_ARE_PUBLIC - Item_func_timestamp_diff *item_func_timestamp_diff = - (Item_func_timestamp_diff *) item_func; - if (str) - { - const char *interval_str; - uint interval_len; - switch (item_func_timestamp_diff->int_type) - { - case INTERVAL_YEAR: - interval_str = SPIDER_SQL_YEAR_STR; - interval_len = SPIDER_SQL_YEAR_LEN; - break; - case INTERVAL_QUARTER: - interval_str = SPIDER_SQL_QUARTER_STR; - interval_len = SPIDER_SQL_QUARTER_LEN; - break; - case INTERVAL_MONTH: - interval_str = SPIDER_SQL_MONTH_STR; - interval_len = SPIDER_SQL_MONTH_LEN; - break; - case INTERVAL_WEEK: - interval_str = SPIDER_SQL_WEEK_STR; - interval_len = SPIDER_SQL_WEEK_LEN; - break; - case INTERVAL_DAY: - interval_str = SPIDER_SQL_DAY_STR; - interval_len = SPIDER_SQL_DAY_LEN; - break; - case INTERVAL_HOUR: - interval_str = SPIDER_SQL_HOUR_STR; - interval_len = SPIDER_SQL_HOUR_LEN; - break; - case INTERVAL_MINUTE: - interval_str = SPIDER_SQL_MINUTE_STR; - interval_len = SPIDER_SQL_MINUTE_LEN; - break; - case INTERVAL_SECOND: - interval_str = SPIDER_SQL_SECOND_STR; - interval_len = SPIDER_SQL_SECOND_LEN; - break; - case INTERVAL_MICROSECOND: - interval_str = SPIDER_SQL_MICROSECOND_STR; - interval_len = SPIDER_SQL_MICROSECOND_LEN; - break; - default: - interval_str = ""; - interval_len = 0; - break; - } - str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); - if (str->reserve(func_name_length + SPIDER_SQL_OPEN_PAREN_LEN + - interval_len + SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(func_name, func_name_length); - str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); - str->q_append(interval_str, interval_len); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider, - str, alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - if (str) - { - if (str->reserve(SPIDER_SQL_COMMA_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); - } - if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider, - str, alias, alias_length, dbton_id, use_fields, fields))) - DBUG_RETURN(error_num); - if (str) - { - if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, - SPIDER_SQL_CLOSE_PAREN_LEN); - } - DBUG_RETURN(0); -#else DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); -#endif } } else if (func_name_length == 14) { @@ -8298,10 +8217,10 @@ int spider_mbase_share::discover_table_structure( SPIDER_CONN *conn; int need_mon; - if (!(conn = spider_get_conn( - spider_share, 0, spider_share->conn_keys[roop_count], trx, NULL, FALSE, - FALSE, SPIDER_CONN_KIND_MYSQL, &error_num)) - ) { + if (!(conn= spider_get_conn(spider_share, 0, + spider_share->conn_keys[roop_count], trx, NULL, + FALSE, FALSE, &error_num))) + { DBUG_RETURN(error_num); } pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index 429c8fa9ae793..4048607373038 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -551,7 +551,6 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn( conn->semi_trx_isolation = -2; conn->semi_trx_isolation_chk = FALSE; conn->semi_trx_chk = FALSE; - conn->conn_kind = SPIDER_CONN_KIND_MYSQL; if (mysql_mutex_init(spd_key_mutex_mta_conn, &conn->mta_conn_mutex, MY_MUTEX_INIT_FAST)) @@ -697,7 +696,6 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn( conn->queued_ping = FALSE; DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider conn->conn_kind=%u", conn->conn_kind)); DBUG_RETURN(conn); error: diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 897721d3c2e38..e6d4c2dca879b 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -85,9 +85,7 @@ #define SPIDER_TEST(A) MY_TEST(A) -#define SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR #define SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON -#define SPIDER_XID_USES_xid_cache_iterate #define SPIDER_Item_args_arg_count_IS_PROTECTED @@ -329,7 +327,6 @@ typedef struct st_spider_conn_loop_check SPIDER_CONN_LOOP_CHECK; /* database connection */ typedef struct st_spider_conn { - uint conn_kind; char *conn_key; uint conn_key_length; my_hash_value_type conn_key_hash_value; diff --git a/storage/spider/spd_init_query.h b/storage/spider/spd_init_query.h index e66e94d837319..0aba850ce0fa4 100644 --- a/storage/spider/spd_init_query.h +++ b/storage/spider/spd_init_query.h @@ -538,6 +538,10 @@ static LEX_STRING spider_init_queries[] = { " engine=Aria transactional=1;" " end if;" " end if;" +/* + tables for ddl pushdown +*/ +/* " if @server_name = 'MariaDB' and" " (" " @server_major_version > 10 or" @@ -547,7 +551,6 @@ static LEX_STRING spider_init_queries[] = { " )" " )" " then" - " /* table for ddl pushdown */" " create table if not exists mysql.spider_rewrite_tables(" " table_id bigint unsigned not null auto_increment," " db_name char(64) not null default ''," @@ -602,6 +605,7 @@ static LEX_STRING spider_init_queries[] = { " primary key (db_name, table_name, table_id, partition_id)" " ) engine=Aria transactional=1 default charset=utf8 collate=utf8_bin;" " end if;" +*/ /* Fix for version 3.4 */ @@ -798,6 +802,10 @@ static LEX_STRING spider_init_queries[] = { " soname 'ha_spider.dll';" " end if;" " end if;" +/* + Install spider_rewrite plugin +*/ +/* " if @server_name = 'MariaDB' and" " (" " @server_major_version > 10 or" @@ -807,9 +815,6 @@ static LEX_STRING spider_init_queries[] = { " )" " )" " then" -/* - Install spider_rewrite plugin -*/ " set @have_spider_i_s_rewrite_plugin := 0;" " select @have_spider_i_s_rewrite_plugin := 1" " from INFORMATION_SCHEMA.plugins" @@ -819,11 +824,6 @@ static LEX_STRING spider_init_queries[] = { " where name = 'spider_rewrite';" " if @have_spider_i_s_rewrite_plugin = 0 then" " if @have_spider_rewrite_plugin = 1 then" - " /*" - " spider_rewrite plugin is present in mysql.plugin but not in" - " information_schema.plugins. Remove spider_rewrite plugin entry" - " in mysql.plugin first." - " */" " delete from mysql.plugin where name = 'spider_rewrite';" " end if;" " if @win_plugin = 0 then " @@ -845,6 +845,7 @@ static LEX_STRING spider_init_queries[] = { " end if;" " end if;" " end if;" +*/ "end;" )}, {C_STRING_WITH_LEN( diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc index b331a9fec0d67..e82a5925265e6 100644 --- a/storage/spider/spd_ping_table.cc +++ b/storage/spider/spd_ping_table.cc @@ -594,11 +594,9 @@ SPIDER_CONN *spider_get_ping_table_tgt_conn( ) { SPIDER_CONN *conn; DBUG_ENTER("spider_get_ping_table_tgt_conn"); - if ( - !(conn = spider_get_conn( - share, 0, share->conn_keys[0], trx, NULL, FALSE, FALSE, - SPIDER_CONN_KIND_MYSQL, error_num)) - ) { + if (!(conn= spider_get_conn(share, 0, share->conn_keys[0], trx, NULL, FALSE, + FALSE, error_num))) + { my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), share->server_names[0]); *error_num = ER_CONNECT_TO_FOREIGN_DATA_SOURCE; diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index a0cf104d46e61..df95336cc191d 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -3572,24 +3572,13 @@ TABLE *spider_mk_sys_tmp_table( TABLE *tmp_table; DBUG_ENTER("spider_mk_sys_tmp_table"); -#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR if (!(field = new (thd->mem_root) Field_blob( 4294967295U, FALSE, field_name, cs, TRUE))) goto error_alloc_field; -#else - if (!(field = new Field_blob( - 4294967295U, FALSE, field_name, cs, TRUE))) - goto error_alloc_field; -#endif field->init(table); -#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR if (!(i_field = new (thd->mem_root) Item_field(thd, (Field *) field))) goto error_alloc_item_field; -#else - if (!(i_field = new Item_field((Field *) field))) - goto error_alloc_item_field; -#endif if (i_list.push_back(i_field)) goto error_push_item; @@ -3650,68 +3639,35 @@ TABLE *spider_mk_sys_tmp_table_for_result( TABLE *tmp_table; DBUG_ENTER("spider_mk_sys_tmp_table_for_result"); -#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR if (!(field1 = new (thd->mem_root) Field_blob( 4294967295U, FALSE, field_name1, cs, TRUE))) goto error_alloc_field1; -#else - if (!(field1 = new Field_blob( - 4294967295U, FALSE, field_name1, cs, TRUE))) - goto error_alloc_field1; -#endif field1->init(table); -#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR if (!(i_field1 = new (thd->mem_root) Item_field(thd, (Field *) field1))) goto error_alloc_item_field1; -#else - if (!(i_field1 = new Item_field((Field *) field1))) - goto error_alloc_item_field1; -#endif if (i_list.push_back(i_field1)) goto error_push_item1; -#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR if (!(field2 = new (thd->mem_root) Field_blob( 4294967295U, FALSE, field_name2, cs, TRUE))) goto error_alloc_field2; -#else - if (!(field2 = new Field_blob( - 4294967295U, FALSE, field_name2, cs, TRUE))) - goto error_alloc_field2; -#endif field2->init(table); -#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR if (!(i_field2 = new (thd->mem_root) Item_field(thd, (Field *) field2))) goto error_alloc_item_field2; -#else - if (!(i_field2 = new Item_field((Field *) field2))) - goto error_alloc_item_field2; -#endif if (i_list.push_back(i_field2)) goto error_push_item2; -#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR if (!(field3 = new (thd->mem_root) Field_blob( 4294967295U, FALSE, field_name3, cs, TRUE))) goto error_alloc_field3; -#else - if (!(field3 = new Field_blob( - 4294967295U, FALSE, field_name3, cs, TRUE))) - goto error_alloc_field3; -#endif field3->init(table); -#ifdef SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR if (!(i_field3 = new (thd->mem_root) Item_field(thd, (Field *) field3))) goto error_alloc_item_field3; -#else - if (!(i_field3 = new Item_field((Field *) field3))) - goto error_alloc_item_field3; -#endif if (i_list.push_back(i_field3)) goto error_push_item3; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index e78e2feca77ff..e6ecf96de1c34 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -110,14 +110,6 @@ inline void spider_destroy_thd(MYSQL_THD thd) delete thd; } -#ifdef SPIDER_XID_USES_xid_cache_iterate -#else -#ifdef XID_CACHE_IS_SPLITTED -uint *spd_db_att_xid_cache_split_num; -#endif -pthread_mutex_t *spd_db_att_LOCK_xid_cache; -HASH *spd_db_att_xid_cache; -#endif struct charset_info_st *spd_charset_utf8mb3_bin; const char **spd_defaults_extra_file; const char **spd_defaults_file; @@ -4850,7 +4842,6 @@ SPIDER_SHARE *spider_get_share( &spider->conn_link_idx, sizeof(uint) * share->link_count, &spider->conn_can_fo, sizeof(uchar) * share->link_bitmap_size, &spider->connection_ids, sizeof(ulonglong) * share->link_count, - &spider->conn_kind, sizeof(uint) * share->link_count, &spider->db_request_id, sizeof(ulonglong) * share->link_count, &spider->db_request_phase, sizeof(uchar) * share->link_bitmap_size, &spider->need_mons, sizeof(int) * share->link_count, @@ -4883,7 +4874,6 @@ SPIDER_SHARE *spider_get_share( tmp_name += share->conn_keys_lengths[roop_count] + 1; result_list->upd_tmp_tbl_prms[roop_count].init(); result_list->upd_tmp_tbl_prms[roop_count].field_count = 1; - spider->conn_kind[roop_count] = SPIDER_CONN_KIND_MYSQL; } spider_trx_set_link_idx_for_all(spider); @@ -4938,7 +4928,6 @@ SPIDER_SHARE *spider_get_share( !(spider->conns[roop_count] = spider_get_conn(share, roop_count, spider->conn_keys[roop_count], spider->wide_handler->trx, spider, FALSE, TRUE, - SPIDER_CONN_KIND_MYSQL, error_num)) ) { if ( @@ -5305,7 +5294,6 @@ SPIDER_SHARE *spider_get_share( &spider->conn_link_idx, sizeof(uint) * share->link_count, &spider->conn_can_fo, sizeof(uchar) * share->link_bitmap_size, &spider->connection_ids, sizeof(ulonglong) * share->link_count, - &spider->conn_kind, sizeof(uint) * share->link_count, &spider->db_request_id, sizeof(ulonglong) * share->link_count, &spider->db_request_phase, sizeof(uchar) * share->link_bitmap_size, &spider->need_mons, sizeof(int) * share->link_count, @@ -5335,7 +5323,6 @@ SPIDER_SHARE *spider_get_share( tmp_name += share->conn_keys_lengths[roop_count] + 1; result_list->upd_tmp_tbl_prms[roop_count].init(); result_list->upd_tmp_tbl_prms[roop_count].field_count = 1; - spider->conn_kind[roop_count] = SPIDER_CONN_KIND_MYSQL; } spider_trx_set_link_idx_for_all(spider); @@ -5387,7 +5374,6 @@ SPIDER_SHARE *spider_get_share( !(spider->conns[roop_count] = spider_get_conn(share, roop_count, spider->conn_keys[roop_count], spider->wide_handler->trx, spider, FALSE, TRUE, - SPIDER_CONN_KIND_MYSQL, error_num)) ) { if ( @@ -6042,11 +6028,9 @@ int spider_open_all_tables( } /* create conn */ - if ( - !(conn = spider_get_conn( - &tmp_share, 0, tmp_share.conn_keys[0], trx, NULL, FALSE, FALSE, - SPIDER_CONN_KIND_MYSQL, &error_num)) - ) { + if (!(conn= spider_get_conn(&tmp_share, 0, tmp_share.conn_keys[0], trx, + NULL, FALSE, FALSE, &error_num))) + { spider_sys_index_end(table_tables); spider_close_sys_table(thd, table_tables, &open_tables_backup, TRUE); @@ -6157,11 +6141,9 @@ int spider_open_all_tables( } /* create another conn */ - if ( - (!(conn = spider_get_conn( - &tmp_share, 0, tmp_share.conn_keys[0], trx, spider, TRUE, FALSE, - SPIDER_CONN_KIND_MYSQL, &error_num))) - ) { + if ((!(conn= spider_get_conn(&tmp_share, 0, tmp_share.conn_keys[0], trx, + spider, TRUE, FALSE, &error_num)))) + { spider_free_tmp_dbton_handler(spider); spider_free(trx, share, MYF(0)); delete spider; @@ -6593,17 +6575,6 @@ int spider_db_init( #ifndef SPIDER_HAS_NEXT_THREAD_ID spd_db_att_thread_id = &thread_id; -#endif -#ifdef SPIDER_XID_USES_xid_cache_iterate -#else -#ifdef XID_CACHE_IS_SPLITTED - spd_db_att_xid_cache_split_num = &opt_xid_cache_split_num; - spd_db_att_LOCK_xid_cache = LOCK_xid_cache; - spd_db_att_xid_cache = xid_cache; -#else - spd_db_att_LOCK_xid_cache = &LOCK_xid_cache; - spd_db_att_xid_cache = &xid_cache; -#endif #endif spd_charset_utf8mb3_bin = &my_charset_utf8mb3_bin; spd_defaults_extra_file = &my_defaults_extra_file; @@ -9195,9 +9166,8 @@ void *spider_table_bg_sts_action( if (!conns[spider->search_link_idx]) { spider_get_conn(share, spider->search_link_idx, - share->conn_keys[spider->search_link_idx], - trx, spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, - &error_num); + share->conn_keys[spider->search_link_idx], trx, + spider, FALSE, FALSE, &error_num); if (conns[spider->search_link_idx]) { conns[spider->search_link_idx]->error_mode = 0; @@ -9341,9 +9311,8 @@ void *spider_table_bg_crd_action( if (!conns[spider->search_link_idx]) { spider_get_conn(share, spider->search_link_idx, - share->conn_keys[spider->search_link_idx], - trx, spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, - &error_num); + share->conn_keys[spider->search_link_idx], trx, + spider, FALSE, FALSE, &error_num); if (conns[spider->search_link_idx]) { conns[spider->search_link_idx]->error_mode = 0; diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 09da3c18c486e..85b2cdb8a2717 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -36,14 +36,6 @@ #include "spd_ping_table.h" #include "spd_malloc.h" -#ifdef SPIDER_XID_USES_xid_cache_iterate -#else -#ifdef XID_CACHE_IS_SPLITTED -extern uint *spd_db_att_xid_cache_split_num; -#endif -extern pthread_mutex_t *spd_db_att_LOCK_xid_cache; -extern HASH *spd_db_att_xid_cache; -#endif extern struct charset_info_st *spd_charset_utf8mb3_bin; extern handlerton *spider_hton_ptr; @@ -1604,62 +1596,17 @@ static int spider_xa_lock( int error_num; const char *old_proc_info; DBUG_ENTER("spider_xa_lock"); -#ifdef SPIDER_XID_USES_xid_cache_iterate -#else - my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache, - (uchar*) xid_state->xid.key(), xid_state->xid.key_length()); -#ifdef XID_CACHE_IS_SPLITTED - uint idx = hash_value % *spd_db_att_xid_cache_split_num; -#endif -#endif old_proc_info = thd_proc_info(thd, "Locking xid by Spider"); -#ifdef SPIDER_XID_USES_xid_cache_iterate if (xid_cache_insert(thd, xid_state, xid)) { error_num = (spider_stmt_da_sql_errno(thd) == ER_XAER_DUPID ? ER_SPIDER_XA_LOCKED_NUM : HA_ERR_OUT_OF_MEM); goto error; } -#else -#ifdef XID_CACHE_IS_SPLITTED - pthread_mutex_lock(&spd_db_att_LOCK_xid_cache[idx]); -#else - pthread_mutex_lock(spd_db_att_LOCK_xid_cache); -#endif -#ifdef XID_CACHE_IS_SPLITTED - if (my_hash_search_using_hash_value(&spd_db_att_xid_cache[idx], hash_value, - xid_state->xid.key(), xid_state->xid.key_length())) -#else - if (my_hash_search_using_hash_value(spd_db_att_xid_cache, hash_value, - xid_state->xid.key(), xid_state->xid.key_length())) -#endif - { - error_num = ER_SPIDER_XA_LOCKED_NUM; - goto error; - } - if (my_hash_insert(spd_db_att_xid_cache, (uchar*)xid_state)) - { - error_num = HA_ERR_OUT_OF_MEM; - goto error; - } -#ifdef XID_CACHE_IS_SPLITTED - pthread_mutex_unlock(&spd_db_att_LOCK_xid_cache[idx]); -#else - pthread_mutex_unlock(spd_db_att_LOCK_xid_cache); -#endif -#endif thd_proc_info(thd, old_proc_info); DBUG_RETURN(0); error: -#ifdef SPIDER_XID_USES_xid_cache_iterate -#else -#ifdef XID_CACHE_IS_SPLITTED - pthread_mutex_unlock(&spd_db_att_LOCK_xid_cache[idx]); -#else - pthread_mutex_unlock(spd_db_att_LOCK_xid_cache); -#endif -#endif thd_proc_info(thd, old_proc_info); DBUG_RETURN(error_num); } @@ -1670,25 +1617,8 @@ static int spider_xa_unlock( THD *thd = current_thd; const char *old_proc_info; DBUG_ENTER("spider_xa_unlock"); -#ifdef SPIDER_XID_USES_xid_cache_iterate -#else -#endif old_proc_info = thd_proc_info(thd, "Unlocking xid by Spider"); -#ifdef SPIDER_XID_USES_xid_cache_iterate xid_cache_delete(thd, xid_state); -#else -#ifdef XID_CACHE_IS_SPLITTED - pthread_mutex_lock(&spd_db_att_LOCK_xid_cache[idx]); -#else - pthread_mutex_lock(spd_db_att_LOCK_xid_cache); -#endif - my_hash_delete(spd_db_att_xid_cache, (uchar *)xid_state); -#ifdef XID_CACHE_IS_SPLITTED - pthread_mutex_unlock(&spd_db_att_LOCK_xid_cache[idx]); -#else - pthread_mutex_unlock(spd_db_att_LOCK_xid_cache); -#endif -#endif thd_proc_info(thd, old_proc_info); DBUG_RETURN(0); } @@ -2786,13 +2716,11 @@ int spider_internal_xa_commit_by_xid( goto error; } - if ( - !(conn = spider_get_conn( - &tmp_share, 0, tmp_share.conn_keys[0], trx, NULL, FALSE, FALSE, - SPIDER_CONN_KIND_MYSQL, &error_num)) && - (force_commit == 0 || - (force_commit == 1 && error_num != ER_XAER_NOTA)) - ) { + if (!(conn= spider_get_conn(&tmp_share, 0, tmp_share.conn_keys[0], trx, + NULL, FALSE, FALSE, &error_num)) && + (force_commit == 0 || + (force_commit == 1 && error_num != ER_XAER_NOTA))) + { spider_sys_index_end(table_xa_member); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -3015,13 +2943,11 @@ int spider_internal_xa_rollback_by_xid( goto error; } - if ( - !(conn = spider_get_conn( - &tmp_share, 0, tmp_share.conn_keys[0], trx, NULL, FALSE, FALSE, - SPIDER_CONN_KIND_MYSQL, &error_num)) && - (force_commit == 0 || - (force_commit == 1 && error_num != ER_XAER_NOTA)) - ) { + if (!(conn= spider_get_conn(&tmp_share, 0, tmp_share.conn_keys[0], trx, + NULL, FALSE, FALSE, &error_num)) && + (force_commit == 0 || + (force_commit == 1 && error_num != ER_XAER_NOTA))) + { spider_sys_index_end(table_xa_member); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -3511,11 +3437,8 @@ int spider_end_trx( DBUG_RETURN(error_num); } -int spider_check_trx_and_get_conn( - THD *thd, - ha_spider *spider, - bool use_conn_kind -) { +int spider_check_trx_and_get_conn(THD *thd, ha_spider *spider) +{ int error_num, roop_count, search_link_idx; SPIDER_TRX *trx; SPIDER_SHARE *share = spider->share; @@ -3615,22 +3538,16 @@ int spider_check_trx_and_get_conn( spider->conn_link_idx, roop_count, share->link_count, SPIDER_LINK_STATUS_RECOVERY) ) { - uint tgt_conn_kind = (use_conn_kind ? spider->conn_kind[roop_count] : - SPIDER_CONN_KIND_MYSQL); if (roop_count == spider->search_link_idx) search_link_idx_is_checked = TRUE; - if ( - tgt_conn_kind == SPIDER_CONN_KIND_MYSQL && - !spider->conns[roop_count] - ) { + if (!spider->conns[roop_count]) + { *spider->conn_keys[roop_count] = first_byte; if ( !(conn = spider_get_conn(share, roop_count, spider->conn_keys[roop_count], trx, spider, FALSE, TRUE, - use_conn_kind ? spider->conn_kind[roop_count] : - SPIDER_CONN_KIND_MYSQL, &error_num)) ) { if ( @@ -3710,8 +3627,6 @@ int spider_check_trx_and_get_conn( spider_get_conn(share, roop_count, spider->conn_keys[roop_count], trx, spider, FALSE, TRUE, - use_conn_kind ? spider->conn_kind[roop_count] : - SPIDER_CONN_KIND_MYSQL, &error_num)) ) { if ( diff --git a/storage/spider/spd_trx.h b/storage/spider/spd_trx.h index 2055a49717efe..93b03fcec21f0 100644 --- a/storage/spider/spd_trx.h +++ b/storage/spider/spd_trx.h @@ -227,11 +227,7 @@ int spider_end_trx( SPIDER_CONN *conn ); -int spider_check_trx_and_get_conn( - THD *thd, - ha_spider *spider, - bool use_conn_kind -); +int spider_check_trx_and_get_conn(THD *thd, ha_spider *spider); THD *spider_create_tmp_thd(); diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 28405409e2dee..064ca50a13da9 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -176,7 +176,6 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length, { const uchar *map= cs->sort_order, *end; size_t length; - int res; end= a + (length= MY_MIN(a_length, b_length)); while (a < end) @@ -184,7 +183,6 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length, if (map[*a++] != map[*b++]) return ((int) map[a[-1]] - (int) map[b[-1]]); } - res= 0; if (a_length != b_length) { int swap= 1; @@ -198,15 +196,14 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length, a_length= b_length; a= b; swap= -1; /* swap sign of result */ - res= -res; } for (end= a + a_length-length; a < end ; a++) { if (map[*a] != map[' ']) - return (map[*a] < map[' ']) ? -swap : swap; + return (map[*a] < map[' ']) ? -swap : swap; } } - return res; + return 0; } diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt index cff67fd110fc5..44ad8d0ae94bf 100644 --- a/support-files/CMakeLists.txt +++ b/support-files/CMakeLists.txt @@ -32,6 +32,19 @@ ELSE() SET(MYSQLD_GROUP "mysql") SET(ini_file_extension "cnf") SET(HOSTNAME "uname -n") + + # Define directly here, as cmake/install_layout.cmake has no LOGDIR to be inherited + SET(su_user "su mysql mysql") + IF(RPM MATCHES "(suse|sles)") + SET(logdir "/var/log/mysql") + ELSEIF(RPM) + SET(logdir "/var/log/mariadb") + ELSE() + SET(logdir "/var/log/mysql") + ENDIF() + IF(DEB) + SET(su_user "#su mysql mysql") + ENDIF() ENDIF() # XXX: shouldn't we just have variables for all this stuff and centralise @@ -51,7 +64,7 @@ ENDIF() IF(UNIX AND NOT WITHOUT_SERVER) SET(prefix ${CMAKE_INSTALL_PREFIX}) - SET(SCRIPTS mysqld_multi.server mysql-log-rotate binary-configure mini-benchmark) + SET(SCRIPTS mysqld_multi.server mariadb.logrotate binary-configure mini-benchmark) IF(WITH_WSREP) SET(SCRIPTS ${SCRIPTS} wsrep_notify) ENDIF() @@ -207,8 +220,9 @@ IF(UNIX AND NOT WITHOUT_SERVER) ENDIF() IF (INSTALL_SYSCONFDIR) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql-log-rotate DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d - RENAME mysql COMPONENT SupportFiles) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.logrotate + DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d + RENAME mariadb COMPONENT SupportFiles) IF(NOT HAVE_SYSTEMD) INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/mysql.server DESTINATION ${INSTALL_SYSCONFDIR}/init.d diff --git a/support-files/mariadb.logrotate.sh b/support-files/mariadb.logrotate.sh new file mode 100644 index 0000000000000..811b274778f50 --- /dev/null +++ b/support-files/mariadb.logrotate.sh @@ -0,0 +1,59 @@ +# This is the MariaDB configuration for the logrotate utility +# +# Note that on most Linux systems logs are written to journald, which has its +# own rotation scheme. +# +# Read https://mariadb.com/kb/en/error-log/ to learn more about logging and +# https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/ about rotating logs. + +@localstatedir@/mysqld.log @localstatedir@/mariadb.log @logdir@/*.log { + + # Depends on a mysql@localhost unix_socket authenticated user with RELOAD privilege + @su_user@ + + # If any of the files listed above is missing, skip them silently without + # emitting any errors + missingok + + # If file exists but is empty, don't rotate it + notifempty + + # Run monthly + monthly + + # Keep 6 months of logs + rotate 6 + + # If file is growing too big, rotate immediately + maxsize 500M + + # If file size is too small, don't rotate at all + minsize 50M + + # Compress logs, as they are text and compression will save a lot of disk space + compress + + # Don't compress the log immediately to avoid errors about "file size changed while zipping" + delaycompress + + # Don't run the postrotate script for each file configured in this file, but + # run it only once if one or more files were rotated + sharedscripts + + # After each rotation, run this custom script to flush the logs. Note that + # this assumes that the mariadb-admin command has database access, which it + # has thanks to the default use of Unix socket authentication for the 'mysql' + # (or root on Debian) account used everywhere since MariaDB 10.4. + postrotate + if test -r /etc/mysql/debian.cnf + then + EXTRAPARAM='--defaults-file=/etc/mysql/debian.cnf' + fi + + if test -x @bindir@/mariadb-admin + then + @bindir@/mariadb-admin $EXTRAPARAM --local flush-error-log \ + flush-engine-log flush-general-log flush-slow-log + fi + endscript +} diff --git a/support-files/mysql-log-rotate.sh b/support-files/mysql-log-rotate.sh deleted file mode 100644 index c89aa6e0b99e1..0000000000000 --- a/support-files/mysql-log-rotate.sh +++ /dev/null @@ -1,38 +0,0 @@ -# This logname can be set in /etc/my.cnf -# by setting the variable "log-error" -# in the [mysqld] section as follows: -# -# [mysqld] -# log-error=@localstatedir@/mysqld.log -# -# If the root user has a password you have to create a -# /root/.my.cnf configuration file with the following -# content: -# -# [mysqladmin] -# password = -# user= root -# -# where "" is the password. -# -# ATTENTION: This /root/.my.cnf should be readable ONLY -# for root ! - -@localstatedir@/mysqld.log { - # create 600 mysql mysql - su mysql mysql - notifempty - daily - rotate 3 - missingok - compress - postrotate - # just if mariadbd is really running - if test -x @bindir@/mysqladmin && \ - @bindir@/mysqladmin ping &>/dev/null - then - @bindir@/mysqladmin --local flush-error-log \ - flush-engine-log flush-general-log flush-slow-log - fi - endscript -} diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 757e9f52f3360..6a4635e535eeb 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -469,7 +469,7 @@ static void test_prepare_simple() strmov(query, "SHOW SLAVE STATUS"); stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - DIE_UNLESS(mysql_stmt_field_count(stmt) == 53); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 54); mysql_stmt_close(stmt); /* show master status */ diff --git a/tpool/task_group.cc b/tpool/task_group.cc index b52fe7c0f672b..eb57a8bee37fd 100644 --- a/tpool/task_group.cc +++ b/tpool/task_group.cc @@ -25,11 +25,26 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ #endif namespace tpool { - task_group::task_group(unsigned int max_concurrency) : + + /** + Task_group constructor + + @param max_threads - maximum number of threads allowed to execute + tasks from the group at the same time. + + @param enable_task_release - if true (default), task::release() will be + called after task execution.'false' should only be used in rare cases + when accessing memory, pointed by task structures, would be unsafe after. + the callback. Also 'false' is only possible ,if task::release() is a trivial function + */ + task_group::task_group(unsigned int max_concurrency, + bool enable_task_release) + : m_queue(8), m_mtx(), m_tasks_running(), - m_max_concurrent_tasks(max_concurrency) + m_max_concurrent_tasks(max_concurrency), + m_enable_task_release(enable_task_release) {}; void task_group::set_max_tasks(unsigned int max_concurrency) @@ -53,7 +68,8 @@ namespace tpool if (t) { t->m_func(t->m_arg); - t->release(); + if (m_enable_task_release) + t->release(); } lk.lock(); diff --git a/tpool/tpool.h b/tpool/tpool.h index 87a0122adcede..f0b2b9f67350b 100644 --- a/tpool/tpool.h +++ b/tpool/tpool.h @@ -68,8 +68,10 @@ class task_group std::condition_variable m_cv; unsigned int m_tasks_running; unsigned int m_max_concurrent_tasks; + const bool m_enable_task_release; + public: - task_group(unsigned int max_concurrency= 100000); + task_group(unsigned int max_concurrency= 100000, bool m_enable_task_release= true); void set_max_tasks(unsigned int max_concurrent_tasks); void execute(task* t); void cancel_pending(task *t); @@ -231,6 +233,20 @@ class thread_pool m_aio.reset(create_simulated_aio(this)); return !m_aio ? -1 : 0; } + + int reconfigure_aio(bool use_native_aio, int max_io) + { + assert(m_aio); + if (use_native_aio) + { + auto new_aio = create_native_aio(max_io); + if (!new_aio) + return -1; + m_aio.reset(new_aio); + } + return 0; + } + void disable_aio() { m_aio.reset(); diff --git a/tpool/tpool_structs.h b/tpool/tpool_structs.h index b49204f2d75ac..4690a6151744a 100644 --- a/tpool/tpool_structs.h +++ b/tpool/tpool_structs.h @@ -1,4 +1,4 @@ -/* Copyright(C) 2019 MariaDB Corporation +/* Copyright(C) 2019, 20222, MariaDB Corporation. This program is free software; you can redistribute itand /or modify it under the terms of the GNU General Public License as published by @@ -130,6 +130,11 @@ template class cache return m_cache[m_pos++]; } + std::mutex& mutex() + { + return m_mtx; + } + /** Put back an item to cache. @param item - item to put back @@ -154,16 +159,6 @@ template class cache return ele >= &m_base[0] && ele <= &m_base[capacity() - 1]; } - /** Wait until cache is full.*/ - void wait() - { - std::unique_lock lk(m_mtx); - m_waiters++; - while(!is_full()) - m_cv.wait(lk); - m_waiters--; - } - /** @return approximate number of "borrowed" items. A "dirty" read, not used in any critical functionality. @@ -172,6 +167,33 @@ template class cache { return m_pos; } + + /** Wait until cache is full + @param[in] lk - lock for the cache mutex + (which can be obtained with mutex()) */ + void wait(std::unique_lock &lk) + { + m_waiters++; + while (!is_full()) + m_cv.wait(lk); + m_waiters--; + } + + /* Wait until cache is full.*/ + void wait() + { + std::unique_lock lk(m_mtx); + wait(lk); + } + + void resize(size_t count) + { + assert(is_full()); + m_base.resize(count); + m_cache.resize(count); + for (size_t i = 0; i < count; i++) + m_cache[i] = &m_base[i]; + } };