diff options
518 files changed, 8678 insertions, 4768 deletions
diff --git a/.gitignore b/.gitignore index 93a132b3d83..2fb3857120c 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 @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=10 -MYSQL_VERSION_MINOR=10 -MYSQL_VERSION_PATCH=4 +MYSQL_VERSION_MINOR=11 +MYSQL_VERSION_PATCH=3 SERVER_MATURITY=stable diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 8942ee6d1dc..67cf008d732 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: @@ -3690,7 +3653,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 5c1a3d55880..10f74fbb021 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)); @@ -3477,21 +3543,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); if (init) { @@ -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 bf41fa3b0b2..8107bd03a3b 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 @@ do_handle_error: 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 4811eec8f8c..d02f2952cfe 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -163,7 +163,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 e1c764692bc..00000000000 --- 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/mariadb.conf.d/50-server.cnf b/debian/additions/mariadb.conf.d/50-server.cnf index aa61301297e..5e958e9e697 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-10.11 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-10.11] diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index fde6cba4532..68a8ce34283 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 } @@ -137,7 +137,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 2f98eccffce..af6536d9be9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -mariadb (1:10.10.0) unstable; urgency=medium +mariadb (1:10.11.0) unstable; urgency=medium * Initial Release diff --git a/debian/control b/debian/control index 8886da40fdf..91766d64b3e 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 563c05a3a6b..47298832bcf 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 3f7d7e9ecfb..dbfde133135 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 94eafa766a4..79f6cb793c2 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 8184923cf9a..ccca4e2d355 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 6c76162573d..b62907c3469 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 1a07a3fea94..4eee370672a 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 254e9cc8945..2350196e9d3 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 11e4480c427..00000000000 --- 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 2da1c736dec..a5ab6e8e1dc 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 85e40a8b429..b73e31029e6 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 5bac3d60cac..d09cfe3c537 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 f209b2394b7..c0d08565616 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 5d5766a95c7..0eb80bfb41f 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 2392df2be4d..77a8147f470 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 740a7871a2e..306ab27271d 100644 --- a/debian/source/lintian-overrides +++ b/debian/source/lintian-overrides @@ -4,28 +4,25 @@ 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 Replaces ${source:Version} libmariadbd-dev -> libmariadbclient-dev [debian/control:232] +version-substvar-for-external-package Conflicts (line 408) ${source:Version} mariadb-client -> mariadb-client-10.11 +version-substvar-for-external-package Conflicts (line 575) ${source:Version} mariadb-server-core -> mariadb-server-core-10.11 +version-substvar-for-external-package Conflicts (line 711) ${source:Version} mariadb-server -> mariadb-server-10.11 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 +version-substvar-for-external-package Replaces (line 330) ${source:Version} mariadb-client-core -> mariadb-client-10.11 +version-substvar-for-external-package Replaces (line 330) ${source:Version} mariadb-client-core -> mariadb-server-core-10.11 +version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-client-10.11 +version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-client-core-10.11 +version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-server-10.11 +version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-server-core-10.11 +version-substvar-for-external-package Replaces (line 626) ${source:Version} mariadb-server-core -> mariadb-client-10.11 +version-substvar-for-external-package Replaces (line 626) ${source:Version} mariadb-server-core -> mariadb-server-10.11 +version-substvar-for-external-package Replaces (line 748) ${source:Version} mariadb-server -> mariadb-client-10.11 +version-substvar-for-external-package Replaces (line 748) ${source:Version} mariadb-server -> mariadb-server-10.11 # 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 +103,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 ae7d4583c69..69448586b33 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/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 20f87354fd0..b925b41552d 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 01e4d83e344..086d4078e31 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 34b345a0dca..009ae74bb5c 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1368,7 +1368,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 +1383,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 +1412,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}, @@ -3871,85 +3871,6 @@ next_datadir_item: 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<byte*> - (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() { @@ -4002,14 +3923,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 6c58d64165d..d2a5e31645b 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA #include <set> #define XB_TOOL_NAME "mariadb-backup" +#define XB_HISTORY_TABLE "mysql.mariadb_backup_history" struct xb_delta_info_t { diff --git a/man/mysqladmin.1 b/man/mysqladmin.1 index a3b6b167179..da25123a219 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 05376046259..8dd814d34ab 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 04efe7e4de7..9bb6fdadca1 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 4a1af2a4553..078f6572bed 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 0a49ae13d4b..1d65549f8f4 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 467c1170563..b3e96d160fa 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/include/world.inc b/mysql-test/include/world.inc index 1e81c5c1aa7..1451a4ab3b5 100644 --- a/mysql-test/include/world.inc +++ b/mysql-test/include/world.inc @@ -214,7 +214,7 @@ INSERT IGNORE INTO Country VALUES ('TCD','Chad',1284000.00,7651000,3337), ('CZE','Czech Republic',78866.00,10278100,3339), ('TUN','Tunisia',163610.00,9586000,3349), -('TUR','Turkey',774815.00,66591000,3358), +('TUR','Türkiye',774815.00,66591000,3358), ('TKM','Turkmenistan',488100.00,4459000,3419), ('TCA','Turks and Caicos Islands',430.00,17000,3423), ('TUV','Tuvalu',26.00,12000,3424), diff --git a/mysql-test/main/analyze_format_json.result b/mysql-test/main/analyze_format_json.result index 6c9b8ce2982..9a756782f96 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": "<union1,2>", @@ -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<t1.a order by t2.c limit 1) from t1 where t1.a<0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, diff --git a/mysql-test/main/analyze_stmt_orderby.result b/mysql-test/main/analyze_stmt_orderby.result index d4d0fe6b25b..76bc4d964b8 100644 --- a/mysql-test/main/analyze_stmt_orderby.result +++ b/mysql-test/main/analyze_stmt_orderby.result @@ -35,6 +35,9 @@ analyze format=json update t2 set b=b+1 order by b limit 5; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_total_time_ms": "REPLACED", @@ -89,6 +92,9 @@ analyze format=json update t2 set a=a+1 where a<10; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_total_time_ms": "REPLACED", @@ -137,6 +143,9 @@ analyze format=json delete from t2 order by b limit 5; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_total_time_ms": "REPLACED", @@ -208,6 +217,9 @@ analyze format=json select * from t0,t2 where t2.a=t0.a order by t2.b limit 4; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -308,6 +320,9 @@ analyze format=json select * from t0,t2 where t2.a=t0.a order by t0.a limit 4; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -376,6 +391,9 @@ analyze format=json select MAX(b) from t2 where mod(a,2)=0 group by c; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -436,6 +454,9 @@ analyze format=json select distinct max(t3.b) Q from t0, t3 where t0.a=t3.a group by t0.a order by null; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -500,6 +521,9 @@ where t5.a=t6.a and t6.b > 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 00000000000..ab5aaff9454 --- /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 00000000000..d0e14413124 --- /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 00000000000..752c8d1a37a --- /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 3fd19ef968a..f87afdc0f47 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/concurrent_innodb_safelog.result b/mysql-test/main/concurrent_innodb_safelog.result index 7d120547570..40f89c7c65b 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 9ae80328c0b..3771438bc66 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/create_drop_role.result b/mysql-test/main/create_drop_role.result index b7ec45daeae..7f43751c007 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 e7170632fd6..4e96af97326 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 58221dde4fe..05c5d25ba15 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 96588d26b6c..7a982fcee9a 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 c6627c05829..3e6d5009569 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 de9a979dd94..7fb0d5801c1 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 b41d48a7112..30fdf41cf67 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 67613603a72..d21af392261 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 3576c1fa356..268b111cd77 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 e25c1c89ad3..b256637ce26 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 8c936f3374a..5356f5fd0dc 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 5bdbbf0f8f1..5952097a8d2 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 cd5b6911542..2fe39a6cf2d 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 3dc4e1c9470..d83623370d5 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": "<except1,2>", @@ -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": "<except1,2>", @@ -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 ac032221cc5..df19abda077 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": "<except1,2>", @@ -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 cf1aa172146..3c3c0688ab8 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 07e4ec09ad4..17e2da4754c 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 f164006d756..b76fe29625e 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_notembedded.result b/mysql-test/main/flush_notembedded.result index 25ddeba17d3..b0fa8a6dfbc 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 af3b8a00c55..193ac026cb4 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 585e927a0d4..d89bf9f075a 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 a243967a9c7..69bb050778d 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 b0ad2998198..6ba7ddf1e0a 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 b8098488709..2866aeb348a 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 3d0af8a4369..66f081a5689 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 5337d59efd8..7842233d9bd 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 1ecfc308422..daf382d65d3 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 d6f343d6459..0fde04ac0f3 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 185325f03a6..18d97cc412f 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 25ffa3767ba..f42bb24fe83 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 7c867078f8f..e46014e44b9 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 6a6e5c49851..725b1a125ad 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 e60557a9526..fabc42e38b8 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 7c73c312bd7..1d00c992e5c 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 81aef66bfcd..e1c64d4bacd 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 35f12510556..b5b43db71ce 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 <created> <modified> 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 <created> +LAST_ALTERED <modified> +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 <created> +LAST_ALTERED <modified> +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 <created> +LAST_ALTERED <modified> +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 <created> +LAST_ALTERED <modified> +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 <modified> +Created <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 <modified> +Created <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 <modified> +Created <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 <modified> +Created <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 <modified> +Created <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 <modified> +Created <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 a07e54cd70b..f9512409811 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 <created> 25 <modified> +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 <created> 25 <modified> +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 <created> 25 <modified> +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 <created> 25 <modified> +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 <modified> 6 <created> +query_vertical SHOW FUNCTION STATUS LIKE 'test_func5'; +--replace_column 5 <modified> 6 <created> +query_vertical SHOW FUNCTION STATUS LIKE 'test_%'; +--replace_column 5 <modified> 6 <created> +query_vertical SHOW FUNCTION STATUS LIKE '%func%'; +--replace_column 5 <modified> 6 <created> +query_vertical SHOW FUNCTION STATUS LIKE 'test'; +--replace_column 5 <modified> 6 <created> +query_vertical SHOW PROCEDURE STATUS LIKE 'процедурка'; +--replace_column 5 <modified> 6 <created> +query_vertical SHOW PROCEDURE STATUS LIKE '%оцедурка'; +--replace_column 5 <modified> 6 <created> +query_vertical SHOW PROCEDURE STATUS LIKE '%оцедур%'; +--replace_column 5 <modified> 6 <created> +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 11bb6036156..876a6a14b4e 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 e96d02fe0d1..c210ea10850 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 c7858b49cd4..425f6940a35 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": "<intersect1,2,3>", @@ -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": "<intersect1,2>", @@ -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 6c7a9c1cdd2..aecd5b1ac18 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": "<intersect1,2,3>", @@ -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": "<intersect1,2>", @@ -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 b1b313072b2..f0992baf7b1 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 aeca66b97d2..b27071ada56 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 d2e40c391c4..86e40736f11 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 fd54ea72a5a..04ea5f14be1 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 b32a278d3a1..819eaf48dbb 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -1000,7 +1000,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -1200,7 +1200,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -1459,7 +1459,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -1656,7 +1656,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -1853,7 +1853,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -2050,7 +2050,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -2694,7 +2694,7 @@ SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND City.Population > 3000000; Name Name Alexandria Egypt -Ankara Turkey +Ankara Türkiye Baghdad Iraq Bangkok Thailand Berlin Germany @@ -2708,7 +2708,7 @@ Delhi India Dhaka Bangladesh Harbin China Ho Chi Minh City Vietnam -Istanbul Turkey +Istanbul Türkiye Jakarta Indonesia Jokohama [Yokohama] Japan Kanton [Guangzhou] China @@ -2751,7 +2751,7 @@ SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND City.Population > 3000000; Name Name Alexandria Egypt -Ankara Turkey +Ankara Türkiye Baghdad Iraq Bangkok Thailand Berlin Germany @@ -2765,7 +2765,7 @@ Delhi India Dhaka Bangladesh Harbin China Ho Chi Minh City Vietnam -Istanbul Turkey +Istanbul Türkiye Jakarta Indonesia Jokohama [Yokohama] Japan Kanton [Guangzhou] China @@ -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 30cd63e60ed..52196d835ec 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 47a7e58ea0d..8137300f3e3 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 6b9fddb7fb6..8f2d3194a27 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 d2e314cf667..f79a406a964 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 57b637de587..52b479b66f7 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 0c082bf6fb4..301744a1f11 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 2440ff351ea..511be75e131 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 c400dbf3fb9..fd3bf6d24b0 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 00000000000..06d3d677977 --- /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 00000000000..a6b98f97058 --- /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 744c982b291..edcc69aaeb7 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 fc67b66d3ca..0dc75af3914 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_to_100502.result b/mysql-test/main/mysql_upgrade_to_100502.result index 15095809092..7235b16aa5a 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 b5a44080f17..fc47f0c94aa 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 6f0b4dd40b6..4587ac572b0 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 2093f8d2fa0..f7c7b2c677e 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 ca815a518c7..a360ba3f1e7 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 4d9ca93012b..d7bbb3d45fe 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 #<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX Query thread_id=TID exec_time=x error_code=0 xid=<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 5f3e82648c6..b2790e5a079 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 337755252ba..a43d7f0d86c 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 c92c1cd3cd2..5720988df2f 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 9bf53c7200b..a73562e4249 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 00000000000..945791790c0 --- /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 00000000000..b1886174153 --- /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 3f8d1c404d7..13fc0cc9fe6 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 238d90e4cdc..7819c005aa8 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 0b952f93ad8..19e862e07a5 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 20f75db25d5..079c0c85bcd 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 a5ac8956b2f..be6c2998927 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 b6345cd142e..1311f42dac2 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 e34b1a4a90a..6b33d7d8202 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_symlink.result b/mysql-test/main/partition_symlink.result index 17ddecbe19d..06aef8ea4c6 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 07d653ee4d6..5eba9658b1c 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 ac10bd06707..12a5156eeb1 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 48f35ac65e2..1c471cab9b5 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 24c86f1e2a8..d33662ab618 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 1c53da59844..100670dc8e7 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 de3023a3e42..c4ec8c0a364 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 17e627ab773..bed5eec59e9 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 63cd7789de4..dbe078e7d1b 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 95000d2d7e0..411b15600e1 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 00000000000..380e07a7b7e --- /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 00000000000..fb175820ee0 --- /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 00000000000..18a45a1231f --- /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 00000000000..9465cc9bfad --- /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 83dfada5f29..65cc12ffce9 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 5314b11154f..107a67c31fa 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 abfc5322ed0..cfc8f2ecb17 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 4b00c32b185..e2c2979c393 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 5f1a4a1db76..bb55a9e328d 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, @@ -420,6 +426,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, @@ -563,6 +572,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, @@ -715,6 +727,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, @@ -885,6 +900,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, @@ -1031,6 +1049,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, @@ -1200,6 +1221,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, @@ -1373,6 +1397,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, @@ -1507,6 +1534,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, @@ -1647,6 +1677,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, @@ -1782,6 +1815,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, @@ -1925,6 +1961,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, @@ -2070,6 +2109,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, @@ -2483,6 +2525,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, @@ -2533,6 +2578,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, @@ -2608,6 +2656,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, @@ -2719,6 +2770,9 @@ nm like '3448%' ) and fl2 = 0; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "select_id": 1, "r_loops": 1, @@ -2782,6 +2836,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 990c6b4e894..e10ddd6658b 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 7e8266d2ab3..f0a362e9fe2 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 aae7cea40d1..cc191a014a1 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 56dac487117..5595fadd60b 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 dc8ae2aa66b..8506c4b9402 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": "<union1,2>", @@ -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": "<union1,2>", @@ -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": "<union1,2>", @@ -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": "<union1,2>", @@ -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 35428b34599..5058f6d6db0 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 15beaaf0401..2a001866186 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 5c62a95b34a..eb186dd7faf 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 13fdbd68a55..85f21835c92 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 6ac65302d47..31308cd6a2f 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 b1c5f05e618..bfcaff39253 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/statistics.result b/mysql-test/main/statistics.result index 5ecb439bacc..3aa9fd1d306 100644 --- a/mysql-test/main/statistics.result +++ b/mysql-test/main/statistics.result @@ -1368,7 +1368,7 @@ WORLD CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195 WORLD CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -1439,7 +1439,7 @@ WORLD CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195 WORLD CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -1451,7 +1451,7 @@ WORLD_INNODB CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195 WORLD_INNODB CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD_INNODB COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -1530,7 +1530,7 @@ WORLD_INNODB CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195 WORLD_INNODB CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD_INNODB COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 diff --git a/mysql-test/main/statistics_json.result b/mysql-test/main/statistics_json.result index 748287152b1..7587cff0d48 100644 --- a/mysql-test/main/statistics_json.result +++ b/mysql-test/main/statistics_json.result @@ -1728,7 +1728,7 @@ WORLD CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195 WORLD CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -1799,7 +1799,7 @@ WORLD CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195 WORLD CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -1811,7 +1811,7 @@ WORLD_INNODB CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195 WORLD_INNODB CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD_INNODB COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -3529,7 +3529,7 @@ WORLD_INNODB CITY Name A Coruña (La Coruña) Ürgenc 0.0000 8.6416 1.0195 WORLD_INNODB CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD_INNODB COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index d00f7ccd690..5589272d066 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 e859ebbd2e8..5c2fd3e66fc 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 31a334878ec..2ed1e8ae618 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 8055211e5b2..b99b8678b1a 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 214b7ee572d..8e48c2accb7 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 b90b5c86c15..e6d973d53ee 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": "<union1,2>", @@ -1747,6 +1753,9 @@ union select 1,2; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "<union1,2>", @@ -1781,6 +1790,9 @@ union values (1,2),(3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "<union1,2>", @@ -1828,6 +1840,9 @@ union values (1,2); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "<union1,2,3>", @@ -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": "<union1,2>", @@ -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 07197329e10..331cfb8b7db 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 acb34754caa..1cb4f9c03e8 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 36524febd8d..10e15ca3c9c 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 6743f340a19..024f0482e6f 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 757b20e0ce0..2d34f78e006 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 12cca9f12b3..8ee5d189f77 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 370035147a1..3754a55eea8 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 <derived2> 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 83bbeb3be77..9094c616a1f 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 3b323d8a600..21f2dbccd33 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 2d8f6ccae1e..d77856f6b5b 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 0a5e8693b6b..da03a15d8b7 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 8d5eba3df38..a3ee1137e98 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 670f63a990f..b9e338a4b8d 100755 --- a/mysql-test/mariadb-test-run.pl +++ b/mysql-test/mariadb-test-run.pl @@ -1770,7 +1770,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; } @@ -3133,9 +3134,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 c358cfcd4f2..00000000000 --- 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 a79ae45981e..e325feb508b 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 b366bde4daf..1b60e50c09d 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 af4c02411d5..edf705614eb 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 11abd6e8973..96b3ca97da5 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 816084d7464..b793887af0a 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 65e2f824e39..1340337c0bd 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 3f838c8c369..ec145fa4059 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 5a27afaae71..5735b9b804d 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 bf114d8cfa9..bb4d318bdd4 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=<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=<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=<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=<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=<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=<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 6d10d5420e4..c02912b85d9 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 fe08f6e9fe9..a0cf5b2dcdb 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=<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=<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 c78365a847e..f9dc5d64753 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 8425e0ad17a..7fcde14d3ee 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 da08f814783..2eac49397a9 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 9a173d9a96e..1084970d11a 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 9a173d9a96e..1084970d11a 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 0fa35d57745..dd0cdd0f82e 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 ec8d2aeccd2..d573281f691 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 25889bb59ad..6aab8f0eb8f 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 37f1cb3b2b8..78136b90d0e 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 2614020b7a9..583d9a30a5a 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=<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=<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=<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/compat/oracle/r/table_value_constr.result b/mysql-test/suite/compat/oracle/r/table_value_constr.result index 365edaa7757..af071433d0f 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": "<union1,2>", @@ -1745,6 +1751,9 @@ union select 1,2; ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "<union1,2>", @@ -1779,6 +1788,9 @@ union values (1,2),(3,4); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "<union1,2>", @@ -1826,6 +1838,9 @@ union values (1,2); ANALYZE { + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, "query_block": { "union_result": { "table_name": "<union1,2,3>", @@ -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": "<union1,2>", @@ -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 4e0dcc05514..ca3c40bb7f9 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/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result index 04897ef3105..46cfb3b58ec 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/engines/funcs/r/rpl_sp.result b/mysql-test/suite/engines/funcs/r/rpl_sp.result index 264a1505275..945db68d8dd 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 650fe1db9e0..492e9ac3ac3 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 55756329ff3..f2e2247bae1 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 3bbd26a948d..37e77e81a28 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 267d3c272b9..6ddd966d7a9 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 367b1b1ede4..acf12ce5d39 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 99a4340c571..90bc19f2784 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 c2f0bb4a2f0..f0f1777bcbd 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 457d98d572f..51f4eca4f1a 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 d551575960e..281e4e8d0f6 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 2a57496800e..52820d6b0cd 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 95fc5ae59c3..267bb56331c 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 3a8fbac9170..f2e3d7aef53 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 1492bd26b5d..e30bd86833f 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 1b293444b27..51477e441ad 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 dfd663a6a96..be2a3d45432 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 1c8f50df7ce..69f78a98711 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 2b285395cff..774b65b03bc 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 ff33306b8f9..1851c089b04 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 9f129caa5bf..fd7a86d4a42 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 516d1cc04dd..4a18f7a0aba 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 4729ddf0d3a..b08f7202a3b 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 = <engine_type>; @@ -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 4228c744e46..a2a6838358a 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 97ce2d915d8..6a86e7464a0 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 136126d8ab5..f64562aadd1 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 18d55140d67..c1c1c6f8f40 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 684685480c2..9397e0766ef 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 ceae360946c..c9a15b46aba 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 c9d6454dc5b..c37266bb40c 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 18d55140d67..c1c1c6f8f40 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 b44cdb7a007..b16beda5752 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 ceae360946c..c9a15b46aba 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 c9d6454dc5b..c37266bb40c 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 126bf44f7eb..2bba1c06162 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 95c706b3f25..94bc1544c07 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 bed3f633212..0fea9dd351c 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 0881b4bdf77..3ae45e23cb8 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 fdf09a6f94b..8d0ec916f6f 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 3d7f23a7b2c..9f317eee55c 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 <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 3af56ad2533..814e4db97fb 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 f48d1979f77..c16737afab3 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 2f0ad2c1ccc..3b2ffc57aa3 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 9e6d8598e6f..1170bb7811d 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 e56a5972ce6..6566cd6fd4e 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 9988e1cafc2..8e3dff9b018 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 e2efa5774fa..6479439467a 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 bd6bee9bcf2..bc73511a2ea 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 2f72ba64bfd..35c0ec76eba 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 71471696761..81281156150 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 0aeb46896a6..7169f160fb8 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 24a0bd66b39..27bdf19f256 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 56b35150d87..4244e4c85ad 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 4146192bb55..8f85a838c5d 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=<TIMESTAMP>/*!*/; SET @@session.pseudo_thread_id=<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 e7e18ca8145..0928c62f23b 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 19bc9be62b0..fccef1637f6 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 30bc85fcea0..4947a446e9e 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 6708e30bf0f..c76981aae29 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_read_only.test b/mysql-test/suite/galera/t/galera_read_only.test index 56fe2fdd910..8d8a8cf88aa 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 3005562db9c..e71ca42f2d8 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/innodb/include/have_undo_tablespaces.inc b/mysql-test/suite/innodb/include/have_undo_tablespaces.inc deleted file mode 100644 index 87830a4a5f0..00000000000 --- 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/r/log_file.result b/mysql-test/suite/innodb/r/log_file.result index 734e9b07687..f5e98d30b30 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/partition_locking.result b/mysql-test/suite/innodb/r/partition_locking.result index 56bfe388517..f25b8a15a24 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/undo_truncate.result b/mysql-test/suite/innodb/r/undo_truncate.result index 5be1e5c3426..b7729020aca 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 909771e6a17..4d75712060a 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 00000000000..12d6f30e1d8 --- /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 00000000000..9c464459b98 --- /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/log_file.test b/mysql-test/suite/innodb/t/log_file.test index 438fbe1a6e1..805a4b4cd56 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/partition_locking.test b/mysql-test/suite/innodb/t/partition_locking.test index e33df934a28..13457c1d9be 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/undo_truncate.test b/mysql-test/suite/innodb/t/undo_truncate.test index 19829ce21e7..a5e0a52f798 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 e499ff3dfbe..1b27b0fe6e4 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 00000000000..87bc4c4d7f7 --- /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 00000000000..952d8b72b69 --- /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 00000000000..e274d6c020d --- /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/mariabackup/full_backup.result b/mysql-test/suite/mariabackup/full_backup.result index e69d00f86f6..1d0dffd528d 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 a0243527438..fb043f63be0 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/skip_innodb.test b/mysql-test/suite/mariabackup/skip_innodb.test index 14e4bc007f6..25495b308b0 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 00000000000..7b77e9ff6e6 --- /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 00000000000..3d599269782 --- /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_history.result b/mysql-test/suite/mariabackup/xb_history.result index b6a1ac21147..9feb5f41bd2 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 54ec5f2e729..f9374a1aaab 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 c19620b46cc..a35a20bdbf7 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 <read_master_log_pos> relay.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> 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 <read_master_log_pos> relay-master@00202@002e2.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space2> 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 <read_master_log_pos> relay.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> 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 <read_master_log_pos> relay-master@00202@002e2.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space2> 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 <read_master_log_pos> relay.000004 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> 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 <read_master_log_pos> relay-master@00202@002e2.000004 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space2> 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 <read_master_log_pos> relay.000004 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> 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 <read_master_log_pos> relay-master@00202@002e2.000004 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space2> 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 25cd85d7018..355919def5a 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_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_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 00000000000..a22ddacd30f --- /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 00000000000..3be8b364593 --- /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 00000000000..e1bbfabe180 --- /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 a55a6ec235f..2e9ce5e896f 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 <read_master_log_pos> mysqld-relay-bin-master1.000002 <relay_log_pos> master-bin.000001 No No 0 0 <read_master_log_pos> <relay_log_space> 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 <read_master_log_pos> mysqld-relay-bin-master1.000002 <relay_log_pos> master-bin.000001 No No 0 0 <read_master_log_pos> <relay_log_space> 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 <relay_log_pos> No No 0 0 0 <relay_log_space> 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 <relay_log_pos> No No 0 0 0 <relay_log_space> 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 5a167907b3b..65c25b88e44 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_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_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_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_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_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_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_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 35f4b3048ad..3c7c91c35c8 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 e6276fe3ca2..11707767594 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/partition_exch_qa_7_innodb.result b/mysql-test/suite/parts/r/partition_exch_qa_7_innodb.result index 0913bbaa55b..4613a2fd064 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 0913bbaa55b..4613a2fd064 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/perfschema/include/event_aggregate_load.inc b/mysql-test/suite/perfschema/include/event_aggregate_load.inc index b27a3113318..a4815eafd0f 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 aa61eb306a2..6db8f3585d0 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 d0415cf8df6..079c71345b1 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 8dc064babff..c6c8b6cc77b 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 4ad4c773941..805378f5850 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 9ce3bb7efe8..30948c2e611 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 6590c162dda..956ea6c6488 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 b7cf3b8a5ce..fbaa9a8d83f 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 24de36da22b..af535623e9a 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 2f0c96d7234..1209d37667e 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 618201d9b85..39da9783c96 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 d6dd322a70c..818c61e0630 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 df98b9bd1bb..31e1751d7b9 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 79d69b87ca7..75b018426bc 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 94cc2b33b49..6dd885281b3 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 344526bbd63..aa18efc928f 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 c703badef85..2d2c2ce266e 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 07028e1fb81..bb96d690763 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 4217de0d723..430d6eed5dc 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 a0af41e0372..06e7cdf0cae 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 2d8e41595d1..4cbaad0de6b 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 0fcbb41ebe0..b0acc311843 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 d1ecd600d84..e506e3f80c1 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 b8588916169..ceb81690cd8 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 07c379a4b7f..6a4d21edbf2 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 66776e3bca7..c90d17188d6 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 9aa15885563..ea866d51030 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 fc9d98f5d0a..212f27fdf84 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 b663d341221..81fef9f7c96 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 1dd52cfde34..efababa96b9 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 86c98a5d5c3..d2a93cf1006 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 dbe108d1efa..c953e05fa68 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 131b787f6b9..f3a948421ed 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 59258731508..f5052702768 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 5048ccc2446..1beeaff7538 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 be2afb0ca66..892b6f75161 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 f43f692cc48..c60e0297af3 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/definer.result b/mysql-test/suite/roles/definer.result index 8b5e36d8b3c..091ba255bc6 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 c1e56f3f94b..4cd42d59b24 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 f65c97e0ee3..043f79f8f7f 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 c253ae1478b..a6c896c9d2d 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 a0ec2315cfc..e88ed45c492 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 940a3c9e0db..7642f2d69bf 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 daacd2ed250..0706b0a57bd 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 b94f55ae6fb..f6abc406018 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 318d9ced73e..d4d689b87e4 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 be31e645362..594ea059988 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 121aab4fe1d..94f7d7e95ba 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 7ae499a9cfc..21c5a74efe4 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 2c602ea53aa..37d86920f93 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 8fcbba1c4cd..2d0512ceb82 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 230029d9119..feae4121965 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 6a91d9d89de..f44ce43ac0b 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 093e2ae0c24..bc7f188a48e 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 205a7dbc9cf..752fb321225 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 dbcd58a224f..64791888964 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 00000000000..5720f647b90 --- /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 67251e2ef72..4dea26a5aeb 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 55a826b3213..645c86b317d 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 650fe1db9e0..492e9ac3ac3 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 d287bad4492..31ffd1ed371 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 5ef2b345eab..7e5232974f9 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 c4781bbbb3b..15d5f74fb6d 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 00000000000..5a8f8233a63 --- /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 00000000000..b06899bb12e --- /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 84059110136..cb165442c23 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 729f275bb0d..0ec57715f79 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 4ea7a2aff46..e097938f3c8 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 d4d582b92d5..421ea144678 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_file_io_threads_basic.result b/mysql-test/suite/sys_vars/r/innodb_file_io_threads_basic.result index 5ef7e1099e0..0442cee0551 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_read_io_threads_basic.result b/mysql-test/suite/sys_vars/r/innodb_read_io_threads_basic.result index f43fa81c0d0..6ec897cea02 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 a363f4292dd..b9e5e083a90 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 0bec3eb2b29..8291800afa3 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 7ef4931a288..00000000000 --- 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 93558fb6dd9..00000000000 --- 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 2c47106ecb3..00000000000 --- 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 707c4f2a058..00000000000 --- 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 8b5b06ee4b7..00000000000 --- 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 aa79a5a7b9d..00000000000 --- 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 e93f280dbb5..f9ac41293ab 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 8884546e92d..455390eb4fc 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 00000000000..2dfe3a65133 --- /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 fcf04f94476..14d16d9fc99 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 d4b25257da3..43c7a402cd5 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 e005fdabf8a..b1aec21fea7 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 44b310809f6..c6c1dea6657 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 3acd29b0c62..00000000000 --- 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 17dfdeea3f3..00000000000 --- 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 47bc780c96a..00000000000 --- 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 201b33c8edb..88a5713c659 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 cccf10a15eb..acda9643f32 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 42803695813..6eface8c097 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1349,7 +1349,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 @@ -1697,5 +1697,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 e018489446b..a632e049c5e 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 6d0d147a9db..f896421559c 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 8ba94d3ba77..38dc9d215b8 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 1b4e49f55be..23942418b07 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/t/automatic_sp_privileges_func.test b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test index fd2dbefe7f6..25fda7d664a 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_file_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test index c701c2ee171..802d7e836e7 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 c4c49d5bb20..148871478a7 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 d9556af37d1..9ee9f5ba619 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 41911d82ac5..958ae5d6c7a 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 77391df6b3c..00000000000 --- 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 5309456b3ef..00000000000 --- 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 bb90b29e5f4..00000000000 --- 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 9f1cf6351a0..00000000000 --- 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 3646743a9ae..00000000000 --- 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 bc3991aee7c..64141e3f91d 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 d6abef93aed..9e82f30c925 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 00000000000..27468051e62 --- /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 00000000000..7fbaab1f260 --- /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 71b25185549..00000000000 --- 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 3d58902ab8d..00000000000 --- 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 2b6ac309d6c..00000000000 --- 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 87a3e671b95..00000000000 --- 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 32420fc294a..c83c7f186cf 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 0c77dbff226..8dcc0279e72 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 00000000000..fffd7629887 --- /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 5e68d4df2e8..c9d68f15e57 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 7fea6c3d06e..c7fe141c19e 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 2645d0184e8..442d71c6a91 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 398e3b8be70..fadc896d185 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 23574f34da9..5d8380e0969 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 4a3f846ae49..febb19bf48e 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 3e0bc85cea7..a6ac9aad3ca 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 00000000000..8b6de96d1b4 --- /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 6f5153b4ec1..46ed8fad4cb 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 ddae6633337..fb996258124 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 4e8c91315c6..e6dcd1aeac6 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 dce1e0deced..fa5012b6efa 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 80e936b02f3..38f42a44587 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 e865ec3b9f6..078b621b31e 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 45ac3e62d7f..16e6af75dba 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 8c82d335ab2..f84f0aafb65 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 b7cf3d8e488..09be092d879 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 2307aa3934a..dc242e3a9cb 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 10b3eb3e9d6..38244eca35b 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 1c72ad9cc23..647e02043f2 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 c65eb7a8634..41d2707398b 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 10e1e80907e..0257946b786 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 3077d70c9c3..c9a5d522600 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 e77ba05cb5c..af13b76e74c 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 eeca4607ece..c45452cee8e 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 1aac71b132a..6b5be475e97 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/scripts/fill_help_tables.sql b/scripts/fill_help_tables.sql index caedfa461e0..f50512a449d 100644 --- a/scripts/fill_help_tables.sql +++ b/scripts/fill_help_tables.sql @@ -84,8 +84,8 @@ insert into help_category (help_category_id,name,parent_category_id,url) values insert into help_category (help_category_id,name,parent_category_id,url) values (49,'Replication',1,''); insert into help_category (help_category_id,name,parent_category_id,url) values (50,'Prepared Statements',1,''); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,9,'HELP_DATE','Help Contents generated from the MariaDB Knowledge Base on 23 January 2023.','',''); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,9,'HELP_VERSION','Help Contents generated for MariaDB 10.10 from the MariaDB Knowledge Base on 23 January 2023.','',''); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (1,9,'HELP_DATE','Help Contents generated from the MariaDB Knowledge Base on 10 February 2023.','',''); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (2,9,'HELP_VERSION','Help Contents generated for MariaDB 10.11 from the MariaDB Knowledge Base on 10 February 2023.','',''); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (3,2,'AREA','A synonym for ST_AREA.\n\nURL: https://mariadb.com/kb/en/polygon-properties-area/','','https://mariadb.com/kb/en/polygon-properties-area/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (4,2,'CENTROID','A synonym for ST_CENTROID.\n\nURL: https://mariadb.com/kb/en/centroid/','','https://mariadb.com/kb/en/centroid/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (5,2,'ExteriorRing','A synonym for ST_ExteriorRing.\n\nURL: https://mariadb.com/kb/en/polygon-properties-exteriorring/','','https://mariadb.com/kb/en/polygon-properties-exteriorring/'); @@ -195,9 +195,9 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, update help_topic set description = CONCAT(description, '\n+------------------------------------+---------------------------------------+\n| MAX_STATEMENT_TIME | Timeout, in seconds, for statements |\n| | executed by the user. See also |\n| | Aborting Statements that Exceed a |\n| | Certain Time to Execute. |\n+------------------------------------+---------------------------------------+\n\nIf any of these limits are set to 0, then there is no limit for that resource\nfor that user.\n\nHere is an example showing how to set an account\'s resource limits:\n\nALTER USER \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 10\n MAX_QUERIES_PER_HOUR 200;\n\nThe resources are tracked per account, which means \'user\'@\'server\'; not per\nuser name or per connection.\n\nThe count can be reset for all users using FLUSH USER_RESOURCES, FLUSH\nPRIVILEGES or mysqladmin reload.\n\nPer account resource limits are stored in the user table, in the mysql\ndatabase. Columns used for resources limits are named max_questions,\nmax_updates, max_connections (for MAX_CONNECTIONS_PER_HOUR), and\nmax_user_connections (for MAX_USER_CONNECTIONS).\n\nPassword Expiry\n---------------\n\nMariaDB starting with 10.4.3\n----------------------------\nBesides automatic password expiry, as determined by default_password_lifetime,\npassword expiry times can be set on an individual user basis, overriding the\nglobal setting, for example:\n\nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE INTERVAL 120 DAY;\nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE NEVER;\nALTER USER \'monty\'@\'localhost\' PASSWORD EXPIRE DEFAULT;\n\nSee User Password Expiry for more details.\n\nAccount Locking\n---------------\n\nMariaDB starting with 10.4.2\n----------------------------\nAccount locking permits privileged administrators to lock/unlock user\naccounts. No new client connections will be permitted if an account is locked\n(existing connections are not affected). For example:\n\nALTER USER \'marijn\'@\'localhost\' ACCOUNT LOCK;\n\nSee Account Locking for more details.\n\nFrom MariaDB 10.4.7 and MariaDB 10.5.8, the lock_option and password_option\nclauses can occur in either order.\n\nURL: https://mariadb.com/kb/en/alter-user/') WHERE help_topic_id = 106; insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (107,10,'DROP USER','Syntax\n------\n\nDROP USER [IF EXISTS] user_name [, user_name] ...\n\nDescription\n-----------\n\nThe DROP USER statement removes one or more MariaDB accounts. It removes\nprivilege rows for the account from all grant tables. To use this statement,\nyou must have the global CREATE USER privilege or the DELETE privilege for the\nmysql database. Each account is named using the same format as for the CREATE\nUSER statement; for example, \'jeffrey\'@\'localhost\'. If you specify only the\nuser name part of the account name, a host name part of \'%\' is used. For\nadditional information about specifying account names, see CREATE USER.\n\nNote that, if you specify an account that is currently connected, it will not\nbe deleted until the connection is closed. The connection will not be\nautomatically closed.\n\nIf any of the specified user accounts do not exist, ERROR 1396 (HY000)\nresults. If an error occurs, DROP USER will still drop the accounts that do\nnot result in an error. Only one error is produced for all users which have\nnot been dropped:\n\nERROR 1396 (HY000): Operation DROP USER failed for \'u1\'@\'%\',\'u2\'@\'%\'\n\nFailed CREATE or DROP operations, for both users and roles, produce the same\nerror code.\n\nIF EXISTS\n---------\n\nIf the IF EXISTS clause is used, MariaDB will return a note instead of an\nerror if the user does not exist.\n\nExamples\n--------\n\nDROP USER bob;\n\nDROP USER foo2@localhost,foo2@\'127.%\';\n\nIF EXISTS:\n\nDROP USER bob;\nERROR 1396 (HY000): Operation DROP USER failed for \'bob\'@\'%\'\n\nDROP USER IF EXISTS bob;\nQuery OK, 0 rows affected, 1 warning (0.00 sec)\n\nSHOW WARNINGS;\n+-------+------+---------------------------------------------+\n| Level | Code | Message |\n+-------+------+---------------------------------------------+\n| Note | 1974 | Can\'t drop user \'bob\'@\'%\'; it doesn\'t exist |\n+-------+------+---------------------------------------------+\n\nURL: https://mariadb.com/kb/en/drop-user/','','https://mariadb.com/kb/en/drop-user/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (108,10,'GRANT','Syntax\n------\n\nGRANT\n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n TO user_specification [ user_options ...]\n\nuser_specification:\n username [authentication_option]\n | PUBLIC\nauthentication_option:\n IDENTIFIED BY \'password\'\n | IDENTIFIED BY PASSWORD \'password_hash\'\n | IDENTIFIED {VIA|WITH} authentication_rule [OR authentication_rule ...]\n\nauthentication_rule:\n authentication_plugin\n | authentication_plugin {USING|AS} \'authentication_string\'\n | authentication_plugin {USING|AS} PASSWORD(\'password\')\n\nGRANT PROXY ON username\n TO user_specification [, user_specification ...]\n [WITH GRANT OPTION]\n\nGRANT rolename TO grantee [, grantee ...]\n [WITH ADMIN OPTION]\n\ngrantee:\n rolename\n username [authentication_option]\n\nuser_options:\n [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]\n [WITH with_option [with_option] ...]\n\nobject_type:\n TABLE\n | FUNCTION\n | PROCEDURE\n | PACKAGE\n\npriv_level:\n *\n | *.*\n | db_name.*\n | db_name.tbl_name\n | tbl_name\n | db_name.routine_name\n\nwith_option:\n GRANT OPTION\n | resource_option\n\nresource_option:\n MAX_QUERIES_PER_HOUR count\n | MAX_UPDATES_PER_HOUR count\n | MAX_CONNECTIONS_PER_HOUR count\n | MAX_USER_CONNECTIONS count\n | MAX_STATEMENT_TIME time\n\ntls_option:\n SSL\n | X509\n | CIPHER \'cipher\'\n | ISSUER \'issuer\'\n | SUBJECT \'subject\'\n\nDescription\n-----------\n\nThe GRANT statement allows you to grant privileges or roles to accounts. To\nuse GRANT, you must have the GRANT OPTION privilege, and you must have the\nprivileges that you are granting.\n\nUse the REVOKE statement to revoke privileges granted with the GRANT statement.\n\nUse the SHOW GRANTS statement to determine what privileges an account has.\n\nAccount Names\n-------------\n\nFor GRANT statements, account names are specified as the username argument in\nthe same way as they are for CREATE USER statements. See account names from\nthe CREATE USER page for details on how account names are specified.\n\nImplicit Account Creation\n-------------------------\n\nThe GRANT statement also allows you to implicitly create accounts in some\ncases.\n\nIf the account does not yet exist, then GRANT can implicitly create it. To\nimplicitly create an account with GRANT, a user is required to have the same\nprivileges that would be required to explicitly create the account with the\nCREATE USER statement.\n\nIf the NO_AUTO_CREATE_USER SQL_MODE is set, then accounts can only be created\nif authentication information is specified, or with a CREATE USER statement.\nIf no authentication information is provided, GRANT will produce an error when\nthe specified account does not exist, for example:\n\nshow variables like \'%sql_mode%\' ;\n+---------------+--------------------------------------------+\n| Variable_name | Value |\n+---------------+--------------------------------------------+\n| sql_mode | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |\n+---------------+--------------------------------------------+\n\nGRANT USAGE ON *.* TO \'user123\'@\'%\' IDENTIFIED BY \'\';\nERROR 1133 (28000): Can\'t find any matching row in the user table\n\nGRANT USAGE ON *.* TO \'user123\'@\'%\' \n IDENTIFIED VIA PAM using \'mariadb\' require ssl ;\nQuery OK, 0 rows affected (0.00 sec)\n\nselect host, user from mysql.user where user=\'user123\' ;\n\n+------+----------+\n| host | user |\n+------+----------+\n| % | user123 |\n+------+----------+\n\nPrivilege Levels\n----------------\n\nPrivileges can be set globally, for an entire database, for a table or\nroutine, or for individual columns in a table. Certain privileges can only be\nset at certain levels.\n\n* Global privileges priv_type are granted using *.* for\npriv_level. Global privileges include privileges to administer the database\nand manage user accounts, as well as privileges for all tables, functions, and\nprocedures. Global privileges are stored in the mysql.user table prior to\nMariaDB 10.4, and in mysql.global_priv table afterwards.\n* Database privileges priv_type are granted using db_name.*\nfor priv_level, or using just * to use default database. Database\nprivileges include privileges to create tables and functions, as well as\nprivileges for all tables, functions, and procedures in the database. Database\nprivileges are stored in the mysql.db table.\n* Table privileges priv_type are granted using db_name.tbl_name\nfor priv_level, or using just tbl_name to specify a table in the default\ndatabase. The TABLE keyword is optional. Table privileges include the\nability to select and change data in the table. Certain table privileges can\nbe granted for individual columns.\n* Column privileges priv_type are granted by specifying a table for\npriv_level and providing a column list after the privilege type. They allow\nyou to control exactly which columns in a table users can select and change.\n* Function privileges priv_type are granted using FUNCTION db_name.routine_name\nfor priv_level, or using just FUNCTION routine_name to specify a function\nin the default database.\n* Procedure privileges priv_type are granted using PROCEDURE\ndb_name.routine_name\nfor priv_level, or using just PROCEDURE routine_name to specify a procedure\nin the default database.\n\nThe USAGE Privilege\n-------------------\n\nThe USAGE privilege grants no real privileges. The SHOW GRANTS statement will\nshow a global USAGE privilege for a newly-created user. You can use USAGE with\nthe GRANT statement to change options like GRANT OPTION and\nMAX_USER_CONNECTIONS without changing any account privileges.\n\nThe ALL PRIVILEGES Privilege\n----------------------------\n\nThe ALL PRIVILEGES privilege grants all available privileges. Granting all\nprivileges only affects the given privilege level. For example, granting all\nprivileges on a table does not grant any privileges on the database or\nglobally.\n\nUsing ALL PRIVILEGES does not grant the special GRANT OPTION privilege.\n\nYou can use ALL instead of ALL PRIVILEGES.\n\nThe GRANT OPTION Privilege\n--------------------------\n\nUse the WITH GRANT OPTION clause to give users the ability to grant privileges\nto other users at the given privilege level. Users with the GRANT OPTION\nprivilege can only grant privileges they have. They cannot grant privileges at\na higher privilege level than they have the GRANT OPTION privilege.\n\nThe GRANT OPTION privilege cannot be set for individual columns. If you use\nWITH GRANT OPTION when specifying column privileges, the GRANT OPTION\nprivilege will be granted for the entire table.\n\nUsing the WITH GRANT OPTION clause is equivalent to listing GRANT OPTION as a\nprivilege.\n\nGlobal Privileges\n-----------------\n\nThe following table lists the privileges that can be granted globally. You can\nalso grant all database, table, and function privileges globally. When granted\nglobally, these privileges apply to all databases, tables, or functions,\nincluding those created later.\n\nTo set a global privilege, use *.* for priv_level.\n\nBINLOG ADMIN\n------------\n\nEnables administration of the binary log, including the PURGE BINARY LOGS\nstatement and setting the system variables:\n\n* binlog_annotate_row_events\n* binlog_cache_size\n* binlog_commit_wait_count\n* binlog_commit_wait_usec\n* binlog_direct_non_transactional_updates\n* binlog_expire_logs_seconds\n* binlog_file_cache_size\n* binlog_format\n* binlog_row_image\n* binlog_row_metadata\n* binlog_stmt_cache_size\n* expire_logs_days\n* log_bin_compress\n* log_bin_compress_min_len\n* log_bin_trust_function_creators\n* max_binlog_cache_size\n* max_binlog_size\n* max_binlog_stmt_cache_size\n* sql_log_bin and\n* sync_binlog.\n\nAdded in MariaDB 10.5.2.\n\nBINLOG MONITOR\n--------------\n\nNew name for REPLICATION CLIENT from MariaDB 10.5.2, (REPLICATION CLIENT still\nsupported as an alias for compatibility purposes). Permits running SHOW\ncommands related to the binary log, in particular the SHOW BINLOG STATUS and\nSHOW BINARY LOGS statements. Unlike REPLICATION CLIENT prior to MariaDB 10.5,\nSHOW REPLICA STATUS isn\'t included in this privilege, and REPLICA MONITOR is\nrequired.\n\nBINLOG REPLAY\n-------------\n\nEnables replaying the binary log with the BINLOG statement (generated by\nmariadb-binlog), executing SET timestamp when secure_timestamp is set to\nreplication, and setting the session values of system variables usually\nincluded in BINLOG output, in particular:\n\n* gtid_domain_id\n* gtid_seq_no\n* pseudo_thread_id\n* server_id.\n\nAdded in MariaDB 10.5.2\n\nCONNECTION ADMIN\n----------------\n\nEnables administering connection resource limit options. This includes\nignoring the limits specified by:\n\n* max_connections\n* max_user_connections and\n* max_password_errors.\n\nThe statements specified in init_connect are not executed, killing connections\nand queries owned by other users is permitted. The following\nconnection-related system variables can be changed:\n\n* connect_timeout\n* disconnect_on_expired_password\n* extra_max_connections\n* init_connect\n* max_connections\n* max_connect_errors\n* max_password_errors\n* proxy_protocol_networks\n* secure_auth\n* slow_launch_time\n* thread_pool_exact_stats\n* thread_pool_dedicated_listener\n* thread_pool_idle_timeout\n* thread_pool_max_threads\n* thread_pool_min_threads\n* thread_pool_oversubscribe\n* thread_pool_prio_kickup_timer\n* thread_pool_priority\n* thread_pool_size, and\n* thread_pool_stall_limit.\n\nAdded in MariaDB 10.5.2.\n\nCREATE USER\n-----------\n\nCreate a user using the CREATE USER statement, or implicitly create a user\nwith the GRANT statement.\n\nFEDERATED ADMIN\n---------------\n\nExecute CREATE SERVER, ALTER SERVER, and DROP SERVER statements. Added in\nMariaDB 10.5.2.\n\nFILE\n----\n\nRead and write files on the server, using statements like LOAD DATA INFILE or\nfunctions like LOAD_FILE(). Also needed to create CONNECT outward tables.\nMariaDB server must have the permissions to access those files.\n\nGRANT OPTION\n------------\n\nGrant global privileges. You can only grant privileges that you have.\n\nPROCESS\n-------\n\nShow information about the active processes, for example via SHOW PROCESSLIST\nor mysqladmin processlist. If you have the PROCESS privilege, you can see all\nthreads. Otherwise, you can see only your own threads (that is, threads\nassociated with the MariaDB account that you are using).\n\nREAD_ONLY ADMIN\n---------------\n\nUser can set the read_only system variable and allows the user to perform\nwrite operations, even when the read_only option is active. Added in MariaDB\n10.5.2.\n\nFrom MariaDB 10.11.0, the READ_ONLY ADMIN privilege has been removed from\nSUPER. The benefit of this is that one can remove the READ_ONLY ADMIN\nprivilege from all users and ensure that no one can make any changes on any\nnon-temporary tables. This is useful on replicas when one wants to ensure that\nthe replica is kept identical to the primary.\n\nRELOAD\n------\n\nExecute FLUSH statements or equivalent mariadb-admin/mysqladmin commands.\n\nREPLICATION CLIENT\n------------------\n\nExecute SHOW MASTER STATUS and SHOW BINARY LOGS informative statements.\nRenamed to BINLOG MONITOR in MariaDB 10.5.2 (but still supported as an alias\nfor compatibility reasons). SHOW SLAVE STATUS was part of REPLICATION CLIENT\nprior to MariaDB 10.5.\n\nREPLICATION MASTER ADMIN\n------------------------\n\nPermits administration of primary servers, including the SHOW REPLICA HOSTS\nstatement, and setting the gtid_binlog_state, gtid_domain_id,\nmaster_verify_checksum and server_id system variables. Added in MariaDB 10.5.2.\n\nREPLICA MONITOR\n---------------\n\nPermit SHOW REPLICA STATUS and SHOW RELAYLOG EVENTS. From MariaDB 10.5.9.\n\nWhen a user would upgrade from an older major release to a MariaDB 10.5 minor\nrelease prior to MariaDB 10.5.9, certain user accounts would lose\ncapabilities. For example, a user account that had the REPLICATION CLIENT\nprivilege in older major releases could run SHOW REPLICA STATUS, but after\nupgrading to a MariaDB 10.5 minor release prior to MariaDB 10.5.9, they could\nno longer run SHOW REPLICA STATUS, because that statement was changed to\nrequire the REPLICATION REPLICA ADMIN privilege.\n\nThis issue is fixed in MariaDB 10.5.9 with this new privilege, which now\ngrants the user the ability to execute SHOW [ALL] (SLAVE | REPLICA) STATUS.\n\nWhen a database is upgraded from an older major release to MariaDB Server\n10.5.9 or later, any user accounts with the REPLICATION CLIENT or REPLICATION\nSLAVE privileges will automatically be granted the new REPLICA MONITOR\nprivilege. The privilege fix occurs when the server is started up, not when\nmariadb-upgrade is performed.\n\nHowever, when a database is upgraded from an early 10.5 minor release to\n10.5.9 and later, the user will have to fix any user account privileges\nmanually.\n\nREPLICATION REPLICA\n-------------------\n\nSynonym for REPLICATION SLAVE. From MariaDB 10.5.1.\n\nREPLICATION SLAVE\n-----------------\n\nAccounts used by replica servers on the primary need this privilege. This is\nneeded to get the updates made on the master. From MariaDB 10.5.1, REPLICATION\nREPLICA is an alias for REPLICATION SLAVE.\n\nREPLICATION SLAVE ADMIN\n-----------------------\n\nPermits administering replica servers, including START REPLICA/SLAVE, STOP\nREPLICA/SLAVE, CHANGE MASTER, SHOW REPLICA/SLAVE STATUS, SHOW RELAYLOG EVENTS\nstatements, replaying the binary log with the BINLOG statement (generated by\nmariadb-binlog), and setting the system variables:\n\n* gtid_cleanup_batch_size\n* gtid_ignore_duplicates\n* gtid_pos_auto_engines\n* gtid_slave_pos\n* gtid_strict_mode\n* init_slave\n* read_binlog_speed_limit\n* relay_log_purge\n* relay_log_recovery\n* replicate_do_db\n* replicate_do_table\n* replicate_events_marked_for_skip\n* replicate_ignore_db\n* replicate_ignore_table\n* replicate_wild_do_table\n* replicate_wild_ignore_table\n* slave_compressed_protocol\n* slave_ddl_exec_mode\n* slave_domain_parallel_threads\n* slave_exec_mode\n* slave_max_allowed_packet\n* slave_net_timeout\n* slave_parallel_max_queued\n* slave_parallel_mode\n* slave_parallel_threads\n* slave_parallel_workers\n* slave_run_triggers_for_rbr\n* slave_sql_verify_checksum\n* slave_transaction_retry_interval\n* slave_type_conversions\n* sync_master_info\n* sync_relay_log, and\n* sync_relay_log_info.\n\nAdded in MariaDB 10.5.2.\n\nSET USER\n--------\n','','https://mariadb.com/kb/en/grant/'); -update help_topic set description = CONCAT(description, '\nEnables setting the DEFINER when creating triggers, views, stored functions\nand stored procedures. Added in MariaDB 10.5.2.\n\nSHOW DATABASES\n--------------\n\nList all databases using the SHOW DATABASES statement. Without the SHOW\nDATABASES privilege, you can still issue the SHOW DATABASES statement, but it\nwill only list databases containing tables on which you have privileges.\n\nSHUTDOWN\n--------\n\nShut down the server using SHUTDOWN or the mysqladmin shutdown command.\n\nSUPER\n-----\n\nExecute superuser statements: CHANGE MASTER TO, KILL (users who do not have\nthis privilege can only KILL their own threads), PURGE LOGS, SET global system\nvariables, or the mysqladmin debug command. Also, this permission allows the\nuser to write data even if the read_only startup option is set, enable or\ndisable logging, enable or disable replication on replica, specify a DEFINER\nfor statements that support that clause, connect once reaching the\nMAX_CONNECTIONS. If a statement has been specified for the init-connect mysqld\noption, that command will not be executed when a user with SUPER privileges\nconnects to the server.\n\nThe SUPER privilege has been split into multiple smaller privileges from\nMariaDB 10.5.2 to allow for more fine-grained privileges, although it remains\nan alias for these smaller privileges.\n\nFrom MariaDB 10.11.0, the READ_ONLY ADMIN privilege has been removed from\nSUPER. The benefit of this is that one can remove the READ_ONLY ADMIN\nprivilege from all users and ensure that no one can make any changes on any\nnon-temporary tables. This is useful on replicas when one wants to ensure that\nthe replica is kept identical to the primary.\n\nDatabase Privileges\n-------------------\n\nThe following table lists the privileges that can be granted at the database\nlevel. You can also grant all table and function privileges at the database\nlevel. Table and function privileges on a database apply to all tables or\nfunctions in that database, including those created later.\n\nTo set a privilege for a database, specify the database using db_name.* for\npriv_level, or just use * to specify the default database.\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| CREATE | Create a database using the CREATE |\n| | DATABASE statement, when the privilege |\n| | is granted for a database. You can |\n| | grant the CREATE privilege on |\n| | databases that do not yet exist. This |\n| | also grants the CREATE privilege on |\n| | all tables in the database. |\n+----------------------------------+-----------------------------------------+\n| CREATE ROUTINE | Create Stored Programs using the |\n| | CREATE PROCEDURE and CREATE FUNCTION |\n| | statements. |\n+----------------------------------+-----------------------------------------+\n| CREATE TEMPORARY TABLES | Create temporary tables with the |\n| | CREATE TEMPORARY TABLE statement. This |\n| | privilege enable writing and dropping |\n| | those temporary tables |\n+----------------------------------+-----------------------------------------+\n| DROP | Drop a database using the DROP |\n| | DATABASE statement, when the privilege |\n| | is granted for a database. This also |\n| | grants the DROP privilege on all |\n| | tables in the database. |\n+----------------------------------+-----------------------------------------+\n| EVENT | Create, drop and alter EVENTs. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant database privileges. You can |\n| | only grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n| LOCK TABLES | Acquire explicit locks using the LOCK |\n| | TABLES statement; you also need to |\n| | have the SELECT privilege on a table, |\n| | in order to lock it. |\n+----------------------------------+-----------------------------------------+\n\nTable Privileges\n----------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| ALTER | Change the structure of an existing |\n| | table using the ALTER TABLE statement. |\n+----------------------------------+-----------------------------------------+\n| CREATE | Create a table using the CREATE TABLE |\n| | statement. You can grant the CREATE |\n| | privilege on tables that do not yet |\n| | exist. |\n+----------------------------------+-----------------------------------------+\n| CREATE VIEW | Create a view using the CREATE_VIEW |\n| | statement. |\n+----------------------------------+-----------------------------------------+\n| DELETE | Remove rows from a table using the |\n| | DELETE statement. |\n+----------------------------------+-----------------------------------------+\n| DELETE HISTORY | Remove historical rows from a table |\n| | using the DELETE HISTORY statement. |\n| | Displays as DELETE VERSIONING ROWS |\n| | when running SHOW GRANTS until MariaDB |\n| | 10.3.15 and until MariaDB 10.4.5 |\n| | (MDEV-17655), or when running SHOW |\n| | PRIVILEGES until MariaDB 10.5.2, |\n| | MariaDB 10.4.13 and MariaDB 10.3.23 |\n| | (MDEV-20382). From MariaDB 10.3.4. |\n| | From MariaDB 10.3.5, if a user has the |\n| | SUPER privilege but not this |\n| | privilege, running mysql_upgrade will |\n| | grant this privilege as well. |\n+----------------------------------+-----------------------------------------+\n| DROP | Drop a table using the DROP TABLE |\n| | statement or a view using the DROP |\n| | VIEW statement. Also required to |\n| | execute the TRUNCATE TABLE statement. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant table privileges. You can only |\n| | grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n| INDEX | Create an index on a table using the |\n| | CREATE INDEX statement. Without the |\n| | INDEX privilege, you can still create |\n| | indexes when creating a table using |\n| | the CREATE TABLE statement if the you |\n| | have the CREATE privilege, and you can |\n| | create indexes using the ALTER TABLE |\n| | statement if you have the ALTER |\n| | privilege. |\n+----------------------------------+-----------------------------------------+\n| INSERT | Add rows to a table using the INSERT |\n| | statement. The INSERT privilege can |\n| | also be set on individual columns; see |\n| | Column Privileges below for details. |\n+----------------------------------+-----------------------------------------+\n| REFERENCES | Unused. |\n+----------------------------------+-----------------------------------------+\n| SELECT | Read data from a table using the |\n| | SELECT statement. The SELECT privilege |\n| | can also be set on individual columns; |\n| | see Column Privileges below for |\n| | details. |\n+----------------------------------+-----------------------------------------+\n| SHOW VIEW | Show the CREATE VIEW statement to |\n| | create a view using the SHOW CREATE |\n| | VIEW statement. |\n+----------------------------------+-----------------------------------------+\n| TRIGGER | Execute triggers associated to tables |\n| | you update, execute the CREATE TRIGGER |\n| | and DROP TRIGGER statements. You will |\n| | still be able to see triggers. |\n+----------------------------------+-----------------------------------------+\n| UPDATE | Update existing rows in a table using |\n| | the UPDATE statement. UPDATE |\n| | statements usually include a WHERE |\n| | clause to update only certain rows. |\n| | You must have SELECT privileges on the |\n| | table or the appropriate columns for |\n| | the WHERE clause. The UPDATE privilege |\n| | can also be set on individual columns; |\n| | see Column Privileges below for |\n| | details. |\n+----------------------------------+-----------------------------------------+\n\nColumn Privileges\n-----------------\n\nSome table privileges can be set for individual columns of a table. To use\ncolumn privileges, specify the table explicitly and provide a list of column\nnames after the privilege type. For example, the following statement would\nallow the user to read the names and positions of employees, but not other\ninformation from the same table, such as salaries.\n\nGRANT SELECT (name, position) on Employee to \'jeffrey\'@\'localhost\';\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| INSERT (column_list) | Add rows specifying values in columns |\n| | using the INSERT statement. If you |\n| | only have column-level INSERT |\n| | privileges, you must specify the |\n| | columns you are setting in the INSERT |\n| | statement. All other columns will be |\n| | set to their default values, or NULL. |\n+----------------------------------+-----------------------------------------+\n| REFERENCES (column_list) | Unused. |\n+----------------------------------+-----------------------------------------+\n| SELECT (column_list) | Read values in columns using the |\n| | SELECT statement. You cannot access or |\n| | query any columns for which you do not |\n| | have SELECT privileges, including in |\n| | WHERE, ON, GROUP BY, and ORDER BY |\n| | clauses. |\n+----------------------------------+-----------------------------------------+\n| UPDATE (column_list) | Update values in columns of existing |\n| | rows using the UPDATE statement. |\n| | UPDATE statements usually include a |\n| | WHERE clause to update only certain |\n| | rows. You must have SELECT privileges |\n| | on the table or the appropriate |\n| | columns for the WHERE clause. |\n+----------------------------------+-----------------------------------------+\n\nFunction Privileges\n-------------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |') WHERE help_topic_id = 108; -update help_topic set description = CONCAT(description, '\n+----------------------------------+-----------------------------------------+\n| ALTER ROUTINE | Change the characteristics of a stored |\n| | function using the ALTER FUNCTION |\n| | statement. |\n+----------------------------------+-----------------------------------------+\n| EXECUTE | Use a stored function. You need SELECT |\n| | privileges for any tables or columns |\n| | accessed by the function. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant function privileges. You can |\n| | only grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n\nProcedure Privileges\n--------------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| ALTER ROUTINE | Change the characteristics of a stored |\n| | procedure using the ALTER PROCEDURE |\n| | statement. |\n+----------------------------------+-----------------------------------------+\n| EXECUTE | Execute a stored procedure using the |\n| | CALL statement. The privilege to call |\n| | a procedure may allow you to perform |\n| | actions you wouldn\'t otherwise be able |\n| | to do, such as insert rows into a |\n| | table. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant procedure privileges. You can |\n| | only grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n\nGRANT EXECUTE ON PROCEDURE mysql.create_db TO maintainer;\n\nProxy Privileges\n----------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| PROXY | Permits one user to be a proxy for |\n| | another. |\n+----------------------------------+-----------------------------------------+\n\nThe PROXY privilege allows one user to proxy as another user, which means\ntheir privileges change to that of the proxy user, and the CURRENT_USER()\nfunction returns the user name of the proxy user.\n\nThe PROXY privilege only works with authentication plugins that support it.\nThe default mysql_native_password authentication plugin does not support proxy\nusers.\n\nThe pam authentication plugin is the only plugin included with MariaDB that\ncurrently supports proxy users. The PROXY privilege is commonly used with the\npam authentication plugin to enable user and group mapping with PAM.\n\nFor example, to grant the PROXY privilege to an anonymous account that\nauthenticates with the pam authentication plugin, you could execute the\nfollowing:\n\nCREATE USER \'dba\'@\'%\' IDENTIFIED BY \'strongpassword\';\nGRANT ALL PRIVILEGES ON *.* TO \'dba\'@\'%\' ;\n\nCREATE USER \'\'@\'%\' IDENTIFIED VIA pam USING \'mariadb\';\nGRANT PROXY ON \'dba\'@\'%\' TO \'\'@\'%\';\n\nA user account can only grant the PROXY privilege for a specific user account\nif the granter also has the PROXY privilege for that specific user account,\nand if that privilege is defined WITH GRANT OPTION. For example, the following\nexample fails because the granter does not have the PROXY privilege for that\nspecific user account at all:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n+------------------------------------------------------------------------------\n----------------------------------------+\n\nGRANT PROXY ON \'dba\'@\'localhost\' TO \'bob\'@\'localhost\';\nERROR 1698 (28000): Access denied for user \'alice\'@\'localhost\'\n\nAnd the following example fails because the granter does have the PROXY\nprivilege for that specific user account, but it is not defined WITH GRANT\nOPTION:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO \'alice\'@\'localhost\' \n |\n+------------------------------------------------------------------------------\n----------------------------------------+\n\nGRANT PROXY ON \'dba\'@\'localhost\' TO \'bob\'@\'localhost\';\nERROR 1698 (28000): Access denied for user \'alice\'@\'localhost\'\n\nBut the following example succeeds because the granter does have the PROXY\nprivilege for that specific user account, and it is defined WITH GRANT OPTION:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT OPTION |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO \'alice\'@\'localhost\' WITH GRANT OPTION \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n\nGRANT PROXY ON \'dba\'@\'localhost\' TO \'bob\'@\'localhost\';\n\nA user account can grant the PROXY privilege for any other user account if the\ngranter has the PROXY privilege for the \'\'@\'%\' anonymous user account, like\nthis:\n\nGRANT PROXY ON \'\'@\'%\' TO \'dba\'@\'localhost\' WITH GRANT OPTION;\n\nFor example, the following example succeeds because the user can grant the\nPROXY privilege for any other user account:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT OPTION |\n| GRANT PROXY ON \'\'@\'%\' TO \'alice\'@\'localhost\' WITH GRANT OPTION \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n\nGRANT PROXY ON \'app1_dba\'@\'localhost\' TO \'bob\'@\'localhost\';\nQuery OK, 0 rows affected (0.004 sec)\n\nGRANT PROXY ON \'app2_dba\'@\'localhost\' TO \'carol\'@\'localhost\';\nQuery OK, 0 rows affected (0.004 sec)\n\nThe default root user accounts created by mysql_install_db have this\nprivilege. For example:\n\nGRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION;\nGRANT PROXY ON \'\'@\'%\' TO \'root\'@\'localhost\' WITH GRANT OPTION;\n\nThis allows the default root user accounts to grant the PROXY privilege for\nany other user account, and it also allows the default root user accounts to\ngrant others the privilege to do the same.\n\nAuthentication Options\n----------------------\n\nThe authentication options for the GRANT statement are the same as those for\nthe CREATE USER statement.\n\nIDENTIFIED BY \'password\'\n------------------------\n\nThe optional IDENTIFIED BY clause can be used to provide an account with a\npassword. The password should be specified in plain text. It will be hashed by\nthe PASSWORD function prior to being stored.\n\nFor example, if our password is mariadb, then we can create the user with:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY \'mariadb\';\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will\nbe able to connect without a password. A blank password is not a wildcard to\nmatch any password. The user must connect without providing a password if no\npassword is set.\n\nIf the user account already exists and if you provide the IDENTIFIED BY\nclause, then the user\'s password will be changed. You must have the privileges\nneeded for the SET PASSWORD statement to change a user\'s password with GRANT.\n\nThe only authentication plugins that this clause supports are\nmysql_native_password and mysql_old_password.\n\nIDENTIFIED BY PASSWORD \'password_hash\'\n--------------------------------------\n\nThe optional IDENTIFIED BY PASSWORD clause can be used to provide an account\nwith a password that has already been hashed. The password should be specified\nas a hash that was provided by the PASSWORD function. It will be stored as-is.\n\nFor example, if our password is mariadb, then we can find the hash with:\n\nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n\nAnd then we can create a user with the hash:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY \n PASSWORD \'*54958E764CE10E50764C2EECBB71D01F08549980\';\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will\nbe able to connect without a password. A blank password is not a wildcard to\nmatch any password. The user must connect without providing a password if no\npassword is set.\n\nIf the user account already exists and if you provide the IDENTIFIED BY\nclause, then the user\'s password will be changed. You must have the privileges\nneeded for the SET PASSWORD statement to change a user\'s password with GRANT.\n\nThe only authentication plugins that this clause supports are\nmysql_native_password and mysql_old_password.\n\nIDENTIFIED {VIA|WITH} authentication_plugin\n-------------------------------------------\n\nThe optional IDENTIFIED VIA authentication_plugin allows you to specify that\nthe account should be authenticated by a specific authentication plugin. The\nplugin name must be an active authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to install it with INSTALL\nPLUGIN or INSTALL SONAME.\n\nFor example, this could be used with the PAM authentication plugin:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam;\n\nSome authentication plugins allow additional arguments to be specified after a\nUSING or AS keyword. For example, the PAM authentication plugin accepts a\nservice name:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n\nThe exact meaning of the additional argument would depend on the specific\nauthentication plugin.\n\nMariaDB starting with 10.4.0\n----------------------------\nThe USING or AS keyword can also be used to provide a plain-text password to a\nplugin if it\'s provided as an argument to the PASSWORD() function. This is\nonly valid for authentication plugins that have implemented a hook for the\nPASSWORD() function. For example, the ed25519 authentication plugin supports\nthis:\n\nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 \n USING PASSWORD(\'secret\');\n\nMariaDB starting with 10.4.3\n----------------------------\nOne can specify many authentication plugins, they all work as alternatives\nways of authenticating a user:\n\nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 \n USING PASSWORD(\'secret\') OR unix_socket;\n\nBy default, when you create a user without specifying an authentication\nplugin, MariaDB uses the mysql_native_password plugin.\n\nResource Limit Options\n----------------------\n\nIt is possible to set per-account limits for certain server resources. The\nfollowing table shows the values that can be set per account:\n\n+--------------------------------------+--------------------------------------+') WHERE help_topic_id = 108; -update help_topic set description = CONCAT(description, '\n| Limit Type | Decription |\n+--------------------------------------+--------------------------------------+\n| MAX_QUERIES_PER_HOUR | Number of statements that the |\n| | account can issue per hour |\n| | (including updates) |\n+--------------------------------------+--------------------------------------+\n| MAX_UPDATES_PER_HOUR | Number of updates (not queries) |\n| | that the account can issue per hour |\n+--------------------------------------+--------------------------------------+\n| MAX_CONNECTIONS_PER_HOUR | Number of connections that the |\n| | account can start per hour |\n+--------------------------------------+--------------------------------------+\n| MAX_USER_CONNECTIONS | Number of simultaneous connections |\n| | that can be accepted from the same |\n| | account; if it is 0, |\n| | max_connections will be used |\n| | instead; if max_connections is 0, |\n| | there is no limit for this |\n| | account\'s simultaneous connections. |\n+--------------------------------------+--------------------------------------+\n| MAX_STATEMENT_TIME | Timeout, in seconds, for statements |\n| | executed by the user. See also |\n| | Aborting Statements that Exceed a |\n| | Certain Time to Execute. |\n+--------------------------------------+--------------------------------------+\n\nIf any of these limits are set to 0, then there is no limit for that resource\nfor that user.\n\nTo set resource limits for an account, if you do not want to change that\naccount\'s privileges, you can issue a GRANT statement with the USAGE\nprivilege, which has no meaning. The statement can name some or all limit\ntypes, in any order.\n\nHere is an example showing how to set resource limits:\n\nGRANT USAGE ON *.* TO \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 0\n MAX_QUERIES_PER_HOUR 200;\n\nThe resources are tracked per account, which means \'user\'@\'server\'; not per\nuser name or per connection.\n\nThe count can be reset for all users using FLUSH USER_RESOURCES, FLUSH\nPRIVILEGES or mysqladmin reload.\n\nUsers with the CONNECTION ADMIN privilege (in MariaDB 10.5.2 and later) or the\nSUPER privilege are not restricted by max_user_connections, max_connections,\nor max_password_errors.\n\nPer account resource limits are stored in the user table, in the mysql\ndatabase. Columns used for resources limits are named max_questions,\nmax_updates, max_connections (for MAX_CONNECTIONS_PER_HOUR), and\nmax_user_connections (for MAX_USER_CONNECTIONS).\n\nTLS Options\n-----------\n\nBy default, MariaDB transmits data between the server and clients without\nencrypting it. This is generally acceptable when the server and client run on\nthe same host or in networks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on separate networks or\nthey are in a high-risk network, the lack of encryption does introduce\nsecurity concerns as a malicious actor could potentially eavesdrop on the\ntraffic as it is sent over the network between them.\n\nTo mitigate this concern, MariaDB allows you to encrypt data in transit\nbetween the server and clients using the Transport Layer Security (TLS)\nprotocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly\nspeaking the SSL protocol is a predecessor to TLS and, that version of the\nprotocol is now considered insecure. The documentation still uses the term SSL\noften and for compatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB only supports its\nsecure successors.\n\nSee Secure Connections Overview for more information about how to determine\nwhether your MariaDB server has TLS support.\n\nYou can set certain TLS-related restrictions for specific user accounts. For\ninstance, you might use this with user accounts that require access to\nsensitive data while sending it across networks that you do not control. These\nrestrictions can be enabled for a user account with the CREATE USER, ALTER\nUSER, or GRANT statements. The following options are available:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| REQUIRE NONE | TLS is not required for this account, but can |\n| | still be used. |\n+---------------------------+------------------------------------------------+\n| REQUIRE SSL | The account must use TLS, but no valid X509 |\n| | certificate is required. This option cannot |\n| | be combined with other TLS options. |\n+---------------------------+------------------------------------------------+\n| REQUIRE X509 | The account must use TLS and must have a |\n| | valid X509 certificate. This option implies |\n| | REQUIRE SSL. This option cannot be combined |\n| | with other TLS options. |\n+---------------------------+------------------------------------------------+\n| REQUIRE ISSUER \'issuer\' | The account must use TLS and must have a |\n| | valid X509 certificate. Also, the Certificate |\n| | Authority must be the one specified via the |\n| | string issuer. This option implies REQUIRE |\n| | X509. This option can be combined with the |\n| | SUBJECT, and CIPHER options in any order. |\n+---------------------------+------------------------------------------------+\n| REQUIRE SUBJECT \'subject\' | The account must use TLS and must have a |\n| | valid X509 certificate. Also, the |\n| | certificate\'s Subject must be the one |\n| | specified via the string subject. This option |\n| | implies REQUIRE X509. This option can be |\n| | combined with the ISSUER, and CIPHER options |\n| | in any order. |\n+---------------------------+------------------------------------------------+\n| REQUIRE CIPHER \'cipher\' | The account must use TLS, but no valid X509 |\n| | certificate is required. Also, the encryption |\n| | used for the connection must use a specific |\n| | cipher method specified in the string cipher. |\n| | This option implies REQUIRE SSL. This option |\n| | can be combined with the ISSUER, and SUBJECT |\n| | options in any order. |\n+---------------------------+------------------------------------------------+\n\nThe REQUIRE keyword must be used only once for all specified options, and the\nAND keyword can be used to separate individual options, but it is not required.\n\nFor example, you can create a user account that requires these TLS options\nwith the following:\n\nGRANT USAGE ON *.* TO \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom, Inc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some Company/CN=Peter\nParker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'SHA-DES-CBC3-EDH-RSA\';\n\nIf any of these options are set for a specific user account, then any client\nwho tries to connect with that user account will have to be configured to\nconnect with TLS.\n\nSee Securing Connections for Client and Server for information on how to\nenable TLS on the client and server.\n\nRoles\n-----\n\nSyntax\n------\n\nGRANT role TO grantee [, grantee ... ]\n[ WITH ADMIN OPTION ]\n\ngrantee:\n rolename\n username [authentication_option]\n\nThe GRANT statement is also used to grant the use of a role to one or more\nusers or other roles. In order to be able to grant a role, the grantor doing\nso must have permission to do so (see WITH ADMIN in the CREATE ROLE article).\n\nSpecifying the WITH ADMIN OPTION permits the grantee to in turn grant the role\nto another.\n\nFor example, the following commands show how to grant the same role to a\ncouple different users.\n\nGRANT journalist TO hulda;\n\nGRANT journalist TO berengar WITH ADMIN OPTION;\n\nIf a user has been granted a role, they do not automatically obtain all\npermissions associated with that role. These permissions are only in use when\nthe user activates the role with the SET ROLE statement.\n\nTO PUBLIC\n---------\n\nMariaDB starting with 10.11\n---------------------------\n\nSyntax\n------\n\nGRANT <privilege> ON <database>.<object> TO PUBLIC;\nREVOKE <privilege> ON <database>.<object> FROM PUBLIC;\n\nGRANT ... TO PUBLIC grants privileges to all users with access to the server.\nThe privileges also apply to users created after the privileges are granted.\nThis can be useful when one only wants to state once that all users need to\nhave a certain set of privileges.\n\nWhen running SHOW GRANTS, a user will also see all privileges inherited from\nPUBLIC. SHOW GRANTS FOR PUBLIC will only show TO PUBLIC grants.\n\nGrant Examples\n--------------\n\nGranting Root-like Privileges\n-----------------------------\n\nYou can create a user that has privileges similar to the default root accounts\nby executing the following:\n\nCREATE USER \'alexander\'@\'localhost\';\nGRANT ALL PRIVILEGES ON *.* to \'alexander\'@\'localhost\' WITH GRANT OPTION;\n\nURL: https://mariadb.com/kb/en/grant/') WHERE help_topic_id = 108; +update help_topic set description = CONCAT(description, '\nEnables setting the DEFINER when creating triggers, views, stored functions\nand stored procedures. Added in MariaDB 10.5.2.\n\nSHOW DATABASES\n--------------\n\nList all databases using the SHOW DATABASES statement. Without the SHOW\nDATABASES privilege, you can still issue the SHOW DATABASES statement, but it\nwill only list databases containing tables on which you have privileges.\n\nSHUTDOWN\n--------\n\nShut down the server using SHUTDOWN or the mysqladmin shutdown command.\n\nSUPER\n-----\n\nExecute superuser statements: CHANGE MASTER TO, KILL (users who do not have\nthis privilege can only KILL their own threads), PURGE LOGS, SET global system\nvariables, or the mysqladmin debug command. Also, this permission allows the\nuser to write data even if the read_only startup option is set, enable or\ndisable logging, enable or disable replication on replica, specify a DEFINER\nfor statements that support that clause, connect once reaching the\nMAX_CONNECTIONS. If a statement has been specified for the init-connect mysqld\noption, that command will not be executed when a user with SUPER privileges\nconnects to the server.\n\nThe SUPER privilege has been split into multiple smaller privileges from\nMariaDB 10.5.2 to allow for more fine-grained privileges.\n\nFrom MariaDB 10.11.0, the READ_ONLY ADMIN privilege has been removed from\nSUPER. The benefit of this is that one can remove the READ_ONLY ADMIN\nprivilege from all users and ensure that no one can make any changes on any\nnon-temporary tables. This is useful on replicas when one wants to ensure that\nthe replica is kept identical to the primary.\n\nDatabase Privileges\n-------------------\n\nThe following table lists the privileges that can be granted at the database\nlevel. You can also grant all table and function privileges at the database\nlevel. Table and function privileges on a database apply to all tables or\nfunctions in that database, including those created later.\n\nTo set a privilege for a database, specify the database using db_name.* for\npriv_level, or just use * to specify the default database.\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| CREATE | Create a database using the CREATE |\n| | DATABASE statement, when the privilege |\n| | is granted for a database. You can |\n| | grant the CREATE privilege on |\n| | databases that do not yet exist. This |\n| | also grants the CREATE privilege on |\n| | all tables in the database. |\n+----------------------------------+-----------------------------------------+\n| CREATE ROUTINE | Create Stored Programs using the |\n| | CREATE PROCEDURE and CREATE FUNCTION |\n| | statements. |\n+----------------------------------+-----------------------------------------+\n| CREATE TEMPORARY TABLES | Create temporary tables with the |\n| | CREATE TEMPORARY TABLE statement. This |\n| | privilege enable writing and dropping |\n| | those temporary tables |\n+----------------------------------+-----------------------------------------+\n| DROP | Drop a database using the DROP |\n| | DATABASE statement, when the privilege |\n| | is granted for a database. This also |\n| | grants the DROP privilege on all |\n| | tables in the database. |\n+----------------------------------+-----------------------------------------+\n| EVENT | Create, drop and alter EVENTs. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant database privileges. You can |\n| | only grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n| LOCK TABLES | Acquire explicit locks using the LOCK |\n| | TABLES statement; you also need to |\n| | have the SELECT privilege on a table, |\n| | in order to lock it. |\n+----------------------------------+-----------------------------------------+\n\nTable Privileges\n----------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| ALTER | Change the structure of an existing |\n| | table using the ALTER TABLE statement. |\n+----------------------------------+-----------------------------------------+\n| CREATE | Create a table using the CREATE TABLE |\n| | statement. You can grant the CREATE |\n| | privilege on tables that do not yet |\n| | exist. |\n+----------------------------------+-----------------------------------------+\n| CREATE VIEW | Create a view using the CREATE_VIEW |\n| | statement. |\n+----------------------------------+-----------------------------------------+\n| DELETE | Remove rows from a table using the |\n| | DELETE statement. |\n+----------------------------------+-----------------------------------------+\n| DELETE HISTORY | Remove historical rows from a table |\n| | using the DELETE HISTORY statement. |\n| | Displays as DELETE VERSIONING ROWS |\n| | when running SHOW GRANTS until MariaDB |\n| | 10.3.15 and until MariaDB 10.4.5 |\n| | (MDEV-17655), or when running SHOW |\n| | PRIVILEGES until MariaDB 10.5.2, |\n| | MariaDB 10.4.13 and MariaDB 10.3.23 |\n| | (MDEV-20382). From MariaDB 10.3.4. |\n| | From MariaDB 10.3.5, if a user has the |\n| | SUPER privilege but not this |\n| | privilege, running mysql_upgrade will |\n| | grant this privilege as well. |\n+----------------------------------+-----------------------------------------+\n| DROP | Drop a table using the DROP TABLE |\n| | statement or a view using the DROP |\n| | VIEW statement. Also required to |\n| | execute the TRUNCATE TABLE statement. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant table privileges. You can only |\n| | grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n| INDEX | Create an index on a table using the |\n| | CREATE INDEX statement. Without the |\n| | INDEX privilege, you can still create |\n| | indexes when creating a table using |\n| | the CREATE TABLE statement if the you |\n| | have the CREATE privilege, and you can |\n| | create indexes using the ALTER TABLE |\n| | statement if you have the ALTER |\n| | privilege. |\n+----------------------------------+-----------------------------------------+\n| INSERT | Add rows to a table using the INSERT |\n| | statement. The INSERT privilege can |\n| | also be set on individual columns; see |\n| | Column Privileges below for details. |\n+----------------------------------+-----------------------------------------+\n| REFERENCES | Unused. |\n+----------------------------------+-----------------------------------------+\n| SELECT | Read data from a table using the |\n| | SELECT statement. The SELECT privilege |\n| | can also be set on individual columns; |\n| | see Column Privileges below for |\n| | details. |\n+----------------------------------+-----------------------------------------+\n| SHOW VIEW | Show the CREATE VIEW statement to |\n| | create a view using the SHOW CREATE |\n| | VIEW statement. |\n+----------------------------------+-----------------------------------------+\n| TRIGGER | Execute triggers associated to tables |\n| | you update, execute the CREATE TRIGGER |\n| | and DROP TRIGGER statements. You will |\n| | still be able to see triggers. |\n+----------------------------------+-----------------------------------------+\n| UPDATE | Update existing rows in a table using |\n| | the UPDATE statement. UPDATE |\n| | statements usually include a WHERE |\n| | clause to update only certain rows. |\n| | You must have SELECT privileges on the |\n| | table or the appropriate columns for |\n| | the WHERE clause. The UPDATE privilege |\n| | can also be set on individual columns; |\n| | see Column Privileges below for |\n| | details. |\n+----------------------------------+-----------------------------------------+\n\nColumn Privileges\n-----------------\n\nSome table privileges can be set for individual columns of a table. To use\ncolumn privileges, specify the table explicitly and provide a list of column\nnames after the privilege type. For example, the following statement would\nallow the user to read the names and positions of employees, but not other\ninformation from the same table, such as salaries.\n\nGRANT SELECT (name, position) on Employee to \'jeffrey\'@\'localhost\';\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| INSERT (column_list) | Add rows specifying values in columns |\n| | using the INSERT statement. If you |\n| | only have column-level INSERT |\n| | privileges, you must specify the |\n| | columns you are setting in the INSERT |\n| | statement. All other columns will be |\n| | set to their default values, or NULL. |\n+----------------------------------+-----------------------------------------+\n| REFERENCES (column_list) | Unused. |\n+----------------------------------+-----------------------------------------+\n| SELECT (column_list) | Read values in columns using the |\n| | SELECT statement. You cannot access or |\n| | query any columns for which you do not |\n| | have SELECT privileges, including in |\n| | WHERE, ON, GROUP BY, and ORDER BY |\n| | clauses. |\n+----------------------------------+-----------------------------------------+\n| UPDATE (column_list) | Update values in columns of existing |\n| | rows using the UPDATE statement. |\n| | UPDATE statements usually include a |\n| | WHERE clause to update only certain |\n| | rows. You must have SELECT privileges |\n| | on the table or the appropriate |\n| | columns for the WHERE clause. |\n+----------------------------------+-----------------------------------------+\n\nFunction Privileges\n-------------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+') WHERE help_topic_id = 108; +update help_topic set description = CONCAT(description, '\n| ALTER ROUTINE | Change the characteristics of a stored |\n| | function using the ALTER FUNCTION |\n| | statement. |\n+----------------------------------+-----------------------------------------+\n| EXECUTE | Use a stored function. You need SELECT |\n| | privileges for any tables or columns |\n| | accessed by the function. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant function privileges. You can |\n| | only grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n\nProcedure Privileges\n--------------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| ALTER ROUTINE | Change the characteristics of a stored |\n| | procedure using the ALTER PROCEDURE |\n| | statement. |\n+----------------------------------+-----------------------------------------+\n| EXECUTE | Execute a stored procedure using the |\n| | CALL statement. The privilege to call |\n| | a procedure may allow you to perform |\n| | actions you wouldn\'t otherwise be able |\n| | to do, such as insert rows into a |\n| | table. |\n+----------------------------------+-----------------------------------------+\n| GRANT OPTION | Grant procedure privileges. You can |\n| | only grant privileges that you have. |\n+----------------------------------+-----------------------------------------+\n\nGRANT EXECUTE ON PROCEDURE mysql.create_db TO maintainer;\n\nProxy Privileges\n----------------\n\n+----------------------------------+-----------------------------------------+\n| Privilege | Description |\n+----------------------------------+-----------------------------------------+\n| PROXY | Permits one user to be a proxy for |\n| | another. |\n+----------------------------------+-----------------------------------------+\n\nThe PROXY privilege allows one user to proxy as another user, which means\ntheir privileges change to that of the proxy user, and the CURRENT_USER()\nfunction returns the user name of the proxy user.\n\nThe PROXY privilege only works with authentication plugins that support it.\nThe default mysql_native_password authentication plugin does not support proxy\nusers.\n\nThe pam authentication plugin is the only plugin included with MariaDB that\ncurrently supports proxy users. The PROXY privilege is commonly used with the\npam authentication plugin to enable user and group mapping with PAM.\n\nFor example, to grant the PROXY privilege to an anonymous account that\nauthenticates with the pam authentication plugin, you could execute the\nfollowing:\n\nCREATE USER \'dba\'@\'%\' IDENTIFIED BY \'strongpassword\';\nGRANT ALL PRIVILEGES ON *.* TO \'dba\'@\'%\' ;\n\nCREATE USER \'\'@\'%\' IDENTIFIED VIA pam USING \'mariadb\';\nGRANT PROXY ON \'dba\'@\'%\' TO \'\'@\'%\';\n\nA user account can only grant the PROXY privilege for a specific user account\nif the granter also has the PROXY privilege for that specific user account,\nand if that privilege is defined WITH GRANT OPTION. For example, the following\nexample fails because the granter does not have the PROXY privilege for that\nspecific user account at all:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n+------------------------------------------------------------------------------\n----------------------------------------+\n\nGRANT PROXY ON \'dba\'@\'localhost\' TO \'bob\'@\'localhost\';\nERROR 1698 (28000): Access denied for user \'alice\'@\'localhost\'\n\nAnd the following example fails because the granter does have the PROXY\nprivilege for that specific user account, but it is not defined WITH GRANT\nOPTION:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO \'alice\'@\'localhost\' \n |\n+------------------------------------------------------------------------------\n----------------------------------------+\n\nGRANT PROXY ON \'dba\'@\'localhost\' TO \'bob\'@\'localhost\';\nERROR 1698 (28000): Access denied for user \'alice\'@\'localhost\'\n\nBut the following example succeeds because the granter does have the PROXY\nprivilege for that specific user account, and it is defined WITH GRANT OPTION:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT OPTION |\n| GRANT PROXY ON \'dba\'@\'localhost\' TO \'alice\'@\'localhost\' WITH GRANT OPTION \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n\nGRANT PROXY ON \'dba\'@\'localhost\' TO \'bob\'@\'localhost\';\n\nA user account can grant the PROXY privilege for any other user account if the\ngranter has the PROXY privilege for the \'\'@\'%\' anonymous user account, like\nthis:\n\nGRANT PROXY ON \'\'@\'%\' TO \'dba\'@\'localhost\' WITH GRANT OPTION;\n\nFor example, the following example succeeds because the user can grant the\nPROXY privilege for any other user account:\n\nSELECT USER(), CURRENT_USER();\n+-----------------+-----------------+\n| USER() | CURRENT_USER() |\n+-----------------+-----------------+\n| alice@localhost | alice@localhost |\n+-----------------+-----------------+\n\nSHOW GRANTS;\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| Grants for alice@localhost \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'alice\'@\'localhost\' IDENTIFIED BY PASSWORD\n\'*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19\' WITH GRANT OPTION |\n| GRANT PROXY ON \'\'@\'%\' TO \'alice\'@\'localhost\' WITH GRANT OPTION \n |\n+------------------------------------------------------------------------------\n----------------------------------------------------------+\n\nGRANT PROXY ON \'app1_dba\'@\'localhost\' TO \'bob\'@\'localhost\';\nQuery OK, 0 rows affected (0.004 sec)\n\nGRANT PROXY ON \'app2_dba\'@\'localhost\' TO \'carol\'@\'localhost\';\nQuery OK, 0 rows affected (0.004 sec)\n\nThe default root user accounts created by mysql_install_db have this\nprivilege. For example:\n\nGRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION;\nGRANT PROXY ON \'\'@\'%\' TO \'root\'@\'localhost\' WITH GRANT OPTION;\n\nThis allows the default root user accounts to grant the PROXY privilege for\nany other user account, and it also allows the default root user accounts to\ngrant others the privilege to do the same.\n\nAuthentication Options\n----------------------\n\nThe authentication options for the GRANT statement are the same as those for\nthe CREATE USER statement.\n\nIDENTIFIED BY \'password\'\n------------------------\n\nThe optional IDENTIFIED BY clause can be used to provide an account with a\npassword. The password should be specified in plain text. It will be hashed by\nthe PASSWORD function prior to being stored.\n\nFor example, if our password is mariadb, then we can create the user with:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY \'mariadb\';\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will\nbe able to connect without a password. A blank password is not a wildcard to\nmatch any password. The user must connect without providing a password if no\npassword is set.\n\nIf the user account already exists and if you provide the IDENTIFIED BY\nclause, then the user\'s password will be changed. You must have the privileges\nneeded for the SET PASSWORD statement to change a user\'s password with GRANT.\n\nThe only authentication plugins that this clause supports are\nmysql_native_password and mysql_old_password.\n\nIDENTIFIED BY PASSWORD \'password_hash\'\n--------------------------------------\n\nThe optional IDENTIFIED BY PASSWORD clause can be used to provide an account\nwith a password that has already been hashed. The password should be specified\nas a hash that was provided by the PASSWORD function. It will be stored as-is.\n\nFor example, if our password is mariadb, then we can find the hash with:\n\nSELECT PASSWORD(\'mariadb\');\n+-------------------------------------------+\n| PASSWORD(\'mariadb\') |\n+-------------------------------------------+\n| *54958E764CE10E50764C2EECBB71D01F08549980 |\n+-------------------------------------------+\n1 row in set (0.00 sec)\n\nAnd then we can create a user with the hash:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED BY \n PASSWORD \'*54958E764CE10E50764C2EECBB71D01F08549980\';\n\nIf you do not specify a password with the IDENTIFIED BY clause, the user will\nbe able to connect without a password. A blank password is not a wildcard to\nmatch any password. The user must connect without providing a password if no\npassword is set.\n\nIf the user account already exists and if you provide the IDENTIFIED BY\nclause, then the user\'s password will be changed. You must have the privileges\nneeded for the SET PASSWORD statement to change a user\'s password with GRANT.\n\nThe only authentication plugins that this clause supports are\nmysql_native_password and mysql_old_password.\n\nIDENTIFIED {VIA|WITH} authentication_plugin\n-------------------------------------------\n\nThe optional IDENTIFIED VIA authentication_plugin allows you to specify that\nthe account should be authenticated by a specific authentication plugin. The\nplugin name must be an active authentication plugin as per SHOW PLUGINS. If it\ndoesn\'t show up in that output, then you will need to install it with INSTALL\nPLUGIN or INSTALL SONAME.\n\nFor example, this could be used with the PAM authentication plugin:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam;\n\nSome authentication plugins allow additional arguments to be specified after a\nUSING or AS keyword. For example, the PAM authentication plugin accepts a\nservice name:\n\nGRANT USAGE ON *.* TO foo2@test IDENTIFIED VIA pam USING \'mariadb\';\n\nThe exact meaning of the additional argument would depend on the specific\nauthentication plugin.\n\nMariaDB starting with 10.4.0\n----------------------------\nThe USING or AS keyword can also be used to provide a plain-text password to a\nplugin if it\'s provided as an argument to the PASSWORD() function. This is\nonly valid for authentication plugins that have implemented a hook for the\nPASSWORD() function. For example, the ed25519 authentication plugin supports\nthis:\n\nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 \n USING PASSWORD(\'secret\');\n\nMariaDB starting with 10.4.3\n----------------------------\nOne can specify many authentication plugins, they all work as alternatives\nways of authenticating a user:\n\nCREATE USER safe@\'%\' IDENTIFIED VIA ed25519 \n USING PASSWORD(\'secret\') OR unix_socket;\n\nBy default, when you create a user without specifying an authentication\nplugin, MariaDB uses the mysql_native_password plugin.\n\nResource Limit Options\n----------------------\n\nIt is possible to set per-account limits for certain server resources. The\nfollowing table shows the values that can be set per account:\n\n+--------------------------------------+--------------------------------------+\n| Limit Type | Decription |') WHERE help_topic_id = 108; +update help_topic set description = CONCAT(description, '\n+--------------------------------------+--------------------------------------+\n| MAX_QUERIES_PER_HOUR | Number of statements that the |\n| | account can issue per hour |\n| | (including updates) |\n+--------------------------------------+--------------------------------------+\n| MAX_UPDATES_PER_HOUR | Number of updates (not queries) |\n| | that the account can issue per hour |\n+--------------------------------------+--------------------------------------+\n| MAX_CONNECTIONS_PER_HOUR | Number of connections that the |\n| | account can start per hour |\n+--------------------------------------+--------------------------------------+\n| MAX_USER_CONNECTIONS | Number of simultaneous connections |\n| | that can be accepted from the same |\n| | account; if it is 0, |\n| | max_connections will be used |\n| | instead; if max_connections is 0, |\n| | there is no limit for this |\n| | account\'s simultaneous connections. |\n+--------------------------------------+--------------------------------------+\n| MAX_STATEMENT_TIME | Timeout, in seconds, for statements |\n| | executed by the user. See also |\n| | Aborting Statements that Exceed a |\n| | Certain Time to Execute. |\n+--------------------------------------+--------------------------------------+\n\nIf any of these limits are set to 0, then there is no limit for that resource\nfor that user.\n\nTo set resource limits for an account, if you do not want to change that\naccount\'s privileges, you can issue a GRANT statement with the USAGE\nprivilege, which has no meaning. The statement can name some or all limit\ntypes, in any order.\n\nHere is an example showing how to set resource limits:\n\nGRANT USAGE ON *.* TO \'someone\'@\'localhost\' WITH\n MAX_USER_CONNECTIONS 0\n MAX_QUERIES_PER_HOUR 200;\n\nThe resources are tracked per account, which means \'user\'@\'server\'; not per\nuser name or per connection.\n\nThe count can be reset for all users using FLUSH USER_RESOURCES, FLUSH\nPRIVILEGES or mysqladmin reload.\n\nUsers with the CONNECTION ADMIN privilege (in MariaDB 10.5.2 and later) or the\nSUPER privilege are not restricted by max_user_connections, max_connections,\nor max_password_errors.\n\nPer account resource limits are stored in the user table, in the mysql\ndatabase. Columns used for resources limits are named max_questions,\nmax_updates, max_connections (for MAX_CONNECTIONS_PER_HOUR), and\nmax_user_connections (for MAX_USER_CONNECTIONS).\n\nTLS Options\n-----------\n\nBy default, MariaDB transmits data between the server and clients without\nencrypting it. This is generally acceptable when the server and client run on\nthe same host or in networks where security is guaranteed through other means.\nHowever, in cases where the server and client exist on separate networks or\nthey are in a high-risk network, the lack of encryption does introduce\nsecurity concerns as a malicious actor could potentially eavesdrop on the\ntraffic as it is sent over the network between them.\n\nTo mitigate this concern, MariaDB allows you to encrypt data in transit\nbetween the server and clients using the Transport Layer Security (TLS)\nprotocol. TLS was formerly known as Secure Socket Layer (SSL), but strictly\nspeaking the SSL protocol is a predecessor to TLS and, that version of the\nprotocol is now considered insecure. The documentation still uses the term SSL\noften and for compatibility reasons TLS-related server system and status\nvariables still use the prefix ssl_, but internally, MariaDB only supports its\nsecure successors.\n\nSee Secure Connections Overview for more information about how to determine\nwhether your MariaDB server has TLS support.\n\nYou can set certain TLS-related restrictions for specific user accounts. For\ninstance, you might use this with user accounts that require access to\nsensitive data while sending it across networks that you do not control. These\nrestrictions can be enabled for a user account with the CREATE USER, ALTER\nUSER, or GRANT statements. The following options are available:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| REQUIRE NONE | TLS is not required for this account, but can |\n| | still be used. |\n+---------------------------+------------------------------------------------+\n| REQUIRE SSL | The account must use TLS, but no valid X509 |\n| | certificate is required. This option cannot |\n| | be combined with other TLS options. |\n+---------------------------+------------------------------------------------+\n| REQUIRE X509 | The account must use TLS and must have a |\n| | valid X509 certificate. This option implies |\n| | REQUIRE SSL. This option cannot be combined |\n| | with other TLS options. |\n+---------------------------+------------------------------------------------+\n| REQUIRE ISSUER \'issuer\' | The account must use TLS and must have a |\n| | valid X509 certificate. Also, the Certificate |\n| | Authority must be the one specified via the |\n| | string issuer. This option implies REQUIRE |\n| | X509. This option can be combined with the |\n| | SUBJECT, and CIPHER options in any order. |\n+---------------------------+------------------------------------------------+\n| REQUIRE SUBJECT \'subject\' | The account must use TLS and must have a |\n| | valid X509 certificate. Also, the |\n| | certificate\'s Subject must be the one |\n| | specified via the string subject. This option |\n| | implies REQUIRE X509. This option can be |\n| | combined with the ISSUER, and CIPHER options |\n| | in any order. |\n+---------------------------+------------------------------------------------+\n| REQUIRE CIPHER \'cipher\' | The account must use TLS, but no valid X509 |\n| | certificate is required. Also, the encryption |\n| | used for the connection must use a specific |\n| | cipher method specified in the string cipher. |\n| | This option implies REQUIRE SSL. This option |\n| | can be combined with the ISSUER, and SUBJECT |\n| | options in any order. |\n+---------------------------+------------------------------------------------+\n\nThe REQUIRE keyword must be used only once for all specified options, and the\nAND keyword can be used to separate individual options, but it is not required.\n\nFor example, you can create a user account that requires these TLS options\nwith the following:\n\nGRANT USAGE ON *.* TO \'alice\'@\'%\'\n REQUIRE SUBJECT \'/CN=alice/O=My Dom, Inc./C=US/ST=Oregon/L=Portland\'\n AND ISSUER \'/C=FI/ST=Somewhere/L=City/ O=Some Company/CN=Peter\nParker/emailAddress=p.parker@marvel.com\'\n AND CIPHER \'SHA-DES-CBC3-EDH-RSA\';\n\nIf any of these options are set for a specific user account, then any client\nwho tries to connect with that user account will have to be configured to\nconnect with TLS.\n\nSee Securing Connections for Client and Server for information on how to\nenable TLS on the client and server.\n\nRoles\n-----\n\nSyntax\n------\n\nGRANT role TO grantee [, grantee ... ]\n[ WITH ADMIN OPTION ]\n\ngrantee:\n rolename\n username [authentication_option]\n\nThe GRANT statement is also used to grant the use of a role to one or more\nusers or other roles. In order to be able to grant a role, the grantor doing\nso must have permission to do so (see WITH ADMIN in the CREATE ROLE article).\n\nSpecifying the WITH ADMIN OPTION permits the grantee to in turn grant the role\nto another.\n\nFor example, the following commands show how to grant the same role to a\ncouple different users.\n\nGRANT journalist TO hulda;\n\nGRANT journalist TO berengar WITH ADMIN OPTION;\n\nIf a user has been granted a role, they do not automatically obtain all\npermissions associated with that role. These permissions are only in use when\nthe user activates the role with the SET ROLE statement.\n\nTO PUBLIC\n---------\n\nMariaDB starting with 10.11\n---------------------------\n\nSyntax\n------\n\nGRANT <privilege> ON <database>.<object> TO PUBLIC;\nREVOKE <privilege> ON <database>.<object> FROM PUBLIC;\n\nGRANT ... TO PUBLIC grants privileges to all users with access to the server.\nThe privileges also apply to users created after the privileges are granted.\nThis can be useful when one only wants to state once that all users need to\nhave a certain set of privileges.\n\nWhen running SHOW GRANTS, a user will also see all privileges inherited from\nPUBLIC. SHOW GRANTS FOR PUBLIC will only show TO PUBLIC grants.\n\nGrant Examples\n--------------\n\nGranting Root-like Privileges\n-----------------------------\n\nYou can create a user that has privileges similar to the default root accounts\nby executing the following:\n\nCREATE USER \'alexander\'@\'localhost\';\nGRANT ALL PRIVILEGES ON *.* to \'alexander\'@\'localhost\' WITH GRANT OPTION;\n\nURL: https://mariadb.com/kb/en/grant/') WHERE help_topic_id = 108; insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (109,10,'RENAME USER','Syntax\n------\n\nRENAME USER old_user TO new_user\n [, old_user TO new_user] ...\n\nDescription\n-----------\n\nThe RENAME USER statement renames existing MariaDB accounts. To use it, you\nmust have the global CREATE USER privilege or the UPDATE privilege for the\nmysql database. Each account is named using the same format as for the CREATE\nUSER statement; for example, \'jeffrey\'@\'localhost\'. If you specify only the\nuser name part of the account name, a host name part of \'%\' is used.\n\nIf any of the old user accounts do not exist or any of the new user accounts\nalready exist, ERROR 1396 (HY000) results. If an error occurs, RENAME USER\nwill still rename the accounts that do not result in an error.\n\nExamples\n--------\n\nCREATE USER \'donald\', \'mickey\';\nRENAME USER \'donald\' TO \'duck\'@\'localhost\', \'mickey\' TO \'mouse\'@\'localhost\';\n\nURL: https://mariadb.com/kb/en/rename-user/','','https://mariadb.com/kb/en/rename-user/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (110,10,'REVOKE','Privileges\n----------\n\nSyntax\n------\n\nREVOKE \n priv_type [(column_list)]\n [, priv_type [(column_list)]] ...\n ON [object_type] priv_level\n FROM user [, user] ...\n\nREVOKE ALL PRIVILEGES, GRANT OPTION\n FROM user [, user] ...\n\nDescription\n-----------\n\nThe REVOKE statement enables system administrators to revoke privileges (or\nroles - see section below) from MariaDB accounts. Each account is named using\nthe same format as for the GRANT statement; for example,\n\'jeffrey\'@\'localhost\'. If you specify only the user name part of the account\nname, a host name part of \'%\' is used. For details on the levels at which\nprivileges exist, the allowable priv_type and priv_level values, and the\nsyntax for specifying users and passwords, see GRANT.\n\nTo use the first REVOKE syntax, you must have the GRANT OPTION privilege, and\nyou must have the privileges that you are revoking.\n\nTo revoke all privileges, use the second syntax, which drops all global,\ndatabase, table, column, and routine privileges for the named user or users:\n\nREVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user] ...\n\nTo use this REVOKE syntax, you must have the global CREATE USER privilege or\nthe UPDATE privilege for the mysql database. See GRANT.\n\nExamples\n--------\n\nREVOKE SUPER ON *.* FROM \'alexander\'@\'localhost\';\n\nRoles\n-----\n\nSyntax\n------\n\nREVOKE role [, role ...]\n FROM grantee [, grantee2 ... ]\n\nREVOKE ADMIN OPTION FOR role FROM grantee [, grantee2]\n\nDescription\n-----------\n\nREVOKE is also used to remove a role from a user or another role that it\'s\npreviously been assigned to. If a role has previously been set as a default\nrole, REVOKE does not remove the record of the default role from the\nmysql.user table. If the role is subsequently granted again, it will again be\nthe user\'s default. Use SET DEFAULT ROLE NONE to explicitly remove this.\n\nBefore MariaDB 10.1.13, the REVOKE role statement was not permitted in\nprepared statements.\n\nExample\n-------\n\nREVOKE journalist FROM hulda\n\nURL: https://mariadb.com/kb/en/revoke/','','https://mariadb.com/kb/en/revoke/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (111,10,'SET PASSWORD','Syntax\n------\n\nSET PASSWORD [FOR user] =\n {\n PASSWORD(\'some password\')\n | OLD_PASSWORD(\'some password\')\n | \'encrypted password\'\n }\n\nDescription\n-----------\n\nThe SET PASSWORD statement assigns a password to an existing MariaDB user\naccount.\n\nIf the password is specified using the PASSWORD() or OLD_PASSWORD() function,\nthe literal text of the password should be given. If the password is specified\nwithout using either function, the password should be the already-encrypted\npassword value as returned by PASSWORD().\n\nOLD_PASSWORD() should only be used if your MariaDB/MySQL clients are very old\n(< 4.0.0).\n\nWith no FOR clause, this statement sets the password for the current user. Any\nclient that has connected to the server using a non-anonymous account can\nchange the password for that account.\n\nWith a FOR clause, this statement sets the password for a specific account on\nthe current server host. Only clients that have the UPDATE privilege for the\nmysql database can do this. The user value should be given in\nuser_name@host_name format, where user_name and host_name are exactly as they\nare listed in the User and Host columns of the mysql.user table (or view in\nMariaDB-10.4 onwards) entry.\n\nThe argument to PASSWORD() and the password given to MariaDB clients can be of\narbitrary length.\n\nAuthentication Plugin Support\n-----------------------------\n\nMariaDB starting with 10.4\n--------------------------\nIn MariaDB 10.4 and later, SET PASSWORD (with or without PASSWORD()) works for\naccounts authenticated via any authentication plugin that supports passwords\nstored in the mysql.global_priv table.\n\nThe ed25519, mysql_native_password, and mysql_old_password authentication\nplugins store passwords in the mysql.global_priv table.\n\nIf you run SET PASSWORD on an account that authenticates with one of these\nauthentication plugins that stores passwords in the mysql.global_priv table,\nthen the PASSWORD() function is evaluated by the specific authentication\nplugin used by the account. The authentication plugin hashes the password with\na method that is compatible with that specific authentication plugin.\n\nThe unix_socket, named_pipe, gssapi, and pam authentication plugins do not\nstore passwords in the mysql.global_priv table. These authentication plugins\nrely on other methods to authenticate the user.\n\nIf you attempt to run SET PASSWORD on an account that authenticates with one\nof these authentication plugins that doesn\'t store a password in the\nmysql.global_priv table, then MariaDB Server will raise a warning like the\nfollowing:\n\nSET PASSWORD is ignored for users authenticating via unix_socket plugin\n\nSee Authentication from MariaDB 10.4 for an overview of authentication changes\nin MariaDB 10.4.\n\nMariaDB until 10.3\n------------------\nIn MariaDB 10.3 and before, SET PASSWORD (with or without PASSWORD()) only\nworks for accounts authenticated via mysql_native_password or\nmysql_old_password authentication plugins\n\nPasswordless User Accounts\n--------------------------\n\nUser accounts do not always require passwords to login.\n\nThe unix_socket , named_pipe and gssapi authentication plugins do not require\na password to authenticate the user.\n\nThe pam authentication plugin may or may not require a password to\nauthenticate the user, depending on the specific configuration.\n\nThe mysql_native_password and mysql_old_password authentication plugins\nrequire passwords for authentication, but the password can be blank. In that\ncase, no password is required.\n\nIf you provide a password while attempting to log into the server as an\naccount that doesn\'t require a password, then MariaDB server will simply\nignore the password.\n\nMariaDB starting with 10.4\n--------------------------\nIn MariaDB 10.4 and later, a user account can be defined to use multiple\nauthentication plugins in a specific order of preference. This specific\nscenario may be more noticeable in these versions, since an account could be\nassociated with some authentication plugins that require a password, and some\nthat do not.\n\nExample\n-------\n\nFor example, if you had an entry with User and Host column values of \'bob\' and\n\'%.loc.gov\', you would write the statement like this:\n\nSET PASSWORD FOR \'bob\'@\'%.loc.gov\' = PASSWORD(\'newpass\');\n\nIf you want to delete a password for a user, you would do:\n\nSET PASSWORD FOR \'bob\'@localhost = PASSWORD(\"\");\n\nURL: https://mariadb.com/kb/en/set-password/','','https://mariadb.com/kb/en/set-password/'); @@ -334,8 +334,8 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (242,20,'~','Syntax\n------\n\n~\n\nDescription\n-----------\n\nBitwise NOT. Converts the value to 4 bytes binary and inverts all bits.\n\nExamples\n--------\n\nSELECT 3 & ~1;\n+--------+\n| 3 & ~1 |\n+--------+\n| 2 |\n+--------+\n\nSELECT 5 & ~1;\n+--------+\n| 5 & ~1 |\n+--------+\n| 4 |\n+--------+\n\nURL: https://mariadb.com/kb/en/bitwise-not/','','https://mariadb.com/kb/en/bitwise-not/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (243,20,'Parentheses','Parentheses are sometimes called precedence operators - this means that they\ncan be used to change the other operator\'s precedence in an expression. The\nexpressions that are written between parentheses are computed before the\nexpressions that are written outside. Parentheses must always contain an\nexpression (that is, they cannot be empty), and can be nested.\n\nFor example, the following expressions could return different results:\n\n* NOT a OR b\n* NOT (a OR b)\n\nIn the first case, NOT applies to a, so if a is FALSE or b is TRUE, the\nexpression returns TRUE. In the second case, NOT applies to the result of a OR\nb, so if at least one of a or b is TRUE, the expression is TRUE.\n\nWhen the precedence of operators is not intuitive, you can use parentheses to\nmake it immediately clear for whoever reads the statement.\n\nThe precedence of the NOT operator can also be affected by the\nHIGH_NOT_PRECEDENCE SQL_MODE flag.\n\nOther uses\n----------\n\nParentheses must always be used to enclose subqueries.\n\nParentheses can also be used in a JOIN statement between multiple tables to\ndetermine which tables must be joined first.\n\nAlso, parentheses are used to enclose the list of parameters to be passed to\nbuilt-in functions, user-defined functions and stored routines. However, when\nno parameter is passed to a stored procedure, parentheses are optional. For\nbuiltin functions and user-defined functions, spaces are not allowed between\nthe function name and the open parenthesis, unless the IGNORE_SPACE SQL_MODE\nis set. For stored routines (and for functions if IGNORE_SPACE is set) spaces\nare allowed before the open parenthesis, including tab characters and new line\ncharacters.\n\nSyntax errors\n-------------\n\nIf there are more open parentheses than closed parentheses, the error usually\nlooks like this:\n\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that\ncorresponds to your MariaDB server version for the right syntax to use near \'\'\na\nt line 1\n\nNote the empty string.\n\nIf there are more closed parentheses than open parentheses, the error usually\nlooks like this:\n\nERROR 1064 (42000): You have an error in your SQL syntax; check the manual that\ncorresponds to your MariaDB server version for the right syntax to use near \')\'\nat line 1\n\nNote the quoted closed parenthesis.\n\nURL: https://mariadb.com/kb/en/parentheses/','','https://mariadb.com/kb/en/parentheses/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (244,20,'TRUE FALSE','Description\n-----------\n\nThe constants TRUE and FALSE evaluate to 1 and 0, respectively. The constant\nnames can be written in any lettercase.\n\nExamples\n--------\n\nSELECT TRUE, true, FALSE, false;\n+------+------+-------+-------+\n| TRUE | TRUE | FALSE | FALSE |\n+------+------+-------+-------+\n| 1 | 1 | 0 | 0 |\n+------+------+-------+-------+\n\nURL: https://mariadb.com/kb/en/true-false/','','https://mariadb.com/kb/en/true-false/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (245,21,'ANALYZE TABLE','Syntax\n------\n\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name [,tbl_name ...] \n [PERSISTENT FOR [ALL|COLUMNS ([col_name [,col_name ...]])]\n [INDEXES ([index_name [,index_name ...]])]]\n\nDescription\n-----------\n\nANALYZE TABLE analyzes and stores the key distribution for a table (index\nstatistics). This statement works with MyISAM, Aria and InnoDB tables. During\nthe analysis, InnoDB will allow reads/writes, and MyISAM/Aria reads/inserts.\nFor MyISAM tables, this statement is equivalent to using myisamchk --analyze.\n\nFor more information on how the analysis works within InnoDB, see InnoDB\nLimitations.\n\nMariaDB uses the stored key distribution to decide the order in which tables\nshould be joined when you perform a join on something other than a constant.\nIn addition, key distributions can be used when deciding which indexes to use\nfor a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBy default, ANALYZE TABLE statements are written to the binary log and will be\nreplicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the\nstatement is not written to the binary log.\n\nFrom MariaDB 10.3.19, ANALYZE TABLE statements are not logged to the binary\nlog if read_only is set. See also Read-Only Replicas.\n\nANALYZE TABLE is also supported for partitioned tables. You can use ALTER\nTABLE ... ANALYZE PARTITION to analyze one or more partitions.\n\nThe Aria storage engine supports progress reporting for the ANALYZE TABLE\nstatement.\n\nEngine-Independent Statistics\n-----------------------------\n\nANALYZE TABLE supports engine-independent statistics. See Engine-Independent\nTable Statistics: Collecting Statistics with the ANALYZE TABLE Statement for\nmore information.\n\nUseful Variables\n----------------\n\nFor calculating the number of duplicates, ANALYZE TABLE uses a buffer of\nsort_buffer_size bytes per column. You can slightly increase the speed of\nANALYZE TABLE by increasing this variable.\n\nURL: https://mariadb.com/kb/en/analyze-table/','','https://mariadb.com/kb/en/analyze-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (246,21,'CHECK TABLE','Syntax\n------\n\nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n\noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}\n\nDescription\n-----------\n\nCHECK TABLE checks a table or tables for errors. CHECK TABLE works for\nArchive, Aria, CSV, InnoDB and MyISAM tables. For Aria and MyISAM tables, the\nkey statistics are updated as well. For CSV, see also Checking and Repairing\nCSV Tables.\n\nAs an alternative, myisamchk is a commandline tool for checking MyISAM tables\nwhen the tables are not being accessed. For Aria tables, there is a similar\ntool: aria_chk.\n\nFor checking dynamic columns integrity, COLUMN_CHECK() can be used.\n\nCHECK TABLE can also check views for problems, such as tables that are\nreferenced in the view definition that no longer exist.\n\nCHECK TABLE is also supported for partitioned tables. You can use ALTER TABLE\n... CHECK PARTITION to check one or more partitions.\n\nThe meaning of the different options are as follows - note that this can vary\na bit between storage engines:\n\n+-----+----------------------------------------------------------------------+\n| FOR | Do a very quick check if the storage format for the table has |\n| UPG | changed so that one needs to do a REPAIR. This is only needed when |\n| ADE | one upgrades between major versions of MariaDB or MySQL. This is |\n| | usually done by running mysql_upgrade. |\n+-----+----------------------------------------------------------------------+\n| FAS | Only check tables that has not been closed properly or are marked |\n| | as corrupt. Only supported by the MyISAM and Aria engines. For |\n| | other engines the table is checked normally |\n+-----+----------------------------------------------------------------------+\n| CHA | Check only tables that has changed since last REPAIR / CHECK. Only |\n| GED | supported by the MyISAM and Aria engines. For other engines the |\n| | table is checked normally. |\n+-----+----------------------------------------------------------------------+\n| QUI | Do a fast check. For MyISAM and Aria, this means skipping the check |\n| K | of the delete link chain, which may take some time. |\n+-----+----------------------------------------------------------------------+\n| MED | Scan also the data files. Checks integrity between data and index |\n| UM | files with checksums. In most cases this should find all possible |\n| | errors. |\n+-----+----------------------------------------------------------------------+\n| EXT | Does a full check to verify every possible error. For MyISAM and |\n| NDE | Aria, verify for each row that all it keys exists and points to the |\n| | row. This may take a long time on large tables. Ignored by InnoDB |\n| | before MariaDB 10.6.11, MariaDB 10.7.7, MariaDB 10.8.6 and MariaDB |\n| | 10.9.4. |\n+-----+----------------------------------------------------------------------+\n\nFor most cases running CHECK TABLE without options or MEDIUM should be good\nenough.\n\nThe Aria storage engine supports progress reporting for this statement.\n\nIf you want to know if two tables are identical, take a look at CHECKSUM TABLE.\n\nInnoDB\n------\n\nIf CHECK TABLE finds an error in an InnoDB table, MariaDB might shutdown to\nprevent the error propagation. In this case, the problem will be reported in\nthe error log. Otherwise the table or an index might be marked as corrupted,\nto prevent use. This does not happen with some minor problems, like a wrong\nnumber of entries in a secondary index. Those problems are reported in the\noutput of CHECK TABLE.\n\nEach tablespace contains a header with metadata. This header is not checked by\nthis statement.\n\nDuring the execution of CHECK TABLE, other threads may be blocked.\n\nURL: https://mariadb.com/kb/en/check-table/','','https://mariadb.com/kb/en/check-table/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (245,21,'ANALYZE TABLE','Syntax\n------\n\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name [,tbl_name ...]\n [PERSISTENT FOR\n { ALL\n | COLUMNS ([col_name [,col_name ...]]) INDEXES ([index_name [,index_name\n...]])\n }\n ]\n\nDescription\n-----------\n\nANALYZE TABLE analyzes and stores the key distribution for a table (index\nstatistics). This statement works with MyISAM, Aria and InnoDB tables. During\nthe analysis, InnoDB will allow reads/writes, and MyISAM/Aria reads/inserts.\nFor MyISAM tables, this statement is equivalent to using myisamchk --analyze.\n\nFor more information on how the analysis works within InnoDB, see InnoDB\nLimitations.\n\nMariaDB uses the stored key distribution to decide the order in which tables\nshould be joined when you perform a join on something other than a constant.\nIn addition, key distributions can be used when deciding which indexes to use\nfor a specific table within a query.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBy default, ANALYZE TABLE statements are written to the binary log and will be\nreplicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the\nstatement is not written to the binary log.\n\nFrom MariaDB 10.3.19, ANALYZE TABLE statements are not logged to the binary\nlog if read_only is set. See also Read-Only Replicas.\n\nANALYZE TABLE is also supported for partitioned tables. You can use ALTER\nTABLE ... ANALYZE PARTITION to analyze one or more partitions.\n\nThe Aria storage engine supports progress reporting for the ANALYZE TABLE\nstatement.\n\nEngine-Independent Statistics\n-----------------------------\n\nANALYZE TABLE supports engine-independent statistics. See Engine-Independent\nTable Statistics: Collecting Statistics with the ANALYZE TABLE Statement for\nmore information.\n\nUseful Variables\n----------------\n\nFor calculating the number of duplicates, ANALYZE TABLE uses a buffer of\nsort_buffer_size bytes per column. You can slightly increase the speed of\nANALYZE TABLE by increasing this variable.\n\nExamples\n--------\n\n-- update all engine-independent statistics for all columns and indexes\nANALYZE TABLE tbl PERSISTENT FOR ALL;\n\n-- update specific columns and indexes:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS (col1,col2,...) INDEXES\n(idx1,idx2,...);\n\n-- empty lists are allowed:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS (col1,col2,...) INDEXES ();\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS () INDEXES (idx1,idx2,...);\n\n-- the following will only update mysql.table_stats fields:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS () INDEXES ();\n\n-- when use_stat_tables is set to \'COMPLEMENTARY\' or \'PREFERABLY\', \n-- a simple ANALYZE TABLE collects engine-independent statistics for all\ncolumns and indexes.\nSET SESSION use_stat_tables=\'COMPLEMENTARY\';\nANALYZE TABLE tbl;\n\nURL: https://mariadb.com/kb/en/analyze-table/','','https://mariadb.com/kb/en/analyze-table/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (246,21,'CHECK TABLE','Syntax\n------\n\nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n\noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}\n\nDescription\n-----------\n\nCHECK TABLE checks a table or tables for errors. CHECK TABLE works for\nArchive, Aria, CSV, InnoDB and MyISAM tables. For Aria and MyISAM tables, the\nkey statistics are updated as well. For CSV, see also Checking and Repairing\nCSV Tables.\n\nAs an alternative, myisamchk is a commandline tool for checking MyISAM tables\nwhen the tables are not being accessed. For Aria tables, there is a similar\ntool: aria_chk.\n\nFor checking dynamic columns integrity, COLUMN_CHECK() can be used.\n\nCHECK TABLE can also check views for problems, such as tables that are\nreferenced in the view definition that no longer exist.\n\nCHECK TABLE is also supported for partitioned tables. You can use ALTER TABLE\n... CHECK PARTITION to check one or more partitions.\n\nThe meaning of the different options are as follows - note that this can vary\na bit between storage engines:\n\n+-----+----------------------------------------------------------------------+\n| FOR | Do a very quick check if the storage format for the table has |\n| UPG | changed so that one needs to do a REPAIR. This is only needed when |\n| ADE | one upgrades between major versions of MariaDB or MySQL. This is |\n| | usually done by running mysql_upgrade. |\n+-----+----------------------------------------------------------------------+\n| FAS | Only check tables that has not been closed properly or are marked |\n| | as corrupt. Only supported by the MyISAM and Aria engines. For |\n| | other engines the table is checked normally |\n+-----+----------------------------------------------------------------------+\n| CHA | Check only tables that has changed since last REPAIR / CHECK. Only |\n| GED | supported by the MyISAM and Aria engines. For other engines the |\n| | table is checked normally. |\n+-----+----------------------------------------------------------------------+\n| QUI | Do a fast check. For MyISAM and Aria, this means skipping the check |\n| K | of the delete link chain, which may take some time. |\n+-----+----------------------------------------------------------------------+\n| MED | Scan also the data files. Checks integrity between data and index |\n| UM | files with checksums. In most cases this should find all possible |\n| | errors. |\n+-----+----------------------------------------------------------------------+\n| EXT | Does a full check to verify every possible error. For InnoDB, Aria, |\n| NDE | and MyISAM, verify for each row that all its keys exists, and for |\n| | those index keys, they point back to the primary clustered key. |\n| | This may take a long time on large tables. This option was |\n| | previously ignored by InnoDB before MariaDB 10.6.11, MariaDB |\n| | 10.7.7, MariaDB 10.8.6 and MariaDB 10.9.4. |\n+-----+----------------------------------------------------------------------+\n\nFor most cases running CHECK TABLE without options or MEDIUM should be good\nenough.\n\nThe Aria storage engine supports progress reporting for this statement.\n\nIf you want to know if two tables are identical, take a look at CHECKSUM TABLE.\n\nInnoDB\n------\n\nIf CHECK TABLE finds an error in an InnoDB table, MariaDB might shutdown to\nprevent the error propagation. In this case, the problem will be reported in\nthe error log. Otherwise the table or an index might be marked as corrupted,\nto prevent use. This does not happen with some minor problems, like a wrong\nnumber of entries in a secondary index. Those problems are reported in the\noutput of CHECK TABLE.\n\nEach tablespace contains a header with metadata. This header is not checked by\nthis statement.\n\nDuring the execution of CHECK TABLE, other threads may be blocked.\n\nURL: https://mariadb.com/kb/en/check-table/','','https://mariadb.com/kb/en/check-table/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (247,21,'CHECK VIEW','Syntax\n------\n\nCHECK VIEW view_name\n\nDescription\n-----------\n\nThe CHECK VIEW statement was introduced in MariaDB 10.0.18 to assist with\nfixing MDEV-6916, an issue introduced in MariaDB 5.2 where the view algorithms\nwere swapped. It checks whether the view algorithm is correct. It is run as\npart of mysql_upgrade, and should not normally be required in regular use.\n\nURL: https://mariadb.com/kb/en/check-view/','','https://mariadb.com/kb/en/check-view/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (248,21,'CHECKSUM TABLE','Syntax\n------\n\nCHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ]\n\nDescription\n-----------\n\nCHECKSUM TABLE reports a table checksum. This is very useful if you want to\nknow if two tables are the same (for example on a master and slave).\n\nWith QUICK, the live table checksum is reported if it is available, or NULL\notherwise. This is very fast. A live checksum is enabled by specifying the\nCHECKSUM=1 table option when you create the table; currently, this is\nsupported only for Aria and MyISAM tables.\n\nWith EXTENDED, the entire table is read row by row and the checksum is\ncalculated. This can be very slow for large tables.\n\nIf neither QUICK nor EXTENDED is specified, MariaDB returns a live checksum if\nthe table storage engine supports it and scans the table otherwise.\n\nCHECKSUM TABLE requires the SELECT privilege for the table.\n\nFor a nonexistent table, CHECKSUM TABLE returns NULL and generates a warning.\n\nThe table row format affects the checksum value. If the row format changes,\nthe checksum will change. This means that when a table created with a\nMariaDB/MySQL version is upgraded to another version, the checksum value will\nprobably change.\n\nTwo identical tables should always match to the same checksum value; however,\nalso for non-identical tables there is a very slight chance that they will\nreturn the same value as the hashing algorithm is not completely\ncollision-free.\n\nIdentical Tables\n----------------\n\nIdentical tables mean that the CREATE statement is identical and that the\nfollowing variable, which affects the storage formats, was the same when the\ntables were created:\n\n* mysql56-temporal-format\n\nDifferences Between MariaDB and MySQL\n-------------------------------------\n\nCHECKSUM TABLE may give a different result as MariaDB doesn\'t ignore NULLs in\nthe columns as MySQL 5.1 does (Later MySQL versions should calculate checksums\nthe same way as MariaDB). You can get the \'old style\' checksum in MariaDB by\nstarting mysqld with the --old option. Note however that that the MyISAM and\nAria storage engines in MariaDB are using the new checksum internally, so if\nyou are using --old, the CHECKSUM command will be slower as it needs to\ncalculate the checksum row by row. Starting from MariaDB Server 10.9, --old is\ndeprecated and will be removed in a future release. Set --old-mode or OLD_MODE\nto COMPAT_5_1_CHECKSUM to get \'old style\' checksum.\n\nURL: https://mariadb.com/kb/en/checksum-table/','','https://mariadb.com/kb/en/checksum-table/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (249,21,'OPTIMIZE TABLE','Syntax\n------\n\nOPTIMIZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE\n tbl_name [, tbl_name] ...\n [WAIT n | NOWAIT]\n\nDescription\n-----------\n\nOPTIMIZE TABLE has two main functions. It can either be used to defragment\ntables, or to update the InnoDB fulltext index.\n\nMariaDB starting with 10.3.0\n----------------------------\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nDefragmenting\n-------------\n\nOPTIMIZE TABLE works for InnoDB (before MariaDB 10.1.1, only if the\ninnodb_file_per_table server system variable is set), Aria, MyISAM and ARCHIVE\ntables, and should be used if you have deleted a large part of a table or if\nyou have made many changes to a table with variable-length rows (tables that\nhave VARCHAR, VARBINARY, BLOB, or TEXT columns). Deleted rows are maintained\nin a linked list and subsequent INSERT operations reuse old row positions.\n\nThis statement requires SELECT and INSERT privileges for the table.\n\nBy default, OPTIMIZE TABLE statements are written to the binary log and will\nbe replicated. The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure\nthe statement is not written to the binary log.\n\nFrom MariaDB 10.3.19, OPTIMIZE TABLE statements are not logged to the binary\nlog if read_only is set. See also Read-Only Replicas.\n\nOPTIMIZE TABLE is also supported for partitioned tables. You can use ALTER\nTABLE ... OPTIMIZE PARTITION to optimize one or more partitions.\n\nYou can use OPTIMIZE TABLE to reclaim the unused space and to defragment the\ndata file. With other storage engines, OPTIMIZE TABLE does nothing by default,\nand returns this message: \" The storage engine for the table doesn\'t support\noptimize\". However, if the server has been started with the --skip-new option,\nOPTIMIZE TABLE is linked to ALTER TABLE, and recreates the table. This\noperation frees the unused space and updates index statistics.\n\nThe Aria storage engine supports progress reporting for this statement.\n\nIf a MyISAM table is fragmented, concurrent inserts will not be performed\nuntil an OPTIMIZE TABLE statement is executed on that table, unless the\nconcurrent_insert server system variable is set to ALWAYS.\n\nUpdating an InnoDB fulltext index\n---------------------------------\n\nWhen rows are added or deleted to an InnoDB fulltext index, the index is not\nimmediately re-organized, as this can be an expensive operation. Change\nstatistics are stored in a separate location . The fulltext index is only\nfully re-organized when an OPTIMIZE TABLE statement is run.\n\nBy default, an OPTIMIZE TABLE will defragment a table. In order to use it to\nupdate fulltext index statistics, the innodb_optimize_fulltext_only system\nvariable must be set to 1. This is intended to be a temporary setting, and\nshould be reset to 0 once the fulltext index has been re-organized.\n\nSince fulltext re-organization can take a long time, the\ninnodb_ft_num_word_optimize variable limits the re-organization to a number of\nwords (2000 by default). You can run multiple OPTIMIZE statements to fully\nre-organize the index.\n\nDefragmenting InnoDB tablespaces\n--------------------------------\n\nMariaDB 10.1.1 merged the Facebook/Kakao defragmentation patch, allowing one\nto use OPTIMIZE TABLE to defragment InnoDB tablespaces. For this functionality\nto be enabled, the innodb_defragment system variable must be enabled. No new\ntables are created and there is no need to copy data from old tables to new\ntables. Instead, this feature loads n pages (determined by\ninnodb-defragment-n-pages) and tries to move records so that pages would be\nfull of records and then frees pages that are fully empty after the operation.\nNote that tablespace files (including ibdata1) will not shrink as the result\nof defragmentation, but one will get better memory utilization in the InnoDB\nbuffer pool as there are fewer data pages in use.\n\nSee Defragmenting InnoDB Tablespaces for more details.\n\nURL: https://mariadb.com/kb/en/optimize-table/','','https://mariadb.com/kb/en/optimize-table/'); @@ -779,7 +779,7 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (675,36,'RIGHT','Syntax\n------\n\nRIGHT(str,len)\n\nDescription\n-----------\n\nReturns the rightmost len characters from the string str, or NULL if any\nargument is NULL.\n\nExamples\n--------\n\nSELECT RIGHT(\'MariaDB\', 2);\n+---------------------+\n| RIGHT(\'MariaDB\', 2) |\n+---------------------+\n| DB |\n+---------------------+\n\nURL: https://mariadb.com/kb/en/right/','','https://mariadb.com/kb/en/right/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (676,36,'RPAD','Syntax\n------\n\nRPAD(str, len [, padstr])\n\nDescription\n-----------\n\nReturns the string str, right-padded with the string padstr to a length of len\ncharacters. If str is longer than len, the return value is shortened to len\ncharacters. If padstr is omitted, the RPAD function pads spaces.\n\nPrior to MariaDB 10.3.1, the padstr parameter was mandatory.\n\nReturns NULL if given a NULL argument. If the result is empty (a length of\nzero), returns either an empty string, or, from MariaDB 10.3.6 with\nSQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using RPAD_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT RPAD(\'hello\',10,\'.\');\n+----------------------+\n| RPAD(\'hello\',10,\'.\') |\n+----------------------+\n| hello..... |\n+----------------------+\n\nSELECT RPAD(\'hello\',2,\'.\');\n+---------------------+\n| RPAD(\'hello\',2,\'.\') |\n+---------------------+\n| he |\n+---------------------+\n\nFrom MariaDB 10.3.1, with the pad string defaulting to space.\n\nSELECT RPAD(\'hello\',30);\n+--------------------------------+\n| RPAD(\'hello\',30) |\n+--------------------------------+\n| hello |\n+--------------------------------+\n\nOracle mode version from MariaDB 10.3.6:\n\nSELECT RPAD(\'\',0),RPAD_ORACLE(\'\',0);\n+------------+-------------------+\n| RPAD(\'\',0) | RPAD_ORACLE(\'\',0) |\n+------------+-------------------+\n| | NULL |\n+------------+-------------------+\n\nURL: https://mariadb.com/kb/en/rpad/','','https://mariadb.com/kb/en/rpad/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (677,36,'RTRIM','Syntax\n------\n\nRTRIM(str)\n\nDescription\n-----------\n\nReturns the string str with trailing space characters removed.\n\nReturns NULL if given a NULL argument. If the result is empty, returns either\nan empty string, or, from MariaDB 10.3.6 with SQL_MODE=Oracle, NULL.\n\nThe Oracle mode version of the function can be accessed outside of Oracle mode\nby using RTRIM_ORACLE as the function name.\n\nExamples\n--------\n\nSELECT QUOTE(RTRIM(\'MariaDB \'));\n+-----------------------------+\n| QUOTE(RTRIM(\'MariaDB \')) |\n+-----------------------------+\n| \'MariaDB\' |\n+-----------------------------+\n\nOracle mode version from MariaDB 10.3.6:\n\nSELECT RTRIM(\'\'),RTRIM_ORACLE(\'\');\n+-----------+------------------+\n| RTRIM(\'\') | RTRIM_ORACLE(\'\') |\n+-----------+------------------+\n| | NULL |\n+-----------+------------------+\n\nURL: https://mariadb.com/kb/en/rtrim/','','https://mariadb.com/kb/en/rtrim/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (678,36,'SFORMAT','MariaDB starting with 10.7.0\n----------------------------\nSFORMAT was added in MariaDB 10.7.0.\n\nDescription\n-----------\n\nThe SFORMAT function takes an input string and a formatting specification and\nreturns the string formatted using the rules the user passed in the\nspecification.\n\nIt use the fmtlib library for Python-like (as well as Rust, C++20, etc) string\nformatting.\n\nOnly fmtlib 7.0.0+ is supported.\n\nThere is no native support for temporal and decimal values:\n\n* TIME_RESULT is handled as STRING_RESULT\n* DECIMAL_RESULT as REAL_RESULT\n\nExamples\n--------\n\nSELECT SFORMAT(\"The answer is {}.\", 42);\n+----------------------------------+\n| SFORMAT(\"The answer is {}.\", 42) |\n+----------------------------------+\n| The answer is 42. |\n+----------------------------------+\n\nCREATE TABLE test_sformat(mdb_release char(6), mdev int, feature char(20));\n\nINSERT INTO test_sformat VALUES(\'10.7.0\', 25015, \'Python style sformat\'), \n (\'10.7.0\', 4958, \'UUID\');\n\nSELECT * FROM test_sformat;\n+-------------+-------+----------------------+\n| mdb_release | mdev | feature |\n+-------------+-------+----------------------+\n| 10.7.0 | 25015 | Python style sformat |\n| 10.7.0 | 4958 | UUID |\n+-------------+-------+----------------------+\n\nSELECT SFORMAT(\'MariaDB Server {} has a preview for MDEV-{} which is about\n{}\', \n mdb_release, mdev, feature) AS \'Preview Release Examples\'\n FROM test_sformat;\n+------------------------------------------------------------------------------\n---------+\n| Preview Release Examples \n |\n+------------------------------------------------------------------------------\n---------+\n| MariaDB Server 10.7.0 has a preview for MDEV-25015 which is about Python\nstyle sformat |\n| MariaDB Server 10.7.0 has a preview for MDEV-4958 which is about UUID \n |\n+------------------------------------------------------------------------------\n---------+\n\nURL: https://mariadb.com/kb/en/sformat/','','https://mariadb.com/kb/en/sformat/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (678,36,'SFORMAT','MariaDB starting with 10.7.0\n----------------------------\nSFORMAT was added in MariaDB 10.7.0.\n\nDescription\n-----------\n\nThe SFORMAT function takes an input string and a formatting specification and\nreturns the string formatted using the rules the user passed in the\nspecification.\n\nIt uses the fmtlib library for Python-like (as well as Rust, C++20, etc)\nstring formatting.\n\nOnly fmtlib 7.0.0+ is supported.\n\nThere is no native support for temporal and decimal values:\n\n* TIME_RESULT is handled as STRING_RESULT\n* DECIMAL_RESULT as REAL_RESULT\n\nExamples\n--------\n\nSELECT SFORMAT(\"The answer is {}.\", 42);\n+----------------------------------+\n| SFORMAT(\"The answer is {}.\", 42) |\n+----------------------------------+\n| The answer is 42. |\n+----------------------------------+\n\nCREATE TABLE test_sformat(mdb_release char(6), mdev int, feature char(20));\n\nINSERT INTO test_sformat VALUES(\'10.7.0\', 25015, \'Python style sformat\'), \n (\'10.7.0\', 4958, \'UUID\');\n\nSELECT * FROM test_sformat;\n+-------------+-------+----------------------+\n| mdb_release | mdev | feature |\n+-------------+-------+----------------------+\n| 10.7.0 | 25015 | Python style sformat |\n| 10.7.0 | 4958 | UUID |\n+-------------+-------+----------------------+\n\nSELECT SFORMAT(\'MariaDB Server {} has a preview for MDEV-{} which is about\n{}\', \n mdb_release, mdev, feature) AS \'Preview Release Examples\'\n FROM test_sformat;\n+------------------------------------------------------------------------------\n---------+\n| Preview Release Examples \n |\n+------------------------------------------------------------------------------\n---------+\n| MariaDB Server 10.7.0 has a preview for MDEV-25015 which is about Python\nstyle sformat |\n| MariaDB Server 10.7.0 has a preview for MDEV-4958 which is about UUID \n |\n+------------------------------------------------------------------------------\n---------+\n\nURL: https://mariadb.com/kb/en/sformat/','','https://mariadb.com/kb/en/sformat/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (679,36,'SOUNDEX','Syntax\n------\n\nSOUNDEX(str)\n\nDescription\n-----------\n\nReturns a soundex string from str. Two strings that sound almost the same\nshould have identical soundex strings. A standard soundex string is four\ncharacters long, but the SOUNDEX() function returns an arbitrarily long\nstring. You can use SUBSTRING() on the result to get a standard soundex\nstring. All non-alphabetic characters in str are ignored. All international\nalphabetic characters outside the A-Z range are treated as vowels.\n\nImportant: When using SOUNDEX(), you should be aware of the following details:\n\n* This function, as currently implemented, is intended to work well with\n strings that are in the English language only. Strings in other languages may\n not produce reasonable results.\n\n* This function implements the original Soundex algorithm, not the more\npopular enhanced version (also described by D. Knuth). The difference is that\noriginal version discards vowels first and duplicates second, whereas the\nenhanced version discards duplicates first and vowels second.\n\nExamples\n--------\n\nSOUNDEX(\'Hello\');\n+------------------+\n| SOUNDEX(\'Hello\') |\n+------------------+\n| H400 |\n+------------------+\n\nSELECT SOUNDEX(\'MariaDB\');\n+--------------------+\n| SOUNDEX(\'MariaDB\') |\n+--------------------+\n| M631 |\n+--------------------+\n\nSELECT SOUNDEX(\'Knowledgebase\');\n+--------------------------+\n| SOUNDEX(\'Knowledgebase\') |\n+--------------------------+\n| K543212 |\n+--------------------------+\n\nSELECT givenname, surname FROM users WHERE SOUNDEX(givenname) =\nSOUNDEX(\"robert\");\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\n+-----------+---------+\n\nURL: https://mariadb.com/kb/en/soundex/','','https://mariadb.com/kb/en/soundex/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (680,36,'SOUNDS LIKE','Syntax\n------\n\nexpr1 SOUNDS LIKE expr2\n\nDescription\n-----------\n\nThis is the same as SOUNDEX(expr1) = SOUNDEX(expr2).\n\nExample\n-------\n\nSELECT givenname, surname FROM users WHERE givenname SOUNDS LIKE \"robert\";\n+-----------+---------+\n| givenname | surname |\n+-----------+---------+\n| Roberto | Castro |\n+-----------+---------+\n\nURL: https://mariadb.com/kb/en/sounds-like/','','https://mariadb.com/kb/en/sounds-like/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (681,36,'SPACE','Syntax\n------\n\nSPACE(N)\n\nDescription\n-----------\n\nReturns a string consisting of N space characters. If N is NULL, returns NULL.\n\nExamples\n--------\n\nSELECT QUOTE(SPACE(6));\n+-----------------+\n| QUOTE(SPACE(6)) |\n+-----------------+\n| \' \' |\n+-----------------+\n\nURL: https://mariadb.com/kb/en/space/','','https://mariadb.com/kb/en/space/'); @@ -810,8 +810,8 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (704,38,'ALTER TABLESPACE','The ALTER TABLESPACE statement is not supported by MariaDB. It was originally\ninherited from MySQL NDB Cluster. In MySQL 5.7 and later, the statement is\nalso supported for InnoDB. However, MariaDB has chosen not to include that\nspecific feature. See MDEV-19294 for more information.\n\nURL: https://mariadb.com/kb/en/alter-tablespace/','','https://mariadb.com/kb/en/alter-tablespace/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (705,38,'ALTER VIEW','Syntax\n------\n\nALTER\n [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}]\n [DEFINER = { user | CURRENT_USER }]\n [SQL SECURITY { DEFINER | INVOKER }]\n VIEW view_name [(column_list)]\n AS select_statement\n [WITH [CASCADED | LOCAL] CHECK OPTION]\n\nDescription\n-----------\n\nThis statement changes the definition of a view, which must exist. The syntax\nis similar to that for CREATE VIEW and the effect is the same as for CREATE OR\nREPLACE VIEW if the view exists. This statement requires the CREATE VIEW and\nDROP privileges for the view, and some privilege for each column referred to\nin the SELECT statement. ALTER VIEW is allowed only to the definer or users\nwith the SUPER privilege.\n\nExample\n-------\n\nALTER VIEW v AS SELECT a, a*3 AS a2 FROM t;\n\nURL: https://mariadb.com/kb/en/alter-view/','','https://mariadb.com/kb/en/alter-view/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (706,38,'CREATE TABLE','Syntax\n------\n\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n (create_definition,...) [table_options ]... [partition_options]\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n [(create_definition,...)] [table_options ]... [partition_options]\n select_statement\nCREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name\n { LIKE old_table_name | (LIKE old_table_name) }\nselect_statement:\n [IGNORE | REPLACE] [AS] SELECT ... (Some legal select statement)\n\nDescription\n-----------\n\nUse the CREATE TABLE statement to create a table with the given name.\n\nIn its most basic form, the CREATE TABLE statement provides a table name\nfollowed by a list of columns, indexes, and constraints. By default, the table\nis created in the default database. Specify a database with db_name.tbl_name.\nIf you quote the table name, you must quote the database name and table name\nseparately as `db_name`.`tbl_name`. This is particularly useful for CREATE\nTABLE ... SELECT, because it allows to create a table into a database, which\ncontains data from other databases. See Identifier Qualifiers.\n\nIf a table with the same name exists, error 1050 results. Use IF NOT EXISTS to\nsuppress this error and issue a note instead. Use SHOW WARNINGS to see notes.\n\nThe CREATE TABLE statement automatically commits the current transaction,\nexcept when using the TEMPORARY keyword.\n\nFor valid identifiers to use as table names, see Identifier Names.\n\nNote: if the default_storage_engine is set to ColumnStore then it needs\nsetting on all UMs. Otherwise when the tables using the default engine are\nreplicated across UMs they will use the wrong engine. You should therefore not\nuse this option as a session variable with ColumnStore.\n\nMicrosecond precision can be between 0-6. If no precision is specified it is\nassumed to be 0, for backward compatibility reasons.\n\nPrivileges\n----------\n\nExecuting the CREATE TABLE statement requires the CREATE privilege for the\ntable or the database.\n\nCREATE OR REPLACE\n-----------------\n\nIf the OR REPLACE clause is used and the table already exists, then instead of\nreturning an error, the server will drop the existing table and replace it\nwith the newly defined table.\n\nThis syntax was originally added to make replication more robust if it has to\nrollback and repeat statements such as CREATE ... SELECT on replicas.\n\nCREATE OR REPLACE TABLE table_name (a int);\n\nis basically the same as:\n\nDROP TABLE IF EXISTS table_name;\nCREATE TABLE table_name (a int);\n\nwith the following exceptions:\n\n* If table_name was locked with LOCK TABLES it will continue to be locked\nafter the statement.\n* Temporary tables are only dropped if the TEMPORARY keyword was used. (With\nDROP TABLE, temporary tables are preferred to be dropped before normal\ntables).\n\nThings to be Aware of With CREATE OR REPLACE\n--------------------------------------------\n\n* The table is dropped first (if it existed), after that the CREATE is done.\nBecause of this, if the CREATE fails, then the table will not exist anymore\nafter the statement. If the table was used with LOCK TABLES it will be\nunlocked.\n* One can\'t use OR REPLACE together with IF EXISTS.\n* Slaves in replication will by default use CREATE OR REPLACE when replicating\nCREATE statements that don\'\'t use IF EXISTS. This can be changed by setting\nthe variable slave-ddl-exec-mode to STRICT.\n\nCREATE TABLE IF NOT EXISTS\n--------------------------\n\nIf the IF NOT EXISTS clause is used, then the table will only be created if a\ntable with the same name does not already exist. If the table already exists,\nthen a warning will be triggered by default.\n\nCREATE TEMPORARY TABLE\n----------------------\n\nUse the TEMPORARY keyword to create a temporary table that is only available\nto the current session. Temporary tables are dropped when the session ends.\nTemporary table names are specific to the session. They will not conflict with\nother temporary tables from other sessions even if they share the same name.\nThey will shadow names of non-temporary tables or views, if they are\nidentical. A temporary table can have the same name as a non-temporary table\nwhich is located in the same database. In that case, their name will reference\nthe temporary table when used in SQL statements. You must have the CREATE\nTEMPORARY TABLES privilege on the database to create temporary tables. If no\nstorage engine is specified, the default_tmp_storage_engine setting will\ndetermine the engine.\n\nROCKSDB temporary tables cannot be created by setting the\ndefault_tmp_storage_engine system variable, or using CREATE TEMPORARY TABLE\nLIKE. Before MariaDB 10.7, they could be specified, but would silently fail,\nand a MyISAM table would be created instead. From MariaDB 10.7 an error is\nreturned. Explicitly creating a temporary table with ENGINE=ROCKSDB has never\nbeen permitted.\n\nCREATE TABLE ... LIKE\n---------------------\n\nUse the LIKE clause instead of a full table definition to create a table with\nthe same definition as another table, including columns, indexes, and table\noptions. Foreign key definitions, as well as any DATA DIRECTORY or INDEX\nDIRECTORY table options specified on the original table, will not be created.\n\nCREATE TABLE ... SELECT\n-----------------------\n\nYou can create a table containing data from other tables using the CREATE ...\nSELECT statement. Columns will be created in the table for each field returned\nby the SELECT query.\n\nYou can also define some columns normally and add other columns from a SELECT.\nYou can also create columns in the normal way and assign them some values\nusing the query, this is done to force a certain type or other field\ncharacteristics. The columns that are not named in the query will be placed\nbefore the others. For example:\n\nCREATE TABLE test (a INT NOT NULL, b CHAR(10)) ENGINE=MyISAM\n SELECT 5 AS b, c, d FROM another_table;\n\nRemember that the query just returns data. If you want to use the same\nindexes, or the same columns attributes ([NOT] NULL, DEFAULT, AUTO_INCREMENT)\nin the new table, you need to specify them manually. Types and sizes are not\nautomatically preserved if no data returned by the SELECT requires the full\nsize, and VARCHAR could be converted into CHAR. The CAST() function can be\nused to forcee the new table to use certain types.\n\nAliases (AS) are taken into account, and they should always be used when you\nSELECT an expression (function, arithmetical operation, etc).\n\nIf an error occurs during the query, the table will not be created at all.\n\nIf the new table has a primary key or UNIQUE indexes, you can use the IGNORE\nor REPLACE keywords to handle duplicate key errors during the query. IGNORE\nmeans that the newer values must not be inserted an identical value exists in\nthe index. REPLACE means that older values must be overwritten.\n\nIf the columns in the new table are more than the rows returned by the query,\nthe columns populated by the query will be placed after other columns. Note\nthat if the strict SQL_MODE is on, and the columns that are not names in the\nquery do not have a DEFAULT value, an error will raise and no rows will be\ncopied.\n\nConcurrent inserts are not used during the execution of a CREATE ... SELECT.\n\nIf the table already exists, an error similar to the following will be\nreturned:\n\nERROR 1050 (42S01): Table \'t\' already exists\n\nIf the IF NOT EXISTS clause is used and the table exists, a note will be\nproduced instead of an error.\n\nTo insert rows from a query into an existing table, INSERT ... SELECT can be\nused.\n\nColumn Definitions\n------------------\n\ncreate_definition:\n { col_name column_definition | index_definition | period_definition | CHECK\n(expr) }\ncolumn_definition:\n data_type\n [NOT NULL | NULL] [DEFAULT default_value | (expression)]\n [ON UPDATE [NOW | CURRENT_TIMESTAMP] [(precision)]]\n [AUTO_INCREMENT] [ZEROFILL] [UNIQUE [KEY] | [PRIMARY] KEY]\n [INVISIBLE] [{WITH|WITHOUT} SYSTEM VERSIONING]\n [COMMENT \'string\'] [REF_SYSTEM_ID = value]\n [reference_definition]\n | data_type [GENERATED ALWAYS]\n AS { { ROW {START|END} } | { (expression) [VIRTUAL | PERSISTENT | STORED] } }\n [UNIQUE [KEY]] [COMMENT \'string\']\nconstraint_definition:\n CONSTRAINT [constraint_name] CHECK (expression)\nNote: Until MariaDB 10.4, MariaDB accepts the shortcut format with a\nREFERENCES clause only in ALTER TABLE and CREATE TABLE statements, but that\nsyntax does nothing. For example:\n\nCREATE TABLE b(for_key INT REFERENCES a(not_key));\n\nMariaDB simply parses it without returning any error or warning, for\ncompatibility with other DBMS\'s. Before MariaDB 10.2.1 this was also true for\nCHECK constraints. However, only the syntax described below creates foreign\nkeys.\n\nFrom MariaDB 10.5, MariaDB will attempt to apply the constraint. See Foreign\nKeys examples.\n\nEach definition either creates a column in the table or specifies and index or\nconstraint on one or more columns. See Indexes below for details on creating\nindexes.\n\nCreate a column by specifying a column name and a data type, optionally\nfollowed by column options. See Data Types for a full list of data types\nallowed in MariaDB.\n\nNULL and NOT NULL\n-----------------\n\nUse the NULL or NOT NULL options to specify that values in the column may or\nmay not be NULL, respectively. By default, values may be NULL. See also NULL\nValues in MariaDB.\n\nDEFAULT Column Option\n---------------------\n\nMariaDB starting with 10.2.1\n----------------------------\nThe DEFAULT clause was enhanced in MariaDB 10.2.1. Some enhancements include\n\n* BLOB and TEXT columns now support DEFAULT.\n* The DEFAULT clause can now be used with an expression or function.\n\nSpecify a default value using the DEFAULT clause. If you don\'t specify DEFAULT\nthen the following rules apply:\n\n* If the column is not defined with NOT NULL, AUTO_INCREMENT or TIMESTAMP, an\nexplicit DEFAULT NULL will be added.\nNote that in MySQL and in MariaDB before 10.1.6, you may get an explicit\nDEFAULT for primary key parts, if not specified with NOT NULL.\n\nThe default value will be used if you INSERT a row without specifying a value\nfor that column, or if you specify DEFAULT for that column. Before MariaDB\n10.2.1 you couldn\'t usually provide an expression or function to evaluate at\ninsertion time. You had to provide a constant default value instead. The one\nexception is that you may use CURRENT_TIMESTAMP as the default value for a\nTIMESTAMP column to use the current timestamp at insertion time.\n\nCURRENT_TIMESTAMP may also be used as the default value for a DATETIME\n\nFrom MariaDB 10.2.1 you can use most functions in DEFAULT. Expressions should\nhave parentheses around them. If you use a non deterministic function in\nDEFAULT then all inserts to the table will be replicated in row mode. You can\neven refer to earlier columns in the DEFAULT expression (excluding\nAUTO_INCREMENT columns):\n\nCREATE TABLE t1 (a int DEFAULT (1+1), b int DEFAULT (a+1));\nCREATE TABLE t2 (a bigint primary key DEFAULT UUID_SHORT());\n\nThe DEFAULT clause cannot contain any stored functions or subqueries, and a\ncolumn used in the clause must already have been defined earlier in the\nstatement.\n\nSince MariaDB 10.2.1, it is possible to assign BLOB or TEXT columns a DEFAULT\nvalue. In earlier versions, assigning a default to these columns was not\npossible.\n\nMariaDB starting with 10.3.3\n----------------------------\nStarting from 10.3.3 you can also use DEFAULT (NEXT VALUE FOR sequence)\n\nAUTO_INCREMENT Column Option\n----------------------------\n\nUse AUTO_INCREMENT to create a column whose value can can be set automatically\nfrom a simple counter. You can only use AUTO_INCREMENT on a column with an\ninteger type. The column must be a key, and there can only be one\nAUTO_INCREMENT column in a table. If you insert a row without specifying a\nvalue for that column (or if you specify 0, NULL, or DEFAULT as the value),\nthe actual value will be taken from the counter, with each insertion\nincrementing the counter by one. You can still insert a value explicitly. If\nyou insert a value that is greater than the current counter value, the counter\nis set based on the new value. An AUTO_INCREMENT column is implicitly NOT\nNULL. Use LAST_INSERT_ID to get the AUTO_INCREMENT value most recently used by\nan INSERT statement.\n\nZEROFILL Column Option\n----------------------\n\nIf the ZEROFILL column option is specified for a column using a numeric data\ntype, then the column will be set to UNSIGNED and the spaces used by default\nto pad the field are replaced with zeros. ZEROFILL is ignored in expressions\nor as part of a UNION. ZEROFILL is a non-standard MySQL and MariaDB\nenhancement.\n\nPRIMARY KEY Column Option\n-------------------------\n\nUse PRIMARY KEY to make a column a primary key. A primary key is a special\ntype of a unique key. There can be at most one primary key per table, and it\nis implicitly NOT NULL.\n\nSpecifying a column as a unique key creates a unique index on that column. See\nthe Index Definitions section below for more information.\n\nUNIQUE KEY Column Option\n------------------------\n\nUse UNIQUE KEY (or just UNIQUE) to specify that all values in the column must\nbe distinct from each other. Unless the column is NOT NULL, there may be\nmultiple rows with NULL in the column.\n\nSpecifying a column as a unique key creates a unique index on that column. See\nthe Index Definitions section below for more information.\n\nCOMMENT Column Option\n---------------------\n\nYou can provide a comment for each column using the COMMENT clause. The\nmaximum length is 1024 characters. Use the SHOW FULL COLUMNS statement to see\ncolumn comments.\n\nREF_SYSTEM_ID\n-------------\n\nREF_SYSTEM_ID can be used to specify Spatial Reference System IDs for spatial\ndata type columns. For example:\n\nCREATE TABLE t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101);\n\nGenerated Columns\n-----------------\n\nA generated column is a column in a table that cannot explicitly be set to a\nspecific value in a DML query. Instead, its value is automatically generated\nbased on an expression. This expression might generate the value based on the\nvalues of other columns in the table, or it might generate the value by\ncalling built-in functions or user-defined functions (UDFs).\n\nThere are two types of generated columns:\n\n* PERSISTENT or STORED: This type\'s value is actually stored in the table.','','https://mariadb.com/kb/en/create-table/'); -update help_topic set description = CONCAT(description, '\n* VIRTUAL: This type\'s value is not stored at all. Instead, the value is\ngenerated dynamically when the table is queried. This type is the default.\n\nGenerated columns are also sometimes called computed columns or virtual\ncolumns.\n\nFor a complete description about generated columns and their limitations, see\nGenerated (Virtual and Persistent/Stored) Columns.\n\nCOMPRESSED\n----------\n\nMariaDB starting with 10.3.3\n----------------------------\nCertain columns may be compressed. See Storage-Engine Independent Column\nCompression.\n\nINVISIBLE\n---------\n\nMariaDB starting with 10.3.3\n----------------------------\nColumns may be made invisible, and hidden in certain contexts. See Invisible\nColumns.\n\nWITH SYSTEM VERSIONING Column Option\n------------------------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nColumns may be explicitly marked as included from system versioning. See\nSystem-versioned tables for details.\n\nWITHOUT SYSTEM VERSIONING Column Option\n---------------------------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nColumns may be explicitly marked as excluded from system versioning. See\nSystem-versioned tables for details.\n\nIndex Definitions\n-----------------\n\nindex_definition:\n {INDEX|KEY} [index_name] [index_type] (index_col_name,...) [index_option]\n...\n {{{|}}} {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)\n[index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)\n[index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name] [index_type]\n(index_col_name,...) [index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name,...)\nreference_definition\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH | RTREE}\n\nindex_option:\n [ KEY_BLOCK_SIZE [=] value\n {{{|}}} index_type\n {{{|}}} WITH PARSER parser_name\n {{{|}}} COMMENT \'string\'\n {{{|}}} CLUSTERING={YES| NO} ]\n [ IGNORED | NOT IGNORED ]\n\nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\nINDEX and KEY are synonyms.\n\nIndex names are optional, if not specified an automatic name will be assigned.\nIndex name are needed to drop indexes and appear in error messages when a\nconstraint is violated.\n\nIndex Categories\n----------------\n\nPlain Indexes\n-------------\n\nPlain indexes are regular indexes that are not unique, and are not acting as a\nprimary key or a foreign key. They are also not the \"specialized\" FULLTEXT or\nSPATIAL indexes.\n\nSee Getting Started with Indexes: Plain Indexes for more information.\n\nPRIMARY KEY\n-----------\n\nFor PRIMARY KEY indexes, you can specify a name for the index, but it is\nignored, and the name of the index is always PRIMARY. From MariaDB 10.3.18 and\nMariaDB 10.4.8, a warning is explicitly issued if a name is specified. Before\nthen, the name was silently ignored.\n\nSee Getting Started with Indexes: Primary Key for more information.\n\nUNIQUE\n------\n\nThe UNIQUE keyword means that the index will not accept duplicated values,\nexcept for NULLs. An error will raise if you try to insert duplicate values in\na UNIQUE index.\n\nFor UNIQUE indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nSee Getting Started with Indexes: Unique Index for more information.\n\nFOREIGN KEY\n-----------\n\nFor FOREIGN KEY indexes, a reference definition must be provided.\n\nFor FOREIGN KEY indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nFirst, you have to specify the name of the target (parent) table and a column\nor a column list which must be indexed and whose values must match to the\nforeign key\'s values. The MATCH clause is accepted to improve the\ncompatibility with other DBMS\'s, but has no meaning in MariaDB. The ON DELETE\nand ON UPDATE clauses specify what must be done when a DELETE (or a REPLACE)\nstatements attempts to delete a referenced row from the parent table, and when\nan UPDATE statement attempts to modify the referenced foreign key columns in a\nparent table row, respectively. The following options are allowed:\n\n* RESTRICT: The delete/update operation is not performed. The statement\nterminates with a 1451 error (SQLSTATE \'2300\').\n* NO ACTION: Synonym for RESTRICT.\n* CASCADE: The delete/update operation is performed in both tables.\n* SET NULL: The update or delete goes ahead in the parent table, and the\ncorresponding foreign key fields in the child table are set to NULL. (They\nmust not be defined as NOT NULL for this to succeed).\n* SET DEFAULT: This option is currently implemented only for the PBXT storage\nengine, which is disabled by default and no longer maintained. It sets the\nchild table\'s foreign key fields to their DEFAULT values when the referenced\nparent table key entries are updated or deleted.\n\nIf either clause is omitted, the default behavior for the omitted clause is\nRESTRICT.\n\nSee Foreign Keys for more information.\n\nFULLTEXT\n--------\n\nUse the FULLTEXT keyword to create full-text indexes.\n\nSee Full-Text Indexes for more information.\n\nSPATIAL\n-------\n\nUse the SPATIAL keyword to create geometric indexes.\n\nSee SPATIAL INDEX for more information.\n\nIndex Options\n-------------\n\nKEY_BLOCK_SIZE Index Option\n---------------------------\n\nThe KEY_BLOCK_SIZE index option is similar to the KEY_BLOCK_SIZE table option.\n\nWith the InnoDB storage engine, if you specify a non-zero value for the\nKEY_BLOCK_SIZE table option for the whole table, then the table will\nimplicitly be created with the ROW_FORMAT table option set to COMPRESSED.\nHowever, this does not happen if you just set the KEY_BLOCK_SIZE index option\nfor one or more indexes in the table. The InnoDB storage engine ignores the\nKEY_BLOCK_SIZE index option. However, the SHOW CREATE TABLE statement may\nstill report it for the index.\n\nFor information about the KEY_BLOCK_SIZE index option, see the KEY_BLOCK_SIZE\ntable option below.\n\nIndex Types\n-----------\n\nEach storage engine supports some or all index types. See Storage Engine Index\nTypes for details on permitted index types for each storage engine.\n\nDifferent index types are optimized for different kind of operations:\n\n* BTREE is the default type, and normally is the best choice. It is supported\nby all storage engines. It can be used to compare a column\'s value with a\nvalue using the =, >, >=, <, <=, BETWEEN, and LIKE operators. BTREE can also\nbe used to find NULL values. Searches against an index prefix are possible.\n* HASH is only supported by the MEMORY storage engine. HASH indexes can only\nbe used for =, <=, and >= comparisons. It can not be used for the ORDER BY\nclause. Searches against an index prefix are not possible.\n* RTREE is the default for SPATIAL indexes, but if the storage engine does not\nsupport it BTREE can be used.\n\nIndex columns names are listed between parenthesis. After each column, a\nprefix length can be specified. If no length is specified, the whole column\nwill be indexed. ASC and DESC can be specified for compatibility with are\nDBMS\'s, but have no meaning in MariaDB.\n\nWITH PARSER Index Option\n------------------------\n\nThe WITH PARSER index option only applies to FULLTEXT indexes and contains the\nfulltext parser name. The fulltext parser must be an installed plugin.\n\nCOMMENT Index Option\n--------------------\n\nA comment of up to 1024 characters is permitted with the COMMENT index option.\n\nThe COMMENT index option allows you to specify a comment with user-readable\ntext describing what the index is for. This information is not used by the\nserver itself.\n\nCLUSTERING Index Option\n-----------------------\n\nThe CLUSTERING index option is only valid for tables using the TokuDB storage\nengine.\n\nIGNORED / NOT IGNORED\n---------------------\n\nMariaDB starting with 10.6.0\n----------------------------\nFrom MariaDB 10.6.0, indexes can be specified to be ignored by the optimizer.\nSee Ignored Indexes.\n\nPeriods\n-------\n\nMariaDB starting with 10.3.4\n----------------------------\n\nperiod_definition:\n PERIOD FOR SYSTEM_TIME (start_column_name, end_column_name)\nMariaDB supports a subset of the standard syntax for periods. At the moment\nit\'s only used for creating System-versioned tables. Both columns must be\ncreated, must be either of a TIMESTAMP(6) or BIGINT UNSIGNED type, and be\ngenerated as ROW START and ROW END accordingly. See System-versioned tables\nfor details.\n\nThe table must also have the WITH SYSTEM VERSIONING clause.\n\nConstraint Expressions\n----------------------\n\nMariaDB starting with 10.2.1\n----------------------------\nMariaDB 10.2.1 introduced new ways to define a constraint.\n\nNote: Before MariaDB 10.2.1, constraint expressions were accepted in the\nsyntax but ignored.\n\nMariaDB 10.2.1 introduced two ways to define a constraint:\n\n* CHECK(expression) given as part of a column definition.\n* CONSTRAINT [constraint_name] CHECK (expression)\n\nBefore a row is inserted or updated, all constraints are evaluated in the\norder they are defined. If any constraints fails, then the row will not be\nupdated. One can use most deterministic functions in a constraint, including\nUDFs.\n\ncreate table t1 (a int check(a>0) ,b int check (b> 0), constraint abc check\n(a>b));\n\nIf you use the second format and you don\'t give a name to the constraint, then\nthe constraint will get a auto generated name. This is done so that you can\nlater delete the constraint with ALTER TABLE DROP constraint_name.\n\nOne can disable all constraint expression checks by setting the variable\ncheck_constraint_checks to OFF. This is useful for example when loading a\ntable that violates some constraints that you want to later find and fix in\nSQL.\n\nSee CONSTRAINT for more information.\n\nTable Options\n-------------\n\nFor each individual table you create (or alter), you can set some table\noptions. The general syntax for setting options is:\n\n<OPTION_NAME> = <option_value>, [<OPTION_NAME> = <option_value> ...]\n\nThe equal sign is optional.\n\nSome options are supported by the server and can be used for all tables, no\nmatter what storage engine they use; other options can be specified for all\nstorage engines, but have a meaning only for some engines. Also, engines can\nextend CREATE TABLE with new options.\n\nIf the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is enabled, wrong table options\ngenerate a warning; otherwise, they generate an error.\n\ntable_option: \n [STORAGE] ENGINE [=] engine_name\n | AUTO_INCREMENT [=] value\n | AVG_ROW_LENGTH [=] value\n | [DEFAULT] CHARACTER SET [=] charset_name\n | CHECKSUM [=] {0 | 1}\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'string\'\n | CONNECTION [=] \'connect_string\'\n | DATA DIRECTORY [=] \'absolute path to directory\'\n | DELAY_KEY_WRITE [=] {0 | 1}\n | ENCRYPTED [=] {YES | NO}\n | ENCRYPTION_KEY_ID [=] value\n | IETF_QUOTES [=] {YES | NO}\n | INDEX DIRECTORY [=] \'absolute path to directory\'\n | INSERT_METHOD [=] { NO | FIRST | LAST }\n | KEY_BLOCK_SIZE [=] value\n | MAX_ROWS [=] value\n | MIN_ROWS [=] value\n | PACK_KEYS [=] {0 | 1 | DEFAULT}\n | PAGE_CHECKSUM [=] {0 | 1}\n | PAGE_COMPRESSED [=] {0 | 1}\n | PAGE_COMPRESSION_LEVEL [=] {0 .. 9}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT|PAGE}\n | SEQUENCE [=] {0|1}\n | STATS_AUTO_RECALC [=] {DEFAULT|0|1}\n | STATS_PERSISTENT [=] {DEFAULT|0|1}\n | STATS_SAMPLE_PAGES [=] {DEFAULT|value}\n | TABLESPACE tablespace_name\n | TRANSACTIONAL [=] {0 | 1}\n | UNION [=] (tbl_name[,tbl_name]...)\n | WITH SYSTEM VERSIONING\n\n[STORAGE] ENGINE\n----------------\n\n[STORAGE] ENGINE specifies a storage engine for the table. If this option is\nnot used, the default storage engine is used instead. That is, the\ndefault_storage_engine session option value if it is set, or the value\nspecified for the --default-storage-engine mysqld startup option, or the\ndefault storage engine, InnoDB. If the specified storage engine is not\ninstalled and active, the default value will be used, unless the\nNO_ENGINE_SUBSTITUTION SQL MODE is set (default). This is only true for CREATE\nTABLE, not for ALTER TABLE. For a list of storage engines that are present in\nyour server, issue a SHOW ENGINES.\n\nAUTO_INCREMENT\n--------------\n\nAUTO_INCREMENT specifies the initial value for the AUTO_INCREMENT primary key.\nThis works for MyISAM, Aria, InnoDB, MEMORY, and ARCHIVE tables. You can\nchange this option with ALTER TABLE, but in that case the new value must be\nhigher than the highest value which is present in the AUTO_INCREMENT column.\nIf the storage engine does not support this option, you can insert (and then\ndelete) a row having the wanted value - 1 in the AUTO_INCREMENT column.\n\nAVG_ROW_LENGTH\n--------------\n\nAVG_ROW_LENGTH is the average rows size. It only applies to tables using\nMyISAM and Aria storage engines that have the ROW_FORMAT table option set to\nFIXED format.\n\nMyISAM uses MAX_ROWS and AVG_ROW_LENGTH to decide the maximum size of a table\n(default: 256TB, or the maximum file size allowed by the system).\n\n[DEFAULT] CHARACTER SET/CHARSET\n-------------------------------\n\n[DEFAULT] CHARACTER SET (or [DEFAULT] CHARSET) is used to set a default\ncharacter set for the table. This is the character set used for all columns\nwhere an explicit character set is not specified. If this option is omitted or\nDEFAULT is specified, database\'s default character set will be used. See\nSetting Character Sets and Collations for details on setting the character\nsets.\n\nCHECKSUM/TABLE_CHECKSUM\n-----------------------\n\nCHECKSUM (or TABLE_CHECKSUM) can be set to 1 to maintain a live checksum for\nall table\'s rows. This makes write operations slower, but CHECKSUM TABLE will\nbe very fast. This option is only supported for MyISAM and Aria tables.\n\n[DEFAULT] COLLATE\n-----------------\n\n[DEFAULT] COLLATE is used to set a default collation for the table. This is\nthe collation used for all columns where an explicit character set is not\nspecified. If this option is omitted or DEFAULT is specified, database\'s') WHERE help_topic_id = 706; -update help_topic set description = CONCAT(description, '\ndefault option will be used. See Setting Character Sets and Collations for\ndetails on setting the collations\n\nCOMMENT\n-------\n\nCOMMENT is a comment for the table. The maximum length is 2048 characters.\nAlso used to define table parameters when creating a Spider table.\n\nCONNECTION\n----------\n\nCONNECTION is used to specify a server name or a connection string for a\nSpider, CONNECT, Federated or FederatedX table.\n\nDATA DIRECTORY/INDEX DIRECTORY\n------------------------------\n\nDATA DIRECTORY and INDEX DIRECTORY are supported for MyISAM and Aria, and DATA\nDIRECTORY is also supported by InnoDB if the innodb_file_per_table server\nsystem variable is enabled, but only in CREATE TABLE, not in ALTER TABLE. So,\ncarefully choose a path for InnoDB tables at creation time, because it cannot\nbe changed without dropping and re-creating the table. These options specify\nthe paths for data files and index files, respectively. If these options are\nomitted, the database\'s directory will be used to store data files and index\nfiles. Note that these table options do not work for partitioned tables (use\nthe partition options instead), or if the server has been invoked with the\n--skip-symbolic-links startup option. To avoid the overwriting of old files\nwith the same name that could be present in the directories, you can use the\n--keep_files_on_create option (an error will be issued if files already\nexist). These options are ignored if the NO_DIR_IN_CREATE SQL_MODE is enabled\n(useful for replication slaves). Also note that symbolic links cannot be used\nfor InnoDB tables.\n\nDATA DIRECTORY works by creating symlinks from where the table would normally\nhave been (inside the datadir) to where the option specifies. For security\nreasons, to avoid bypassing the privilege system, the server does not permit\nsymlinks inside the datadir. Therefore, DATA DIRECTORY cannot be used to\nspecify a location inside the datadir. An attempt to do so will result in an\nerror 1210 (HY000) Incorrect arguments to DATA DIRECTORY.\n\nDELAY_KEY_WRITE\n---------------\n\nDELAY_KEY_WRITE is supported by MyISAM and Aria, and can be set to 1 to speed\nup write operations. In that case, when data are modified, the indexes are not\nupdated until the table is closed. Writing the changes to the index file\naltogether can be much faster. However, note that this option is applied only\nif the delay_key_write server variable is set to \'ON\'. If it is \'OFF\' the\ndelayed index writes are always disabled, and if it is \'ALL\' the delayed index\nwrites are always used, disregarding the value of DELAY_KEY_WRITE.\n\nENCRYPTED\n---------\n\nThe ENCRYPTED table option can be used to manually set the encryption status\nof an InnoDB table. See InnoDB Encryption for more information.\n\nAria does not support the ENCRYPTED table option. See MDEV-18049.\n\nSee Data-at-Rest Encryption for more information.\n\nENCRYPTION_KEY_ID\n-----------------\n\nThe ENCRYPTION_KEY_ID table option can be used to manually set the encryption\nkey of an InnoDB table. See InnoDB Encryption for more information.\n\nAria does not support the ENCRYPTION_KEY_ID table option. See MDEV-18049.\n\nSee Data-at-Rest Encryption for more information.\n\nIETF_QUOTES\n-----------\n\nFor the CSV storage engine, the IETF_QUOTES option, when set to YES, enables\nIETF-compatible parsing of embedded quote and comma characters. Enabling this\noption for a table improves compatibility with other tools that use CSV, but\nis not compatible with MySQL CSV tables, or MariaDB CSV tables created without\nthis option. Disabled by default.\n\nINSERT_METHOD\n-------------\n\nINSERT_METHOD is only used with MERGE tables. This option determines in which\nunderlying table the new rows should be inserted. If you set it to \'NO\' (which\nis the default) no new rows can be added to the table (but you will still be\nable to perform INSERTs directly against the underlying tables). FIRST means\nthat the rows are inserted into the first table, and LAST means that thet are\ninserted into the last table.\n\nKEY_BLOCK_SIZE\n--------------\n\nKEY_BLOCK_SIZE is used to determine the size of key blocks, in bytes or\nkilobytes. However, this value is just a hint, and the storage engine could\nmodify or ignore it. If KEY_BLOCK_SIZE is set to 0, the storage engine\'s\ndefault value will be used.\n\nWith the InnoDB storage engine, if you specify a non-zero value for the\nKEY_BLOCK_SIZE table option for the whole table, then the table will\nimplicitly be created with the ROW_FORMAT table option set to COMPRESSED.\n\nMIN_ROWS/MAX_ROWS\n-----------------\n\nMIN_ROWS and MAX_ROWS let the storage engine know how many rows you are\nplanning to store as a minimum and as a maximum. These values will not be used\nas real limits, but they help the storage engine to optimize the table.\nMIN_ROWS is only used by MEMORY storage engine to decide the minimum memory\nthat is always allocated. MAX_ROWS is used to decide the minimum size for\nindexes.\n\nPACK_KEYS\n---------\n\nPACK_KEYS can be used to determine whether the indexes will be compressed. Set\nit to 1 to compress all keys. With a value of 0, compression will not be used.\nWith the DEFAULT value, only long strings will be compressed. Uncompressed\nkeys are faster.\n\nPAGE_CHECKSUM\n-------------\n\nPAGE_CHECKSUM is only applicable to Aria tables, and determines whether\nindexes and data should use page checksums for extra safety.\n\nPAGE_COMPRESSED\n---------------\n\nPAGE_COMPRESSED is used to enable InnoDB page compression for InnoDB tables.\n\nPAGE_COMPRESSION_LEVEL\n----------------------\n\nPAGE_COMPRESSION_LEVEL is used to set the compression level for InnoDB page\ncompression for InnoDB tables. The table must also have the PAGE_COMPRESSED\ntable option set to 1.\n\nValid values for PAGE_COMPRESSION_LEVEL are 1 (the best speed) through 9 (the\nbest compression), .\n\nPASSWORD\n--------\n\nPASSWORD is unused.\n\nRAID_TYPE\n---------\n\nRAID_TYPE is an obsolete option, as the raid support has been disabled since\nMySQL 5.0.\n\nROW_FORMAT\n----------\n\nThe ROW_FORMAT table option specifies the row format for the data file.\nPossible values are engine-dependent.\n\nSupported MyISAM Row Formats\n----------------------------\n\nFor MyISAM, the supported row formats are:\n\n* FIXED\n* DYNAMIC\n* COMPRESSED\n\nThe COMPRESSED row format can only be set by the myisampack command line tool.\n\nSee MyISAM Storage Formats for more information.\n\nSupported Aria Row Formats\n--------------------------\n\nFor Aria, the supported row formats are:\n\n* PAGE\n* FIXED\n* DYNAMIC.\n\nSee Aria Storage Formats for more information.\n\nSupported InnoDB Row Formats\n----------------------------\n\nFor InnoDB, the supported row formats are:\n\n* COMPACT\n* REDUNDANT\n* COMPRESSED\n* DYNAMIC.\n\nIf the ROW_FORMAT table option is set to FIXED for an InnoDB table, then the\nserver will either return an error or a warning depending on the value of the\ninnodb_strict_mode system variable. If the innodb_strict_mode system variable\nis set to OFF, then a warning is issued, and MariaDB will create the table\nusing the default row format for the specific MariaDB server version. If the\ninnodb_strict_mode system variable is set to ON, then an error will be raised.\n\nSee InnoDB Storage Formats for more information.\n\nOther Storage Engines and ROW_FORMAT\n------------------------------------\n\nOther storage engines do not support the ROW_FORMAT table option.\n\nSEQUENCE\n--------\n\nMariaDB starting with 10.3\n--------------------------\nIf the table is a sequence, then it will have the SEQUENCE set to 1.\n\nSTATS_AUTO_RECALC\n-----------------\n\nSTATS_AUTO_RECALC indicates whether to automatically recalculate persistent\nstatistics (see STATS_PERSISTENT, below) for an InnoDB table. If set to 1,\nstatistics will be recalculated when more than 10% of the data has changed.\nWhen set to 0, stats will be recalculated only when an ANALYZE TABLE is run.\nIf set to DEFAULT, or left out, the value set by the innodb_stats_auto_recalc\nsystem variable applies. See InnoDB Persistent Statistics.\n\nSTATS_PERSISTENT\n----------------\n\nSTATS_PERSISTENT indicates whether the InnoDB statistics created by ANALYZE\nTABLE will remain on disk or not. It can be set to 1 (on disk), 0 (not on\ndisk, the pre-MariaDB 10 behavior), or DEFAULT (the same as leaving out the\noption), in which case the value set by the innodb_stats_persistent system\nvariable will apply. Persistent statistics stored on disk allow the statistics\nto survive server restarts, and provide better query plan stability. See\nInnoDB Persistent Statistics.\n\nSTATS_SAMPLE_PAGES\n------------------\n\nSTATS_SAMPLE_PAGES indicates how many pages are used to sample index\nstatistics. If 0 or DEFAULT, the default value, the innodb_stats_sample_pages\nvalue is used. See InnoDB Persistent Statistics.\n\nTRANSACTIONAL\n-------------\n\nTRANSACTIONAL is only applicable for Aria tables. In future Aria tables\ncreated with this option will be fully transactional, but currently this\nprovides a form of crash protection. See Aria Storage Engine for more details.\n\nUNION\n-----\n\nUNION must be specified when you create a MERGE table. This option contains a\ncomma-separated list of MyISAM tables which are accessed by the new table. The\nlist is enclosed between parenthesis. Example: UNION = (t1,t2)\n\nWITH SYSTEM VERSIONING\n----------------------\n\nWITH SYSTEM VERSIONING is used for creating System-versioned tables.\n\nPartitions\n----------\n\npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE(expr)\n | LIST(expr)\n | SYSTEM_TIME [INTERVAL time_quantity time_unit] [LIMIT num] }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\npartition_definition:\n PARTITION partition_name\n [VALUES {LESS THAN {(expr) | MAXVALUE} | IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\nIf the PARTITION BY clause is used, the table will be partitioned. A partition\nmethod must be explicitly indicated for partitions and subpartitions.\nPartition methods are:\n\n* [LINEAR] HASH creates a hash key which will be used to read and write rows.\nThe partition function can be any valid SQL expression which returns an\nINTEGER number. Thus, it is possible to use the HASH method on an integer\ncolumn, or on functions which accept integer columns as an argument. However,\nVALUES LESS THAN and VALUES IN clauses can not be used with HASH. An example:\n\nCREATE TABLE t1 (a INT, b CHAR(5), c DATETIME)\n PARTITION BY HASH ( YEAR(c) );\n\n[LINEAR] HASH can be used for subpartitions, too.\n\n* [LINEAR] KEY is similar to HASH, but the index has an even distribution of\ndata. Also, the expression can only be a column or a list of columns. VALUES\nLESS THAN and VALUES IN clauses can not be used with KEY.\n* RANGE partitions the rows using on a range of values, using the VALUES LESS\nTHAN operator. VALUES IN is not allowed with RANGE. The partition function can\nbe any valid SQL expression which returns a single value.\n* LIST assigns partitions based on a table\'s column with a restricted set of\npossible values. It is similar to RANGE, but VALUES IN must be used for at\nleast 1 columns, and VALUES LESS THAN is disallowed.\n* SYSTEM_TIME partitioning is used for System-versioned tables to store\nhistorical data separately from current data.\n\nOnly HASH and KEY can be used for subpartitions, and they can be [LINEAR].\n\nIt is possible to define up to 1024 partitions and subpartitions.\n\nThe number of defined partitions can be optionally specified as PARTITION\ncount. This can be done to avoid specifying all partitions individually. But\nyou can also declare each individual partition and, additionally, specify a\nPARTITIONS count clause; in the case, the number of PARTITIONs must equal\ncount.\n\nAlso see Partitioning Types Overview.\n\nSequences\n---------\n\nMariaDB starting with 10.3\n--------------------------\nCREATE TABLE can also be used to create a SEQUENCE. See CREATE SEQUENCE and\nSequence Overview.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL. CREATE TABLE is atomic, except for CREATE\nOR REPLACE, which is only crash safe.\n\nExamples\n--------\n\ncreate table if not exists test (\na bigint auto_increment primary key,\nname varchar(128) charset utf8,\nkey name (name(32))\n) engine=InnoDB default charset latin1;\n\nThis example shows a couple of things:\n\n* Usage of IF NOT EXISTS; If the table already existed, it will not be\ncreated. There will not be any error for the client, just a warning.\n* How to create a PRIMARY KEY that is automatically generated.\n* How to specify a table-specific character set and another for a column.\n* How to create an index (name) that is only partly indexed (to save space).\n\nThe following clauses will work from MariaDB 10.2.1 only.\n\nCREATE TABLE t1(\n a int DEFAULT (1+1),\n b int DEFAULT (a+1),\n expires DATETIME DEFAULT(NOW() + INTERVAL 1 YEAR),\n x BLOB DEFAULT USER()\n);\n\nURL: https://mariadb.com/kb/en/create-table/') WHERE help_topic_id = 706; +update help_topic set description = CONCAT(description, '\n* VIRTUAL: This type\'s value is not stored at all. Instead, the value is\ngenerated dynamically when the table is queried. This type is the default.\n\nGenerated columns are also sometimes called computed columns or virtual\ncolumns.\n\nFor a complete description about generated columns and their limitations, see\nGenerated (Virtual and Persistent/Stored) Columns.\n\nCOMPRESSED\n----------\n\nMariaDB starting with 10.3.3\n----------------------------\nCertain columns may be compressed. See Storage-Engine Independent Column\nCompression.\n\nINVISIBLE\n---------\n\nMariaDB starting with 10.3.3\n----------------------------\nColumns may be made invisible, and hidden in certain contexts. See Invisible\nColumns.\n\nWITH SYSTEM VERSIONING Column Option\n------------------------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nColumns may be explicitly marked as included from system versioning. See\nSystem-versioned tables for details.\n\nWITHOUT SYSTEM VERSIONING Column Option\n---------------------------------------\n\nMariaDB starting with 10.3.4\n----------------------------\nColumns may be explicitly marked as excluded from system versioning. See\nSystem-versioned tables for details.\n\nIndex Definitions\n-----------------\n\nindex_definition:\n {INDEX|KEY} [index_name] [index_type] (index_col_name,...) [index_option]\n...\n {{{|}}} {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...)\n[index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)\n[index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] [index_name] [index_type]\n(index_col_name,...) [index_option] ...\n {{{|}}} [CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name,...)\nreference_definition\n\nindex_col_name:\n col_name [(length)] [ASC | DESC]\n\nindex_type:\n USING {BTREE | HASH | RTREE}\n\nindex_option:\n [ KEY_BLOCK_SIZE [=] value\n {{{|}}} index_type\n {{{|}}} WITH PARSER parser_name\n {{{|}}} COMMENT \'string\'\n {{{|}}} CLUSTERING={YES| NO} ]\n [ IGNORED | NOT IGNORED ]\n\nreference_definition:\n REFERENCES tbl_name (index_col_name,...)\n [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]\n [ON DELETE reference_option]\n [ON UPDATE reference_option]\n\nreference_option:\n RESTRICT | CASCADE | SET NULL | NO ACTION\n\nINDEX and KEY are synonyms.\n\nIndex names are optional, if not specified an automatic name will be assigned.\nIndex name are needed to drop indexes and appear in error messages when a\nconstraint is violated.\n\nIndex Categories\n----------------\n\nPlain Indexes\n-------------\n\nPlain indexes are regular indexes that are not unique, and are not acting as a\nprimary key or a foreign key. They are also not the \"specialized\" FULLTEXT or\nSPATIAL indexes.\n\nSee Getting Started with Indexes: Plain Indexes for more information.\n\nPRIMARY KEY\n-----------\n\nFor PRIMARY KEY indexes, you can specify a name for the index, but it is\nignored, and the name of the index is always PRIMARY. From MariaDB 10.3.18 and\nMariaDB 10.4.8, a warning is explicitly issued if a name is specified. Before\nthen, the name was silently ignored.\n\nSee Getting Started with Indexes: Primary Key for more information.\n\nUNIQUE\n------\n\nThe UNIQUE keyword means that the index will not accept duplicated values,\nexcept for NULLs. An error will raise if you try to insert duplicate values in\na UNIQUE index.\n\nFor UNIQUE indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nSee Getting Started with Indexes: Unique Index for more information.\n\nFOREIGN KEY\n-----------\n\nFor FOREIGN KEY indexes, a reference definition must be provided.\n\nFor FOREIGN KEY indexes, you can specify a name for the constraint, using the\nCONSTRAINT keyword. That name will be used in error messages.\n\nFirst, you have to specify the name of the target (parent) table and a column\nor a column list which must be indexed and whose values must match to the\nforeign key\'s values. The MATCH clause is accepted to improve the\ncompatibility with other DBMS\'s, but has no meaning in MariaDB. The ON DELETE\nand ON UPDATE clauses specify what must be done when a DELETE (or a REPLACE)\nstatements attempts to delete a referenced row from the parent table, and when\nan UPDATE statement attempts to modify the referenced foreign key columns in a\nparent table row, respectively. The following options are allowed:\n\n* RESTRICT: The delete/update operation is not performed. The statement\nterminates with a 1451 error (SQLSTATE \'2300\').\n* NO ACTION: Synonym for RESTRICT.\n* CASCADE: The delete/update operation is performed in both tables.\n* SET NULL: The update or delete goes ahead in the parent table, and the\ncorresponding foreign key fields in the child table are set to NULL. (They\nmust not be defined as NOT NULL for this to succeed).\n* SET DEFAULT: This option is currently implemented only for the PBXT storage\nengine, which is disabled by default and no longer maintained. It sets the\nchild table\'s foreign key fields to their DEFAULT values when the referenced\nparent table key entries are updated or deleted.\n\nIf either clause is omitted, the default behavior for the omitted clause is\nRESTRICT.\n\nSee Foreign Keys for more information.\n\nFULLTEXT\n--------\n\nUse the FULLTEXT keyword to create full-text indexes.\n\nSee Full-Text Indexes for more information.\n\nSPATIAL\n-------\n\nUse the SPATIAL keyword to create geometric indexes.\n\nSee SPATIAL INDEX for more information.\n\nIndex Options\n-------------\n\nKEY_BLOCK_SIZE Index Option\n---------------------------\n\nThe KEY_BLOCK_SIZE index option is similar to the KEY_BLOCK_SIZE table option.\n\nWith the InnoDB storage engine, if you specify a non-zero value for the\nKEY_BLOCK_SIZE table option for the whole table, then the table will\nimplicitly be created with the ROW_FORMAT table option set to COMPRESSED.\nHowever, this does not happen if you just set the KEY_BLOCK_SIZE index option\nfor one or more indexes in the table. The InnoDB storage engine ignores the\nKEY_BLOCK_SIZE index option. However, the SHOW CREATE TABLE statement may\nstill report it for the index.\n\nFor information about the KEY_BLOCK_SIZE index option, see the KEY_BLOCK_SIZE\ntable option below.\n\nIndex Types\n-----------\n\nEach storage engine supports some or all index types. See Storage Engine Index\nTypes for details on permitted index types for each storage engine.\n\nDifferent index types are optimized for different kind of operations:\n\n* BTREE is the default type, and normally is the best choice. It is supported\nby all storage engines. It can be used to compare a column\'s value with a\nvalue using the =, >, >=, <, <=, BETWEEN, and LIKE operators. BTREE can also\nbe used to find NULL values. Searches against an index prefix are possible.\n* HASH is only supported by the MEMORY storage engine. HASH indexes can only\nbe used for =, <=, and >= comparisons. It can not be used for the ORDER BY\nclause. Searches against an index prefix are not possible.\n* RTREE is the default for SPATIAL indexes, but if the storage engine does not\nsupport it BTREE can be used.\n\nIndex columns names are listed between parenthesis. After each column, a\nprefix length can be specified. If no length is specified, the whole column\nwill be indexed. ASC and DESC can be specified for compatibility with are\nDBMS\'s, but have no meaning in MariaDB.\n\nWITH PARSER Index Option\n------------------------\n\nThe WITH PARSER index option only applies to FULLTEXT indexes and contains the\nfulltext parser name. The fulltext parser must be an installed plugin.\n\nCOMMENT Index Option\n--------------------\n\nA comment of up to 1024 characters is permitted with the COMMENT index option.\n\nThe COMMENT index option allows you to specify a comment with user-readable\ntext describing what the index is for. This information is not used by the\nserver itself.\n\nCLUSTERING Index Option\n-----------------------\n\nThe CLUSTERING index option is only valid for tables using the TokuDB storage\nengine.\n\nIGNORED / NOT IGNORED\n---------------------\n\nMariaDB starting with 10.6.0\n----------------------------\nFrom MariaDB 10.6.0, indexes can be specified to be ignored by the optimizer.\nSee Ignored Indexes.\n\nPeriods\n-------\n\nMariaDB starting with 10.3.4\n----------------------------\n\nperiod_definition:\n PERIOD FOR SYSTEM_TIME (start_column_name, end_column_name)\nMariaDB supports a subset of the standard syntax for periods. At the moment\nit\'s only used for creating System-versioned tables. Both columns must be\ncreated, must be either of a TIMESTAMP(6) or BIGINT UNSIGNED type, and be\ngenerated as ROW START and ROW END accordingly. See System-versioned tables\nfor details.\n\nThe table must also have the WITH SYSTEM VERSIONING clause.\n\nConstraint Expressions\n----------------------\n\nNote: Before MariaDB 10.2.1, constraint expressions were accepted in the\nsyntax but ignored.\n\nMariaDB 10.2.1 introduced two ways to define a constraint:\n\n* CHECK(expression) given as part of a column definition.\n* CONSTRAINT [constraint_name] CHECK (expression)\n\nBefore a row is inserted or updated, all constraints are evaluated in the\norder they are defined. If any constraints fails, then the row will not be\nupdated. One can use most deterministic functions in a constraint, including\nUDFs.\n\ncreate table t1 (a int check(a>0) ,b int check (b> 0), constraint abc check\n(a>b));\n\nIf you use the second format and you don\'t give a name to the constraint, then\nthe constraint will get a auto generated name. This is done so that you can\nlater delete the constraint with ALTER TABLE DROP constraint_name.\n\nOne can disable all constraint expression checks by setting the variable\ncheck_constraint_checks to OFF. This is useful for example when loading a\ntable that violates some constraints that you want to later find and fix in\nSQL.\n\nSee CONSTRAINT for more information.\n\nTable Options\n-------------\n\nFor each individual table you create (or alter), you can set some table\noptions. The general syntax for setting options is:\n\n<OPTION_NAME> = <option_value>, [<OPTION_NAME> = <option_value> ...]\n\nThe equal sign is optional.\n\nSome options are supported by the server and can be used for all tables, no\nmatter what storage engine they use; other options can be specified for all\nstorage engines, but have a meaning only for some engines. Also, engines can\nextend CREATE TABLE with new options.\n\nIf the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is enabled, wrong table options\ngenerate a warning; otherwise, they generate an error.\n\ntable_option: \n [STORAGE] ENGINE [=] engine_name\n | AUTO_INCREMENT [=] value\n | AVG_ROW_LENGTH [=] value\n | [DEFAULT] CHARACTER SET [=] charset_name\n | CHECKSUM [=] {0 | 1}\n | [DEFAULT] COLLATE [=] collation_name\n | COMMENT [=] \'string\'\n | CONNECTION [=] \'connect_string\'\n | DATA DIRECTORY [=] \'absolute path to directory\'\n | DELAY_KEY_WRITE [=] {0 | 1}\n | ENCRYPTED [=] {YES | NO}\n | ENCRYPTION_KEY_ID [=] value\n | IETF_QUOTES [=] {YES | NO}\n | INDEX DIRECTORY [=] \'absolute path to directory\'\n | INSERT_METHOD [=] { NO | FIRST | LAST }\n | KEY_BLOCK_SIZE [=] value\n | MAX_ROWS [=] value\n | MIN_ROWS [=] value\n | PACK_KEYS [=] {0 | 1 | DEFAULT}\n | PAGE_CHECKSUM [=] {0 | 1}\n | PAGE_COMPRESSED [=] {0 | 1}\n | PAGE_COMPRESSION_LEVEL [=] {0 .. 9}\n | PASSWORD [=] \'string\'\n | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT|PAGE}\n | SEQUENCE [=] {0|1}\n | STATS_AUTO_RECALC [=] {DEFAULT|0|1}\n | STATS_PERSISTENT [=] {DEFAULT|0|1}\n | STATS_SAMPLE_PAGES [=] {DEFAULT|value}\n | TABLESPACE tablespace_name\n | TRANSACTIONAL [=] {0 | 1}\n | UNION [=] (tbl_name[,tbl_name]...)\n | WITH SYSTEM VERSIONING\n\n[STORAGE] ENGINE\n----------------\n\n[STORAGE] ENGINE specifies a storage engine for the table. If this option is\nnot used, the default storage engine is used instead. That is, the\ndefault_storage_engine session option value if it is set, or the value\nspecified for the --default-storage-engine mysqld startup option, or the\ndefault storage engine, InnoDB. If the specified storage engine is not\ninstalled and active, the default value will be used, unless the\nNO_ENGINE_SUBSTITUTION SQL MODE is set (default). This is only true for CREATE\nTABLE, not for ALTER TABLE. For a list of storage engines that are present in\nyour server, issue a SHOW ENGINES.\n\nAUTO_INCREMENT\n--------------\n\nAUTO_INCREMENT specifies the initial value for the AUTO_INCREMENT primary key.\nThis works for MyISAM, Aria, InnoDB, MEMORY, and ARCHIVE tables. You can\nchange this option with ALTER TABLE, but in that case the new value must be\nhigher than the highest value which is present in the AUTO_INCREMENT column.\nIf the storage engine does not support this option, you can insert (and then\ndelete) a row having the wanted value - 1 in the AUTO_INCREMENT column.\n\nAVG_ROW_LENGTH\n--------------\n\nAVG_ROW_LENGTH is the average rows size. It only applies to tables using\nMyISAM and Aria storage engines that have the ROW_FORMAT table option set to\nFIXED format.\n\nMyISAM uses MAX_ROWS and AVG_ROW_LENGTH to decide the maximum size of a table\n(default: 256TB, or the maximum file size allowed by the system).\n\n[DEFAULT] CHARACTER SET/CHARSET\n-------------------------------\n\n[DEFAULT] CHARACTER SET (or [DEFAULT] CHARSET) is used to set a default\ncharacter set for the table. This is the character set used for all columns\nwhere an explicit character set is not specified. If this option is omitted or\nDEFAULT is specified, database\'s default character set will be used. See\nSetting Character Sets and Collations for details on setting the character\nsets.\n\nCHECKSUM/TABLE_CHECKSUM\n-----------------------\n\nCHECKSUM (or TABLE_CHECKSUM) can be set to 1 to maintain a live checksum for\nall table\'s rows. This makes write operations slower, but CHECKSUM TABLE will\nbe very fast. This option is only supported for MyISAM and Aria tables.\n\n[DEFAULT] COLLATE\n-----------------\n\n[DEFAULT] COLLATE is used to set a default collation for the table. This is\nthe collation used for all columns where an explicit character set is not\nspecified. If this option is omitted or DEFAULT is specified, database\'s\ndefault option will be used. See Setting Character Sets and Collations for\ndetails on setting the collations\n\nCOMMENT\n-------\n') WHERE help_topic_id = 706; +update help_topic set description = CONCAT(description, '\nCOMMENT is a comment for the table. The maximum length is 2048 characters.\nAlso used to define table parameters when creating a Spider table.\n\nCONNECTION\n----------\n\nCONNECTION is used to specify a server name or a connection string for a\nSpider, CONNECT, Federated or FederatedX table.\n\nDATA DIRECTORY/INDEX DIRECTORY\n------------------------------\n\nDATA DIRECTORY and INDEX DIRECTORY are supported for MyISAM and Aria, and DATA\nDIRECTORY is also supported by InnoDB if the innodb_file_per_table server\nsystem variable is enabled, but only in CREATE TABLE, not in ALTER TABLE. So,\ncarefully choose a path for InnoDB tables at creation time, because it cannot\nbe changed without dropping and re-creating the table. These options specify\nthe paths for data files and index files, respectively. If these options are\nomitted, the database\'s directory will be used to store data files and index\nfiles. Note that these table options do not work for partitioned tables (use\nthe partition options instead), or if the server has been invoked with the\n--skip-symbolic-links startup option. To avoid the overwriting of old files\nwith the same name that could be present in the directories, you can use the\n--keep_files_on_create option (an error will be issued if files already\nexist). These options are ignored if the NO_DIR_IN_CREATE SQL_MODE is enabled\n(useful for replication slaves). Also note that symbolic links cannot be used\nfor InnoDB tables.\n\nDATA DIRECTORY works by creating symlinks from where the table would normally\nhave been (inside the datadir) to where the option specifies. For security\nreasons, to avoid bypassing the privilege system, the server does not permit\nsymlinks inside the datadir. Therefore, DATA DIRECTORY cannot be used to\nspecify a location inside the datadir. An attempt to do so will result in an\nerror 1210 (HY000) Incorrect arguments to DATA DIRECTORY.\n\nDELAY_KEY_WRITE\n---------------\n\nDELAY_KEY_WRITE is supported by MyISAM and Aria, and can be set to 1 to speed\nup write operations. In that case, when data are modified, the indexes are not\nupdated until the table is closed. Writing the changes to the index file\naltogether can be much faster. However, note that this option is applied only\nif the delay_key_write server variable is set to \'ON\'. If it is \'OFF\' the\ndelayed index writes are always disabled, and if it is \'ALL\' the delayed index\nwrites are always used, disregarding the value of DELAY_KEY_WRITE.\n\nENCRYPTED\n---------\n\nThe ENCRYPTED table option can be used to manually set the encryption status\nof an InnoDB table. See InnoDB Encryption for more information.\n\nAria does not support the ENCRYPTED table option. See MDEV-18049.\n\nSee Data-at-Rest Encryption for more information.\n\nENCRYPTION_KEY_ID\n-----------------\n\nThe ENCRYPTION_KEY_ID table option can be used to manually set the encryption\nkey of an InnoDB table. See InnoDB Encryption for more information.\n\nAria does not support the ENCRYPTION_KEY_ID table option. See MDEV-18049.\n\nSee Data-at-Rest Encryption for more information.\n\nIETF_QUOTES\n-----------\n\nFor the CSV storage engine, the IETF_QUOTES option, when set to YES, enables\nIETF-compatible parsing of embedded quote and comma characters. Enabling this\noption for a table improves compatibility with other tools that use CSV, but\nis not compatible with MySQL CSV tables, or MariaDB CSV tables created without\nthis option. Disabled by default.\n\nINSERT_METHOD\n-------------\n\nINSERT_METHOD is only used with MERGE tables. This option determines in which\nunderlying table the new rows should be inserted. If you set it to \'NO\' (which\nis the default) no new rows can be added to the table (but you will still be\nable to perform INSERTs directly against the underlying tables). FIRST means\nthat the rows are inserted into the first table, and LAST means that thet are\ninserted into the last table.\n\nKEY_BLOCK_SIZE\n--------------\n\nKEY_BLOCK_SIZE is used to determine the size of key blocks, in bytes or\nkilobytes. However, this value is just a hint, and the storage engine could\nmodify or ignore it. If KEY_BLOCK_SIZE is set to 0, the storage engine\'s\ndefault value will be used.\n\nWith the InnoDB storage engine, if you specify a non-zero value for the\nKEY_BLOCK_SIZE table option for the whole table, then the table will\nimplicitly be created with the ROW_FORMAT table option set to COMPRESSED.\n\nMIN_ROWS/MAX_ROWS\n-----------------\n\nMIN_ROWS and MAX_ROWS let the storage engine know how many rows you are\nplanning to store as a minimum and as a maximum. These values will not be used\nas real limits, but they help the storage engine to optimize the table.\nMIN_ROWS is only used by MEMORY storage engine to decide the minimum memory\nthat is always allocated. MAX_ROWS is used to decide the minimum size for\nindexes.\n\nPACK_KEYS\n---------\n\nPACK_KEYS can be used to determine whether the indexes will be compressed. Set\nit to 1 to compress all keys. With a value of 0, compression will not be used.\nWith the DEFAULT value, only long strings will be compressed. Uncompressed\nkeys are faster.\n\nPAGE_CHECKSUM\n-------------\n\nPAGE_CHECKSUM is only applicable to Aria tables, and determines whether\nindexes and data should use page checksums for extra safety.\n\nPAGE_COMPRESSED\n---------------\n\nPAGE_COMPRESSED is used to enable InnoDB page compression for InnoDB tables.\n\nPAGE_COMPRESSION_LEVEL\n----------------------\n\nPAGE_COMPRESSION_LEVEL is used to set the compression level for InnoDB page\ncompression for InnoDB tables. The table must also have the PAGE_COMPRESSED\ntable option set to 1.\n\nValid values for PAGE_COMPRESSION_LEVEL are 1 (the best speed) through 9 (the\nbest compression), .\n\nPASSWORD\n--------\n\nPASSWORD is unused.\n\nRAID_TYPE\n---------\n\nRAID_TYPE is an obsolete option, as the raid support has been disabled since\nMySQL 5.0.\n\nROW_FORMAT\n----------\n\nThe ROW_FORMAT table option specifies the row format for the data file.\nPossible values are engine-dependent.\n\nSupported MyISAM Row Formats\n----------------------------\n\nFor MyISAM, the supported row formats are:\n\n* FIXED\n* DYNAMIC\n* COMPRESSED\n\nThe COMPRESSED row format can only be set by the myisampack command line tool.\n\nSee MyISAM Storage Formats for more information.\n\nSupported Aria Row Formats\n--------------------------\n\nFor Aria, the supported row formats are:\n\n* PAGE\n* FIXED\n* DYNAMIC.\n\nSee Aria Storage Formats for more information.\n\nSupported InnoDB Row Formats\n----------------------------\n\nFor InnoDB, the supported row formats are:\n\n* COMPACT\n* REDUNDANT\n* COMPRESSED\n* DYNAMIC.\n\nIf the ROW_FORMAT table option is set to FIXED for an InnoDB table, then the\nserver will either return an error or a warning depending on the value of the\ninnodb_strict_mode system variable. If the innodb_strict_mode system variable\nis set to OFF, then a warning is issued, and MariaDB will create the table\nusing the default row format for the specific MariaDB server version. If the\ninnodb_strict_mode system variable is set to ON, then an error will be raised.\n\nSee InnoDB Storage Formats for more information.\n\nOther Storage Engines and ROW_FORMAT\n------------------------------------\n\nOther storage engines do not support the ROW_FORMAT table option.\n\nSEQUENCE\n--------\n\nMariaDB starting with 10.3\n--------------------------\nIf the table is a sequence, then it will have the SEQUENCE set to 1.\n\nSTATS_AUTO_RECALC\n-----------------\n\nSTATS_AUTO_RECALC indicates whether to automatically recalculate persistent\nstatistics (see STATS_PERSISTENT, below) for an InnoDB table. If set to 1,\nstatistics will be recalculated when more than 10% of the data has changed.\nWhen set to 0, stats will be recalculated only when an ANALYZE TABLE is run.\nIf set to DEFAULT, or left out, the value set by the innodb_stats_auto_recalc\nsystem variable applies. See InnoDB Persistent Statistics.\n\nSTATS_PERSISTENT\n----------------\n\nSTATS_PERSISTENT indicates whether the InnoDB statistics created by ANALYZE\nTABLE will remain on disk or not. It can be set to 1 (on disk), 0 (not on\ndisk, the pre-MariaDB 10 behavior), or DEFAULT (the same as leaving out the\noption), in which case the value set by the innodb_stats_persistent system\nvariable will apply. Persistent statistics stored on disk allow the statistics\nto survive server restarts, and provide better query plan stability. See\nInnoDB Persistent Statistics.\n\nSTATS_SAMPLE_PAGES\n------------------\n\nSTATS_SAMPLE_PAGES indicates how many pages are used to sample index\nstatistics. If 0 or DEFAULT, the default value, the innodb_stats_sample_pages\nvalue is used. See InnoDB Persistent Statistics.\n\nTRANSACTIONAL\n-------------\n\nTRANSACTIONAL is only applicable for Aria tables. In future Aria tables\ncreated with this option will be fully transactional, but currently this\nprovides a form of crash protection. See Aria Storage Engine for more details.\n\nUNION\n-----\n\nUNION must be specified when you create a MERGE table. This option contains a\ncomma-separated list of MyISAM tables which are accessed by the new table. The\nlist is enclosed between parenthesis. Example: UNION = (t1,t2)\n\nWITH SYSTEM VERSIONING\n----------------------\n\nWITH SYSTEM VERSIONING is used for creating System-versioned tables.\n\nPartitions\n----------\n\npartition_options:\n PARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list)\n | RANGE(expr)\n | LIST(expr)\n | SYSTEM_TIME [INTERVAL time_quantity time_unit] [LIMIT num] }\n [PARTITIONS num]\n [SUBPARTITION BY\n { [LINEAR] HASH(expr)\n | [LINEAR] KEY(column_list) }\n [SUBPARTITIONS num]\n ]\n [(partition_definition [, partition_definition] ...)]\npartition_definition:\n PARTITION partition_name\n [VALUES {LESS THAN {(expr) | MAXVALUE} | IN (value_list)}]\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\n [(subpartition_definition [, subpartition_definition] ...)]\nsubpartition_definition:\n SUBPARTITION logical_name\n [[STORAGE] ENGINE [=] engine_name]\n [COMMENT [=] \'comment_text\' ]\n [DATA DIRECTORY [=] \'data_dir\']\n [INDEX DIRECTORY [=] \'index_dir\']\n [MAX_ROWS [=] max_number_of_rows]\n [MIN_ROWS [=] min_number_of_rows]\n [TABLESPACE [=] tablespace_name]\n [NODEGROUP [=] node_group_id]\nIf the PARTITION BY clause is used, the table will be partitioned. A partition\nmethod must be explicitly indicated for partitions and subpartitions.\nPartition methods are:\n\n* [LINEAR] HASH creates a hash key which will be used to read and write rows.\nThe partition function can be any valid SQL expression which returns an\nINTEGER number. Thus, it is possible to use the HASH method on an integer\ncolumn, or on functions which accept integer columns as an argument. However,\nVALUES LESS THAN and VALUES IN clauses can not be used with HASH. An example:\n\nCREATE TABLE t1 (a INT, b CHAR(5), c DATETIME)\n PARTITION BY HASH ( YEAR(c) );\n\n[LINEAR] HASH can be used for subpartitions, too.\n\n* [LINEAR] KEY is similar to HASH, but the index has an even distribution of\ndata. Also, the expression can only be a column or a list of columns. VALUES\nLESS THAN and VALUES IN clauses can not be used with KEY.\n* RANGE partitions the rows using on a range of values, using the VALUES LESS\nTHAN operator. VALUES IN is not allowed with RANGE. The partition function can\nbe any valid SQL expression which returns a single value.\n* LIST assigns partitions based on a table\'s column with a restricted set of\npossible values. It is similar to RANGE, but VALUES IN must be used for at\nleast 1 columns, and VALUES LESS THAN is disallowed.\n* SYSTEM_TIME partitioning is used for System-versioned tables to store\nhistorical data separately from current data.\n\nOnly HASH and KEY can be used for subpartitions, and they can be [LINEAR].\n\nIt is possible to define up to 1024 partitions and subpartitions.\n\nThe number of defined partitions can be optionally specified as PARTITION\ncount. This can be done to avoid specifying all partitions individually. But\nyou can also declare each individual partition and, additionally, specify a\nPARTITIONS count clause; in the case, the number of PARTITIONs must equal\ncount.\n\nAlso see Partitioning Types Overview.\n\nSequences\n---------\n\nMariaDB starting with 10.3\n--------------------------\nCREATE TABLE can also be used to create a SEQUENCE. See CREATE SEQUENCE and\nSequence Overview.\n\nAtomic DDL\n----------\n\nMariaDB starting with 10.6.1\n----------------------------\nMariaDB 10.6.1 supports Atomic DDL. CREATE TABLE is atomic, except for CREATE\nOR REPLACE, which is only crash safe.\n\nExamples\n--------\n\ncreate table if not exists test (\na bigint auto_increment primary key,\nname varchar(128) charset utf8,\nkey name (name(32))\n) engine=InnoDB default charset latin1;\n\nThis example shows a couple of things:\n\n* Usage of IF NOT EXISTS; If the table already existed, it will not be\ncreated. There will not be any error for the client, just a warning.\n* How to create a PRIMARY KEY that is automatically generated.\n* How to specify a table-specific character set and another for a column.\n* How to create an index (name) that is only partly indexed (to save space).\n\nThe following clauses will work from MariaDB 10.2.1 only.\n\nCREATE TABLE t1(\n a int DEFAULT (1+1),\n b int DEFAULT (a+1),\n expires DATETIME DEFAULT(NOW() + INTERVAL 1 YEAR),\n x BLOB DEFAULT USER()\n);\n\nURL: https://mariadb.com/kb/en/create-table/') WHERE help_topic_id = 706; insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (707,38,'DROP TABLE','Syntax\n------\n\nDROP [TEMPORARY] TABLE [IF EXISTS] [/*COMMENT TO SAVE*/]\n tbl_name [, tbl_name] ...\n [WAIT n|NOWAIT]\n [RESTRICT | CASCADE]\n\nDescription\n-----------\n\nDROP TABLE removes one or more tables. You must have the DROP privilege for\neach table. All table data and the table definition are removed, as well as\ntriggers associated to the table, so be careful with this statement! If any of\nthe tables named in the argument list do not exist, MariaDB returns an error\nindicating by name which non-existing tables it was unable to drop, but it\nalso drops all of the tables in the list that do exist.\n\nImportant: When a table is dropped, user privileges on the table are not\nautomatically dropped. See GRANT.\n\nIf another thread is using the table in an explicit transaction or an\nautocommit transaction, then the thread acquires a metadata lock (MDL) on the\ntable. The DROP TABLE statement will wait in the \"Waiting for table metadata\nlock\" thread state until the MDL is released. MDLs are released in the\nfollowing cases:\n\n* If an MDL is acquired in an explicit transaction, then the MDL will be\nreleased when the transaction ends.\n* If an MDL is acquired in an autocommit transaction, then the MDL will be\nreleased when the statement ends.\n* Transactional and non-transactional tables are handled the same.\n\nNote that for a partitioned table, DROP TABLE permanently removes the table\ndefinition, all of its partitions, and all of the data which was stored in\nthose partitions. It also removes the partitioning definition (.par) file\nassociated with the dropped table.\n\nFor each referenced table, DROP TABLE drops a temporary table with that name,\nif it exists. If it does not exist, and the TEMPORARY keyword is not used, it\ndrops a non-temporary table with the same name, if it exists. The TEMPORARY\nkeyword ensures that a non-temporary table will not accidentally be dropped.\n\nUse IF EXISTS to prevent an error from occurring for tables that do not exist.\nA NOTE is generated for each non-existent table when using IF EXISTS. See SHOW\nWARNINGS.\n\nIf a foreign key references this table, the table cannot be dropped. In this\ncase, it is necessary to drop the foreign key first.\n\nRESTRICT and CASCADE are allowed to make porting from other database systems\neasier. In MariaDB, they do nothing.\n\nThe comment before the table names (/*COMMENT TO SAVE*/) is stored in the\nbinary log. That feature can be used by replication tools to send their\ninternal messages.\n\nIt is possible to specify table names as db_name.tab_name. This is useful to\ndelete tables from multiple databases with one statement. See Identifier\nQualifiers for details.\n\nThe DROP privilege is required to use DROP TABLE on non-temporary tables. For\ntemporary tables, no privilege is required, because such tables are only\nvisible for the current session.\n\nNote: DROP TABLE automatically commits the current active transaction, unless\nyou use the TEMPORARY keyword.\n\nMariaDB starting with 10.5.4\n----------------------------\nFrom MariaDB 10.5.4, DROP TABLE reliably deletes table remnants inside a\nstorage engine even if the .frm file is missing. Before then, a missing .frm\nfile would result in the statement failing.\n\nMariaDB starting with 10.3.1\n----------------------------\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nDROP TABLE in replication\n-------------------------\n\nDROP TABLE has the following characteristics in replication:\n\n* DROP TABLE IF EXISTS are always logged.\n* DROP TABLE without IF EXISTS for tables that don\'t exist are not written to\nthe binary log.\n* Dropping of TEMPORARY tables are prefixed in the log with TEMPORARY. These\ndrops are only logged when running statement or mixed mode replication.\n* One DROP TABLE statement can be logged with up to 3 different DROP\nstatements:\nDROP TEMPORARY TABLE list_of_non_transactional_temporary_tables\nDROP TEMPORARY TABLE list_of_transactional_temporary_tables\nDROP TABLE list_of_normal_tables\n\nDROP TABLE on the primary is treated on the replica as DROP TABLE IF EXISTS.\nYou can change that by setting slave-ddl-exec-mode to STRICT.\n\nDropping an Internal #sql-... Table\n-----------------------------------\n\nFrom MariaDB 10.6, DROP TABLE is atomic and the following does not apply.\nUntil MariaDB 10.5, if the mariadbd/mysqld process is killed during an ALTER\nTABLE you may find a table named #sql-... in your data directory. In MariaDB\n10.3, InnoDB tables with this prefix will be deleted automatically during\nstartup. From MariaDB 10.4, these temporary tables will always be deleted\nautomatically.\n\nIf you want to delete one of these tables explicitly you can do so by using\nthe following syntax:\n\nDROP TABLE `#mysql50##sql-...`;\n\nWhen running an ALTER TABLE…ALGORITHM=INPLACE that rebuilds the table, InnoDB\nwill create an internal #sql-ib table. Until MariaDB 10.3.2, for these tables,\nthe .frm file will be called something else. In order to drop such a table\nafter a server crash, you must rename the #sql*.frm file to match the\n#sql-ib*.ibd file.\n\nFrom MariaDB 10.3.3, the same name as the .frm file is used for the\nintermediate copy of the table. The #sql-ib names are used by TRUNCATE and\ndelayed DROP.\n\nFrom MariaDB 10.2.19 and MariaDB 10.3.10, the #sql-ib tables will be deleted\nautomatically.\n\nDropping All Tables in a Database\n---------------------------------\n\nThe best way to drop all tables in a database is by executing DROP DATABASE,\nwhich will drop the database itself, and all tables in it.\n\nHowever, if you want to drop all tables in the database, but you also want to\nkeep the database itself and any other non-table objects in it, then you would\nneed to execute DROP TABLE to drop each individual table. You can construct\nthese DROP TABLE commands by querying the TABLES table in the\ninformation_schema database. For example:\n\nSELECT CONCAT(\'DROP TABLE IF EXISTS `\', TABLE_SCHEMA, \'`.`\', TABLE_NAME, \'`;\')\nFROM information_schema.TABLES\nWHERE TABLE_SCHEMA = \'mydb\';\n\nAtomic DROP TABLE\n-----------------\n\nMariaDB starting with 10.6.1\n----------------------------\nFrom MariaDB 10.6, DROP TABLE for a single table is atomic (MDEV-25180) for\nmost engines, including InnoDB, MyRocks, MyISAM and Aria.\n\nThis means that if there is a crash (server down or power outage) during DROP\nTABLE, all tables that have been processed so far will be completely dropped,\nincluding related trigger files and status entries, and the binary log will\ninclude a DROP TABLE statement for the dropped tables. Tables for which the\ndrop had not started will be left intact.\n\nIn older MariaDB versions, there was a small chance that, during a server\ncrash happening in the middle of DROP TABLE, some storage engines that were\nusing multiple storage files, like MyISAM, could have only a part of its\ninternal files dropped.\n\nIn MariaDB 10.5, DROP TABLE was extended to be able to delete a table that was\nonly partly dropped (MDEV-11412) as explained above. Atomic DROP TABLE is the\nfinal piece to make DROP TABLE fully reliable.\n\nDropping multiple tables is crash-safe.\n\nSee Atomic DDL for more information.\n\nExamples\n--------\n\nDROP TABLE Employees, Customers;\n\nNotes\n-----\n\nBeware that DROP TABLE can drop both tables and sequences. This is mainly done\nto allow old tools like mysqldump to work with sequences.\n\nURL: https://mariadb.com/kb/en/drop-table/','','https://mariadb.com/kb/en/drop-table/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (708,38,'RENAME TABLE','Syntax\n------\n\nRENAME TABLE[S] [IF EXISTS] tbl_name \n [WAIT n | NOWAIT]\n TO new_tbl_name\n [, tbl_name2 TO new_tbl_name2] ...\n\nDescription\n-----------\n\nThis statement renames one or more tables or views, but not the privileges\nassociated with them.\n\nIF EXISTS\n---------\n\nMariaDB starting with 10.5.2\n----------------------------\nIf this directive is used, one will not get an error if the table to be\nrenamed doesn\'t exist.\n\nThe rename operation is done atomically, which means that no other session can\naccess any of the tables while the rename is running. For example, if you have\nan existing table old_table, you can create another table new_table that has\nthe same structure but is empty, and then replace the existing table with the\nempty one as follows (assuming that backup_table does not already exist):\n\nCREATE TABLE new_table (...);\nRENAME TABLE old_table TO backup_table, new_table TO old_table;\n\ntbl_name can optionally be specified as db_name.tbl_name. See Identifier\nQualifiers. This allows to use RENAME to move a table from a database to\nanother (as long as they are on the same filesystem):\n\nRENAME TABLE db1.t TO db2.t;\n\nNote that moving a table to another database is not possible if it has some\ntriggers. Trying to do so produces the following error:\n\nERROR 1435 (HY000): Trigger in wrong schema\n\nAlso, views cannot be moved to another database:\n\nERROR 1450 (HY000): Changing schema from \'old_db\' to \'new_db\' is not allowed.\n\nMultiple tables can be renamed in a single statement. The presence or absence\nof the optional S (RENAME TABLE or RENAME TABLES) has no impact, whether a\nsingle or multiple tables are being renamed.\n\nIf a RENAME TABLE renames more than one table and one renaming fails, all\nrenames executed by the same statement are rolled back.\n\nRenames are always executed in the specified order. Knowing this, it is also\npossible to swap two tables\' names:\n\nRENAME TABLE t1 TO tmp_table,\n t2 TO t1,\n tmp_table TO t2;\n\nWAIT/NOWAIT\n-----------\n\nMariaDB starting with 10.3.0\n----------------------------\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nPrivileges\n----------\n\nExecuting the RENAME TABLE statement requires the DROP, CREATE and INSERT\nprivileges for the table or the database.\n\nAtomic RENAME TABLE\n-------------------\n\nMariaDB starting with 10.6.1\n----------------------------\nFrom MariaDB 10.6, RENAME TABLE is atomic for most engines, including InnoDB,\nMyRocks, MyISAM and Aria (MDEV-23842). This means that if there is a crash\n(server down or power outage) during RENAME TABLE, all tables will revert to\ntheir original names and any changes to trigger files will be reverted.\n\nIn older MariaDB version there was a small chance that, during a server crash\nhappening in the middle of RENAME TABLE, some tables could have been renamed\n(in the worst case partly) while others would not be renamed.\n\nSee Atomic DDL for more information.\n\nURL: https://mariadb.com/kb/en/rename-table/','','https://mariadb.com/kb/en/rename-table/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (709,38,'TRUNCATE TABLE','Syntax\n------\n\nTRUNCATE [TABLE] tbl_name\n [WAIT n | NOWAIT]\n\nDescription\n-----------\n\nTRUNCATE TABLE empties a table completely. It requires the DROP privilege. See\nGRANT.\n\ntbl_name can also be specified in the form db_name.tbl_name (see Identifier\nQualifiers).\n\nLogically, TRUNCATE TABLE is equivalent to a DELETE statement that deletes all\nrows, but there are practical differences under some circumstances.\n\nTRUNCATE TABLE will fail for an InnoDB table if any FOREIGN KEY constraints\nfrom other tables reference the table, returning the error:\n\nERROR 1701 (42000): Cannot truncate a table referenced in a foreign key\nconstraint\n\nForeign Key constraints between columns in the same table are permitted.\n\nFor an InnoDB table, if there are no FOREIGN KEY constraints, InnoDB performs\nfast truncation by dropping the original table and creating an empty one with\nthe same definition, which is much faster than deleting rows one by one. The\nAUTO_INCREMENT counter is reset by TRUNCATE TABLE, regardless of whether there\nis a FOREIGN KEY constraint.\n\nThe count of rows affected by TRUNCATE TABLE is accurate only when it is\nmapped to a DELETE statement.\n\nFor other storage engines, TRUNCATE TABLE differs from DELETE in the following\nways:\n\n* Truncate operations drop and re-create the table, which is much\n faster than deleting rows one by one, particularly for large tables.\n* Truncate operations cause an implicit commit.\n* Truncation operations cannot be performed if the session holds an\n active table lock.\n* Truncation operations do not return a meaningful value for the number\n of deleted rows. The usual result is \"0 rows affected,\" which should\n be interpreted as \"no information.\"\n* As long as the table format file tbl_name.frm is valid, the\n table can be re-created as an empty table\n with TRUNCATE TABLE, even if the data or index files have become\n corrupted.\n* The table handler does not remember the last\n used AUTO_INCREMENT value, but starts counting\n from the beginning. This is true even for MyISAM and InnoDB, which normally\n do not reuse sequence values.\n* When used with partitioned tables, TRUNCATE TABLE preserves\n the partitioning; that is, the data and index files are dropped and\n re-created, while the partition definitions (.par) file is\n unaffected.\n* Since truncation of a table does not make any use of DELETE,\n the TRUNCATE statement does not invoke ON DELETE triggers.\n* TRUNCATE TABLE will only reset the values in the Performance Schema summary\ntables to zero or null, and will not remove the rows.\n\nFor the purposes of binary logging and replication, TRUNCATE TABLE is treated\nas DROP TABLE followed by CREATE TABLE (DDL rather than DML).\n\nTRUNCATE TABLE does not work on views. Currently, TRUNCATE TABLE drops all\nhistorical records from a system-versioned table.\n\nMariaDB starting with 10.3.0\n----------------------------\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nOracle-mode\n-----------\n\nOracle-mode from MariaDB 10.3 permits the optional keywords REUSE STORAGE or\nDROP STORAGE to be used.\n\nTRUNCATE [TABLE] tbl_name [{DROP | REUSE} STORAGE] [WAIT n | NOWAIT]\n\nThese have no effect on the operation.\n\nPerformance\n-----------\n\nTRUNCATE TABLE is faster than DELETE, because it drops and re-creates a table.\n\nWith InnoDB, TRUNCATE TABLE is slower if innodb_file_per_table=ON is set (the\ndefault). This is because TRUNCATE TABLE unlinks the underlying tablespace\nfile, which can be an expensive operation. See MDEV-8069 for more details.\n\nThe performance issues with innodb_file_per_table=ON can be exacerbated in\ncases where the InnoDB buffer pool is very large and\ninnodb_adaptive_hash_index=ON is set. In that case, using DROP TABLE followed\nby CREATE TABLE instead of TRUNCATE TABLE may perform better. Setting\ninnodb_adaptive_hash_index=OFF (it defaults to ON before MariaDB 10.5) can\nalso help. In MariaDB 10.2 only, from MariaDB 10.2.19, this performance can\nalso be improved by setting innodb_safe_truncate=OFF. See MDEV-9459 for more\ndetails.\n\nSetting innodb_adaptive_hash_index=OFF can also improve TRUNCATE TABLE\nperformance in general. See MDEV-16796 for more details.\n\nURL: https://mariadb.com/kb/en/truncate-table/','','https://mariadb.com/kb/en/truncate-table/'); @@ -855,7 +855,7 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (744,39,'SETVAL','MariaDB starting with 10.3.1\n----------------------------\nSEQUENCEs were introduced in MariaDB 10.3.\n\nSyntax\n------\n\nSETVAL(sequence_name, next_value, [is_used, [round]])\n\nDescription\n-----------\n\nSet the next value to be returned for a SEQUENCE.\n\nThis function is compatible with PostgreSQL syntax, extended with the round\nargument.\n\nIf the is_used argument is not given or is 1 or true, then the next used value\nwill one after the given value. If is_used is 0 or false then the next\ngenerated value will be the given value.\n\nIf round is used then it will set the round value (or the internal cycle\ncount, starting at zero) for the sequence. If round is not used, it\'s assumed\nto be 0.\n\nnext_value must be an integer literal.\n\nFor SEQUENCE tables defined with CYCLE (see CREATE SEQUENCE) one should use\nboth next_value and round to define the next value. In this case the current\nsequence value is defined to be round, next_value.\n\nThe result returned by SETVAL() is next_value or NULL if the given next_value\nand round is smaller than the current value.\n\nSETVAL() will not set the SEQUENCE value to a something that is less than its\ncurrent value. This is needed to ensure that SETVAL() is replication safe. If\nyou want to set the SEQUENCE to a smaller number use ALTER SEQUENCE.\n\nIf CYCLE is used, first round and then next_value are compared to see if the\nvalue is bigger than the current value.\n\nInternally, in the MariaDB server, SETVAL() is used to inform slaves that a\nSEQUENCE has changed value. The slave may get SETVAL() statements out of\norder, but this is ok as only the biggest one will have an effect.\n\nSETVAL requires the INSERT privilege.\n\nExamples\n--------\n\nSELECT setval(foo, 42); -- Next nextval will return 43\nSELECT setval(foo, 42, true); -- Same as above\nSELECT setval(foo, 42, false); -- Next nextval will return 42\n\nSETVAL setting higher and lower values on a sequence with an increment of 10:\n\nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 50 |\n+------------+\n\nSELECT SETVAL(s, 100);\n+----------------+\n| SETVAL(s, 100) |\n+----------------+\n| 100 |\n+----------------+\n\nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 110 |\n+------------+\n\nSELECT SETVAL(s, 50);\n+---------------+\n| SETVAL(s, 50) |\n+---------------+\n| NULL |\n+---------------+\n\nSELECT NEXTVAL(s);\n+------------+\n| NEXTVAL(s) |\n+------------+\n| 120 |\n+------------+\n\nExample demonstrating round:\n\nCREATE OR REPLACE SEQUENCE s1\n START WITH 1\n MINVALUE 1\n MAXVALUE 99\n INCREMENT BY 1\n CACHE 20\n CYCLE;\n\nSELECT SETVAL(s1, 99, 1, 0);\n+----------------------+\n| SETVAL(s1, 99, 1, 0) |\n+----------------------+\n| 99 |\n+----------------------+\n\nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 1 |\n+-------------+\n\nThe following statement returns NULL, as the given next_value and round is\nsmaller than the current value.\n\nSELECT SETVAL(s1, 99, 1, 0);\n+----------------------+\n| SETVAL(s1, 99, 1, 0) |\n+----------------------+\n| NULL |\n+----------------------+\n\nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 2 |\n+-------------+\n\nIncreasing the round from zero to 1 will allow next_value to be returned.\n\nSELECT SETVAL(s1, 99, 1, 1);\n+----------------------+\n| SETVAL(s1, 99, 1, 1) |\n+----------------------+\n| 99 |\n+----------------------+\n\nSELECT NEXTVAL(s1);\n+-------------+\n| NEXTVAL(s1) |\n+-------------+\n| 1 |\n+-------------+\n\nURL: https://mariadb.com/kb/en/setval/','','https://mariadb.com/kb/en/setval/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (745,40,'JSON_ARRAYAGG','MariaDB starting with 10.5.0\n----------------------------\nJSON_ARRAYAGG was added in MariaDB 10.5.0.\n\nSyntax\n------\n\nJSON_ARRAYAGG(column_or_expression)\n\nDescription\n-----------\n\nJSON_ARRAYAGG returns a JSON array containing an element for each value in a\ngiven set of JSON or SQL values. It acts on a column or an expression that\nevaluates to a single value.\n\nReturns NULL in the case of an error, or if the result contains no rows.\n\nJSON_ARRAYAGG cannot currently be used as a window function.\n\nThe full syntax is as follows:\n\nJSON_ARRAYAGG([DISTINCT] expr [,expr ...]\n [ORDER BY {unsigned_integer | col_name | expr}\n [ASC | DESC] [,col_name ...]]\n [LIMIT {[offset,] row_count | row_count OFFSET offset}])\n\nExamples\n--------\n\nCREATE TABLE t1 (a INT, b INT);\n\nINSERT INTO t1 VALUES (1, 1),(2, 1), (1, 1),(2, 1), (3, 2),(2, 2),(2, 2),(2,\n2);\n\nSELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1;\n+-------------------+-------------------+\n| JSON_ARRAYAGG(a) | JSON_ARRAYAGG(b) |\n+-------------------+-------------------+\n| [1,2,1,2,3,2,2,2] | [1,1,1,1,2,2,2,2] |\n+-------------------+-------------------+\n\nSELECT JSON_ARRAYAGG(a), JSON_ARRAYAGG(b) FROM t1 GROUP BY b;\n+------------------+------------------+\n| JSON_ARRAYAGG(a) | JSON_ARRAYAGG(b) |\n+------------------+------------------+\n| [1,2,1,2] | [1,1,1,1] |\n| [3,2,2,2] | [2,2,2,2] |\n+------------------+------------------+\n\nURL: https://mariadb.com/kb/en/json_arrayagg/','','https://mariadb.com/kb/en/json_arrayagg/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (746,40,'JSON_OBJECTAGG','MariaDB starting with 10.5.0\n----------------------------\nJSON_OBJECTAGG was added in MariaDB 10.5.0.\n\nSyntax\n------\n\nJSON_OBJECTAGG(key, value)\n\nDescription\n-----------\n\nJSON_OBJECTAGG returns a JSON object containing key-value pairs. It takes two\nexpressions that evaluate to a single value, or two column names, as\narguments, the first used as a key, and the second as a value.\n\nReturns NULL in the case of an error, or if the result contains no rows.\n\nJSON_OBJECTAGG cannot currently be used as a window function.\n\nExamples\n--------\n\nselect * from t1;\n+------+-------+\n| a | b |\n+------+-------+\n| 1 | Hello |\n| 1 | World |\n| 2 | This |\n+------+-------+\n\nSELECT JSON_OBJECTAGG(a, b) FROM t1;\n+----------------------------------------+\n| JSON_OBJECTAGG(a, b) |\n+----------------------------------------+\n| {\"1\":\"Hello\", \"1\":\"World\", \"2\":\"This\"} |\n+----------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_objectagg/','','https://mariadb.com/kb/en/json_objectagg/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (747,40,'JSONPath Expressions','A number of JSON functions accept JSON Path expressions. MariaDB defines this\npath as follows:\n\nJSON Path Syntax\n----------------\n\npath : [\'lax\'] \'$\' [step]*\n\nThe path starts with an optional path mode. At the moment, MariaDB supports\nonly the \"lax\" mode, which is also the mode that is used when it is not\nexplicitly specified.\n\nThe $ symbol represents the context item. The search always starts from the\ncontext item; because of that, the path always starts with $.\n\nThen, it is followed by zero or more steps, which select element(s) in the\nJSON document. A step may be one of the following:\n\n* Object member selector\n* Array element selector\n* Wildcard selector\n\nObject Member Selector\n----------------------\n\nTo select member(s) in a JSON object, one can use one of the following:\n\n* .memberName selects the value of the member with name memberName.\n* .\"memberName\" - the same as above but allows one to select a member with a\nname that\'s not a valid identifier (that is, has space, dot, and/or other\ncharacters)\n* .* - selects the values of all members of the object.\n\nIf the current item is an array (instead of an object), nothing will be\nselected.\n\nArray Element Selector\n----------------------\n\nTo select elements of an array, one can use one of the following:\n\n* [N] selects element number N in the array. The elements are counted from\nzero.\n* [*] selects all elements in the array.\n\nIf the current item is an object (instead of an array), nothing will be\nselected.\n\nStarting from MariaDB server 10.9, JSON path also supports negative index in\narray, \'last\' keyword and range notation (\'to\' keyword) for accessing array\nelements. Negative index starts from -1.\n\n* [-N] selects n th element from end.\n* [last-N] selects n th element from the last element.\n* [M to N] selects range of elements starting from index M to N.\n\nExample:\n\nSET @json=\'{\n \"A\": [0,\n [1, 2, 3],\n [4, 5, 6],\n \"seven\",\n 0.8,\n true,\n false,\n \"eleven\",\n [12, [13, 14], {\"key1\":\"value1\"},[15]],\n true],\n \"B\": {\"C\": 1},\n \"D\": 2\n }\';\nSELECT JSON_EXTRACT(@json, \'$.A[-8][1]\');\n+--------------------------------------------------+\n| JSON_EXTRACT(@json, \'$.A[-8][1]\') |\n+--------------------------------------------------+\n| 5 |\n+--------------------------------------------------+\n\nSELECT JSON_EXTRACT(@json, \'$.A[last-7][1]\');\n+-----------------------------------------------+\n| SELECT JSON_EXTRACT(@json, \'$.A[last-7][1]\'); |\n+-----------------------------------------------+\n| 5 |\n+-----------------------------------------------+\n\nSET @json= \'[\n [1, {\"key1\": \"value1\"}, 3],\n [false, 5, 6],\n [7, 8, [9, {\"key2\": 2}, 11]],\n [15, 1.34, [14], [\"string1\", [16, {\"key1\":[1,2,3,[4,5,6]]}, 18]]],\n [19, 20],\n 21, 22\n ]\';\n\nSELECT JSON_EXTRACT(@json, \'$[0 to 3][2]\');\n+-----------------------------------------------+\n| JSON_EXTRACT(@json, \'$[0 to 3][2]\') |\n+-----------------------------------------------+\n| [3, 6, [9, {\"key2\": 2}, 11], [14]] |\n+-----------------------------------------------+\n\nThis will produce output for first index of eighth from last element of a two\ndimensional array.\n\nNote: In range notation, when M > N ( when M,N are greater than or equal to 0)\nor (size of array - M or size of array - N when M, N are less than 0), then it\nis treated as an impossible range and NULL is returned.\n\nSET @json= \'[1, 2, 3, 4, 5]\';\nSELECT JSON_EXTRACT(@json, \'$[4 to 2]\');\n+-----------------------------------+\n| JSON_EXTRACT(@json, \'$[4 to 2]\') |\n+-----------------------------------+\n| NULL |\n+-----------------------------------+\n\nWildcard\n--------\n\nThe wildcard step, **, recursively selects all child elements of the current\nelement. Both array elements and object members are selected.\n\nThe wildcard step must not be the last step in the JSONPath expression. It\nmust be followed by an array or object member selector step.\n\nFor example:\n\nselect json_extract(@json_doc, \'$**.price\');\n\nwill select all object members in the document that are named price, while\n\nselect json_extract(@json_doc, \'$**[2]\');\n\nwill select the second element in each of the arrays present in the document.\n\nCompatibility\n-------------\n\nMariaDB\'s JSONPath syntax supports a subset of JSON Path\'s definition in the\nSQL Standard. The most notable things not supported are the strict mode and\nfilters.\n\nMariaDB\'s JSONPath is close to MySQL\'s JSONPath. The wildcard step ( ** ) is a\nnon-standard extension that has the same meaning as in MySQL. The differences\nbetween MariaDB and MySQL\'s JSONPath are: MySQL supports [last] and [M to N]\nas array element selectors; MySQL doesn\'t allow one to specify the mode\nexplicitly (but uses lax mode implicitly).\n\nURL: https://mariadb.com/kb/en/jsonpath-expressions/','','https://mariadb.com/kb/en/jsonpath-expressions/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (747,40,'JSONPath Expressions','A number of JSON functions accept JSON Path expressions. MariaDB defines this\npath as follows:\n\nJSON Path Syntax\n----------------\n\npath : [\'lax\'] \'$\' [step]*\n\nThe path starts with an optional path mode. At the moment, MariaDB supports\nonly the \"lax\" mode, which is also the mode that is used when it is not\nexplicitly specified.\n\nThe $ symbol represents the context item. The search always starts from the\ncontext item; because of that, the path always starts with $.\n\nThen, it is followed by zero or more steps, which select element(s) in the\nJSON document. A step may be one of the following:\n\n* Object member selector\n* Array element selector\n* Wildcard selector\n\nObject Member Selector\n----------------------\n\nTo select member(s) in a JSON object, one can use one of the following:\n\n* .memberName selects the value of the member with name memberName.\n* .\"memberName\" - the same as above but allows one to select a member with a\nname that\'s not a valid identifier (that is, has space, dot, and/or other\ncharacters)\n* .* - selects the values of all members of the object.\n\nIf the current item is an array (instead of an object), nothing will be\nselected.\n\nArray Element Selector\n----------------------\n\nTo select elements of an array, one can use one of the following:\n\n* [N] selects element number N in the array. The elements are counted from\nzero.\n* [*] selects all elements in the array.\n\nIf the current item is an object (instead of an array), nothing will be\nselected.\n\nStarting from MariaDB server 10.9, JSON path also supports negative index in\narray, \'last\' keyword and range notation (\'to\' keyword) for accessing array\nelements. Negative index starts from -1.\n\n* [-N] selects n th element from end.\n* [last-N] selects n th element from the last element.\n* [M to N] selects range of elements starting from index M to N.\n\nExample:\n\nSET @json=\'{\n \"A\": [0,\n [1, 2, 3],\n [4, 5, 6],\n \"seven\",\n 0.8,\n true,\n false,\n \"eleven\",\n [12, [13, 14], {\"key1\":\"value1\"},[15]],\n true],\n \"B\": {\"C\": 1},\n \"D\": 2\n }\';\nSELECT JSON_EXTRACT(@json, \'$.A[-8][1]\');\n+--------------------------------------------------+\n| JSON_EXTRACT(@json, \'$.A[-8][1]\') |\n+--------------------------------------------------+\n| 5 |\n+--------------------------------------------------+\n\nSELECT JSON_EXTRACT(@json, \'$.A[last-7][1]\');\n+-----------------------------------------------+\n| SELECT JSON_EXTRACT(@json, \'$.A[last-7][1]\'); |\n+-----------------------------------------------+\n| 5 |\n+-----------------------------------------------+\n\nSET @json= \'[\n [1, {\"key1\": \"value1\"}, 3],\n [false, 5, 6],\n [7, 8, [9, {\"key2\": 2}, 11]],\n [15, 1.34, [14], [\"string1\", [16, {\"key1\":[1,2,3,[4,5,6]]}, 18]]],\n [19, 20],\n 21, 22\n ]\';\n\nSELECT JSON_EXTRACT(@json, \'$[0 to 3][2]\');\n+-----------------------------------------------+\n| JSON_EXTRACT(@json, \'$[0 to 3][2]\') |\n+-----------------------------------------------+\n| [3, 6, [9, {\"key2\": 2}, 11], [14]] |\n+-----------------------------------------------+\n\nThis will produce output for first index of eighth from last element of a two\ndimensional array.\n\nNote: In range notation, when M > N ( when M,N are greater than or equal to 0)\nor (size of array - M or size of array - N when M, N are less than 0), then it\nis treated as an impossible range and NULL is returned.\n\nSET @json= \'[1, 2, 3, 4, 5]\';\nSELECT JSON_EXTRACT(@json, \'$[4 to 2]\');\n+-----------------------------------+\n| JSON_EXTRACT(@json, \'$[4 to 2]\') |\n+-----------------------------------+\n| NULL |\n+-----------------------------------+\n\nWildcard\n--------\n\nThe wildcard step, **, recursively selects all child elements of the current\nelement. Both array elements and object members are selected.\n\nThe wildcard step must not be the last step in the JSONPath expression. It\nmust be followed by an array or object member selector step.\n\nFor example:\n\nselect json_extract(@json_doc, \'$**.price\');\n\nwill select all object members in the document that are named price, while\n\nselect json_extract(@json_doc, \'$**[2]\');\n\nwill select the second element in each of the arrays present in the document.\n\nCompatibility\n-------------\n\nMariaDB\'s JSONPath syntax supports a subset of JSON Path\'s definition in the\nSQL Standard. The most notable things not supported are the strict mode and\nfilters.\n\nMariaDB\'s JSONPath is close to MySQL\'s JSONPath. The wildcard step ( ** ) is a\nnon-standard extension that has the same meaning as in MySQL. The difference\nbetween MariaDB and MySQL\'s JSONPath is: MySQL doesn\'t allow one to specify\nthe mode explicitly (but uses lax mode implicitly).\n\nURL: https://mariadb.com/kb/en/jsonpath-expressions/','','https://mariadb.com/kb/en/jsonpath-expressions/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (748,40,'JSON_ARRAY','Syntax\n------\n\nJSON_ARRAY([value[, value2] ...])\n\nDescription\n-----------\n\nReturns a JSON array containing the listed values. The list can be empty.\n\nExample\n-------\n\nSELECT Json_Array(56, 3.1416, \'My name is \"Foo\"\', NULL);\n+--------------------------------------------------+\n| Json_Array(56, 3.1416, \'My name is \"Foo\"\', NULL) |\n+--------------------------------------------------+\n| [56, 3.1416, \"My name is \\\"Foo\\\"\", null] |\n+--------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_array/','','https://mariadb.com/kb/en/json_array/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (749,40,'JSON_ARRAY_APPEND','Syntax\n------\n\nJSON_ARRAY_APPEND(json_doc, path, value[, path, value] ...)\n\nDescription\n-----------\n\nAppends values to the end of the specified arrays within a JSON document,\nreturning the result, or NULL if any of the arguments are NULL.\n\nEvaluation is performed from left to right, with the resulting document from\nthe previous pair becoming the new value against which the next pair is\nevaluated.\n\nIf the json_doc is not a valid JSON document, or if any of the paths are not\nvalid, or contain a * or ** wildcard, an error is returned.\n\nExamples\n--------\n\nSET @json = \'[1, 2, [3, 4]]\';\n\nSELECT JSON_ARRAY_APPEND(@json, \'$[0]\', 5)\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[0]\', 5) |\n+-------------------------------------+\n| [[1, 5], 2, [3, 4]] |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_APPEND(@json, \'$[1]\', 6);\n+-------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[1]\', 6) |\n+-------------------------------------+\n| [1, [2, 6], [3, 4]] |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_APPEND(@json, \'$[1]\', 6, \'$[2]\', 7);\n+------------------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$[1]\', 6, \'$[2]\', 7) |\n+------------------------------------------------+\n| [1, [2, 6], [3, 4, 7]] |\n+------------------------------------------------+\n\nSELECT JSON_ARRAY_APPEND(@json, \'$\', 5);\n+----------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$\', 5) |\n+----------------------------------+\n| [1, 2, [3, 4], 5] |\n+----------------------------------+\n\nSET @json = \'{\"A\": 1, \"B\": [2], \"C\": [3, 4]}\';\n\nSELECT JSON_ARRAY_APPEND(@json, \'$.B\', 5);\n+------------------------------------+\n| JSON_ARRAY_APPEND(@json, \'$.B\', 5) |\n+------------------------------------+\n| {\"A\": 1, \"B\": [2, 5], \"C\": [3, 4]} |\n+------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_array_append/','','https://mariadb.com/kb/en/json_array_append/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (750,40,'JSON_ARRAY_INSERT','Syntax\n------\n\nJSON_ARRAY_INSERT(json_doc, path, value[, path, value] ...)\n\nDescription\n-----------\n\nInserts a value into a JSON document, returning the modified document, or NULL\nif any of the arguments are NULL.\n\nEvaluation is performed from left to right, with the resulting document from\nthe previous pair becoming the new value against which the next pair is\nevaluated.\n\nIf the json_doc is not a valid JSON document, or if any of the paths are not\nvalid, or contain a * or ** wildcard, an error is returned.\n\nExamples\n--------\n\nSET @json = \'[1, 2, [3, 4]]\';\n\nSELECT JSON_ARRAY_INSERT(@json, \'$[0]\', 5);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[0]\', 5) |\n+-------------------------------------+\n| [5, 1, 2, [3, 4]] |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_INSERT(@json, \'$[1]\', 6);\n+-------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[1]\', 6) |\n+-------------------------------------+\n| [1, 6, 2, [3, 4]] |\n+-------------------------------------+\n\nSELECT JSON_ARRAY_INSERT(@json, \'$[1]\', 6, \'$[2]\', 7);\n+------------------------------------------------+\n| JSON_ARRAY_INSERT(@json, \'$[1]\', 6, \'$[2]\', 7) |\n+------------------------------------------------+\n| [1, 6, 7, 2, [3, 4]] |\n+------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/json_array_insert/','','https://mariadb.com/kb/en/json_array_insert/'); @@ -935,8 +935,8 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (821,48,'Multiplication Operator (*)','Syntax\n------\n\n*\n\nDescription\n-----------\n\nMultiplication operator.\n\nExamples\n--------\n\nSELECT 7*6;\n+-----+\n| 7*6 |\n+-----+\n| 42 |\n+-----+\n\nSELECT 1234567890*9876543210;\n+-----------------------+\n| 1234567890*9876543210 |\n+-----------------------+\n| -6253480962446024716 |\n+-----------------------+\n\nSELECT 18014398509481984*18014398509481984.0;\n+---------------------------------------+\n| 18014398509481984*18014398509481984.0 |\n+---------------------------------------+\n| 324518553658426726783156020576256.0 |\n+---------------------------------------+\n\nSELECT 18014398509481984*18014398509481984;\n+-------------------------------------+\n| 18014398509481984*18014398509481984 |\n+-------------------------------------+\n| 0 |\n+-------------------------------------+\n\nURL: https://mariadb.com/kb/en/multiplication-operator/','','https://mariadb.com/kb/en/multiplication-operator/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (822,48,'Subtraction Operator (-)','Syntax\n------\n\n-\n\nDescription\n-----------\n\nSubtraction. The operator is also used as the unary minus for changing sign.\n\nIf both operands are integers, the result is calculated with BIGINT precision.\nIf either integer is unsigned, the result is also an unsigned integer, unless\nthe NO_UNSIGNED_SUBTRACTION SQL_MODE is enabled, in which case the result is\nalways signed.\n\nFor real or string operands, the operand with the highest precision determines\nthe result precision.\n\nExamples\n--------\n\nSELECT 96-9;\n+------+\n| 96-9 |\n+------+\n| 87 |\n+------+\n\nSELECT 15-17;\n+-------+\n| 15-17 |\n+-------+\n| -2 |\n+-------+\n\nSELECT 3.66 + 1.333;\n+--------------+\n| 3.66 + 1.333 |\n+--------------+\n| 4.993 |\n+--------------+\n\nUnary minus:\n\nSELECT - (3+5);\n+---------+\n| - (3+5) |\n+---------+\n| -8 |\n+---------+\n\nURL: https://mariadb.com/kb/en/subtraction-operator-/','','https://mariadb.com/kb/en/subtraction-operator-/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (823,49,'CHANGE MASTER TO','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nCHANGE MASTER [\'connection_name\'] TO master_def [, master_def] ... \n [FOR CHANNEL \'channel_name\']\n\nmaster_def:\n MASTER_BIND = \'interface_name\'\n | MASTER_HOST = \'host_name\'\n | MASTER_USER = \'user_name\'\n | MASTER_PASSWORD = \'password\'\n | MASTER_PORT = port_num\n | MASTER_CONNECT_RETRY = interval\n | MASTER_HEARTBEAT_PERIOD = interval\n | MASTER_LOG_FILE = \'master_log_name\'\n | MASTER_LOG_POS = master_log_pos\n | RELAY_LOG_FILE = \'relay_log_name\'\n | RELAY_LOG_POS = relay_log_pos\n | MASTER_DELAY = interval\n | MASTER_SSL = {0|1}\n | MASTER_SSL_CA = \'ca_file_name\'\n | MASTER_SSL_CAPATH = \'ca_directory_name\'\n | MASTER_SSL_CERT = \'cert_file_name\'\n | MASTER_SSL_CRL = \'crl_file_name\'\n | MASTER_SSL_CRLPATH = \'crl_directory_name\'\n | MASTER_SSL_KEY = \'key_file_name\'\n | MASTER_SSL_CIPHER = \'cipher_list\'\n | MASTER_SSL_VERIFY_SERVER_CERT = {0|1}\n | MASTER_USE_GTID = {current_pos|slave_pos|no}\n | MASTER_DEMOTE_TO_SLAVE = bool\n | IGNORE_SERVER_IDS = (server_id_list)\n | DO_DOMAIN_IDS = ([N,..])\n | IGNORE_DOMAIN_IDS = ([N,..])\n\nDescription\n-----------\n\nThe CHANGE MASTER statement sets the options that a replica uses to connect to\nand replicate from a primary.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nto using the channel_name directly after CHANGE MASTER.\n\nMulti-Source Replication\n------------------------\n\nIf you are using multi-source replication, then you need to specify a\nconnection name when you execute CHANGE MASTER. There are two ways to do this:\n\n* Setting the default_master_connection system variable prior to executing\nCHANGE MASTER.\n* Setting the connection_name parameter when executing CHANGE MASTER.\n\ndefault_master_connection\n-------------------------\n\nSET default_master_connection = \'gandalf\';\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nconnection_name\n---------------\n\nSTOP SLAVE \'gandalf\';\nCHANGE MASTER \'gandalf\' TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE \'gandalf\';\n\nOptions\n-------\n\nConnection Options\n------------------\n\nMASTER_USER\n-----------\n\nThe MASTER_USER option for CHANGE MASTER defines the user account that the\nreplica will use to connect to the primary.\n\nThis user account will need the REPLICATION SLAVE privilege (or, from MariaDB\n10.5.1, the REPLICATION REPLICA on the primary.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nThe maximum length of the MASTER_USER string is 96 characters until MariaDB\n10.5, and 128 characters from MariaDB 10.6.\n\nMASTER_PASSWORD\n---------------\n\nThe MASTER_USER option for CHANGE MASTER defines the password that the replica\nwill use to connect to the primary as the user account defined by the\nMASTER_USER option.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nThe maximum length of the MASTER_PASSWORD string is 32 characters. The\neffective maximum length of the string depends on how many bytes are used per\ncharacter and can be up to 96 characters.\n\nDue to MDEV-29994, the password can be silently truncated to 41 characters\nwhen MariaDB is restarted. For this reason it is recommended to use a password\nthat is shorter than this.\n\nMASTER_HOST\n-----------\n\nThe MASTER_HOST option for CHANGE MASTER defines the hostname or IP address of\nthe primary.\n\nIf you set the value of the MASTER_HOST option to the empty string, then that\nis not the same as not setting the option\'s value at all. If you set the value\nof the MASTER_HOST option to the empty string, then the CHANGE MASTER command\nwill fail with an error. In MariaDB 5.3 and before, if you set the value of\nthe MASTER_HOST option to the empty string, then the CHANGE MASTER command\nwould succeed, but the subsequent START SLAVE command would fail.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_HOST=\'dbserver1.example.com\',\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\',\n MASTER_USE_GTID=slave_pos;\nSTART SLAVE;\n\nIf you set the value of the MASTER_HOST option in a CHANGE MASTER command,\nthen the replica assumes that the primary is different from before, even if\nyou set the value of this option to the same value it had previously. In this\nscenario, the replica will consider the old values for the primary\'s binary\nlog file name and position to be invalid for the new primary. As a side\neffect, if you do not explicitly set the values of the MASTER_LOG_FILE and\nMASTER_LOG_POS options in the statement, then the statement will be implicitly\nappended with MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if you enable\nGTID mode for replication by setting the MASTER_USE_GTID option to some value\nother than no in the statement, then these values will effectively be ignored\nanyway.\n\nReplicas cannot connect to primaries using Unix socket files or Windows named\npipes. The replica must connect to the primary using TCP/IP.\n\nThe maximum length of the MASTER_HOST string is 60 characters until MariaDB\n10.5, and 255 characters from MariaDB 10.6.\n\nMASTER_PORT\n-----------\n\nThe MASTER_PORT option for CHANGE MASTER defines the TCP/IP port of the\nprimary.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_HOST=\'dbserver1.example.com\',\n MASTER_PORT=3307,\n MASTER_USER=\'repl\',\n MASTER_PASSWORD=\'new3cret\',\n MASTER_USE_GTID=slave_pos;\nSTART SLAVE;\n\nIf you set the value of the MASTER_PORT option in a CHANGE MASTER command,\nthen the replica assumes that the primary is different from before, even if\nyou set the value of this option to the same value it had previously. In this\nscenario, the replica will consider the old values for the primary\'s binary\nlog file name and position to be invalid for the new primary. As a side\neffect, if you do not explicitly set the values of the MASTER_LOG_FILE and\nMASTER_LOG_POS options in the statement, then the statement will be implicitly\nappended with MASTER_LOG_FILE=\'\' and MASTER_LOG_POS=4. However, if you enable\nGTID mode for replication by setting the MASTER_USE_GTID option to some value\nother than no in the statement, then these values will effectively be ignored\nanyway.\n\nReplicas cannot connect to primaries using Unix socket files or Windows named\npipes. The replica must connect to the primary using TCP/IP.\n\nMASTER_CONNECT_RETRY\n--------------------\n\nThe MASTER_CONNECT_RETRY option for CHANGE MASTER defines how many seconds\nthat the replica will wait between connection retries. The default is 60.\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_CONNECT_RETRY=20;\nSTART SLAVE;\n\nThe number of connection attempts is limited by the master_retry_count option.\nIt can be set either on the command-line or in a server option group in an\noption file prior to starting up the server. For example:\n\n[mariadb]\n...\nmaster_retry_count=4294967295\n\nMASTER_BIND\n-----------\n\nThe MASTER_BIND option for CHANGE MASTER is only supported by MySQL 5.6.2 and\nlater and by MySQL NDB Cluster 7.3.1 and later. This option is not supported\nby MariaDB. See MDEV-19248 for more information.\n\nThe MASTER_BIND option for CHANGE MASTER can be used on replicas that have\nmultiple network interfaces to choose which network interface the replica will\nuse to connect to the primary.\n\nMASTER_HEARTBEAT_PERIOD\n-----------------------\n\nThe MASTER_HEARTBEAT_PERIOD option for CHANGE MASTER can be used to set the\ninterval in seconds between replication heartbeats. Whenever the primary\'s\nbinary log is updated with an event, the waiting period for the next heartbeat\nis reset.\n\nThis option\'s interval argument has the following characteristics:\n\n* It is a decimal value with a range of 0 to 4294967 seconds.\n* It has a resolution of hundredths of a second.\n* Its smallest valid non-zero value is 0.001.\n* Its default value is the value of the slave_net_timeout system variable\ndivided by 2.\n* If it\'s set to 0, then heartbeats are disabled.\n\nHeartbeats are sent by the primary only if there are no unsent events in the\nbinary log file for a period longer than the interval.\n\nIf the RESET SLAVE statement is executed, then the heartbeat interval is reset\nto the default.\n\nIf the slave_net_timeout system variable is set to a value that is lower than\nthe current heartbeat interval, then a warning will be issued.\n\nTLS Options\n-----------\n\nThe TLS options are used for providing information about TLS. The options can\nbe set even on replicas that are compiled without TLS support. The TLS options\nare saved to either the default master.info file or the file that is\nconfigured by the master_info_file option, but these TLS options are ignored\nunless the replica supports TLS.\n\nSee Replication with Secure Connections for more information.\n\nMASTER_SSL\n----------\n\nThe MASTER_SSL option for CHANGE MASTER tells the replica whether to force TLS\nfor the connection. The valid values are 0 or 1.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL=1;\nSTART SLAVE;\n\nMASTER_SSL_CA\n-------------\n\nThe MASTER_SSL_CA option for CHANGE MASTER defines a path to a PEM file that\nshould contain one or more X509 certificates for trusted Certificate\nAuthorities (CAs) to use for TLS. This option requires that you use the\nabsolute path, not a relative path. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Authorities (CAs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CA string is 511 characters.\n\nMASTER_SSL_CAPATH\n-----------------\n\nThe MASTER_SSL_CAPATH option for CHANGE MASTER defines a path to a directory\nthat contains one or more PEM files that should each contain one X509\ncertificate for a trusted Certificate Authority (CA) to use for TLS. This\noption requires that you use the absolute path, not a relative path. The\ndirectory specified by this option needs to be run through the openssl rehash\ncommand. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CAPATH=\'/etc/my.cnf.d/certificates/ca/\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Authorities (CAs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CA_PATH string is 511 characters.\n\nMASTER_SSL_CERT\n---------------\n\nThe MASTER_SSL_CERT option for CHANGE MASTER defines a path to the X509\ncertificate file to use for TLS. This option requires that you use the\nabsolute path, not a relative path. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_CERT string is 511 characters.\n\nMASTER_SSL_CRL\n--------------\n\nThe MASTER_SSL_CRL option for CHANGE MASTER defines a path to a PEM file that\nshould contain one or more revoked X509 certificates to use for TLS. This\noption requires that you use the absolute path, not a relative path.\n\nThis option is only supported if the server was built with OpenSSL. If the\nserver was built with yaSSL, then this option is not supported. See TLS and\nCryptography Libraries Used by MariaDB for more information about which\nlibraries are used on which platforms.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CRL=\'/etc/my.cnf.d/certificates/crl.pem\';\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Revocation Lists (CRLs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CRL string is 511 characters.\n\nMASTER_SSL_CRLPATH\n------------------\n\nThe MASTER_SSL_CRLPATH option for CHANGE MASTER defines a path to a directory\nthat contains one or more PEM files that should each contain one revoked X509\ncertificate to use for TLS. This option requires that you use the absolute\npath, not a relative path. The directory specified by this variable needs to\nbe run through the openssl rehash command.\n\nThis option is only supported if the server was built with OpenSSL. If the\nserver was built with yaSSL, then this option is not supported. See TLS and\nCryptography Libraries Used by MariaDB for more information about which\nlibraries are used on which platforms.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CRLPATH=\'/etc/my.cnf.d/certificates/crl/\';\nSTART SLAVE;\n\nSee Secure Connections Overview: Certificate Revocation Lists (CRLs) for more\ninformation.\n\nThe maximum length of MASTER_SSL_CRL_PATH string is 511 characters.\n\nMASTER_SSL_KEY\n--------------\n\nThe MASTER_SSL_KEY option for CHANGE MASTER defines a path to a private key\nfile to use for TLS. This option requires that you use the absolute path, not\na relative path. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;','','https://mariadb.com/kb/en/change-master-to/'); -update help_topic set description = CONCAT(description, '\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_KEY string is 511 characters.\n\nMASTER_SSL_CIPHER\n-----------------\n\nThe MASTER_SSL_CIPHER option for CHANGE MASTER defines the list of permitted\nciphers or cipher suites to use for TLS. Besides cipher names, if MariaDB was\ncompiled with OpenSSL, this option could be set to \"SSLv3\" or \"TLSv1.2\" to\nallow all SSLv3 or all TLSv1.2 ciphers. Note that the TLSv1.3 ciphers cannot\nbe excluded when using OpenSSL, even by using this option. See Using TLSv1.3\nfor details. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CIPHER=\'TLSv1.2\';\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_CIPHER string is 511 characters.\n\nMASTER_SSL_VERIFY_SERVER_CERT\n-----------------------------\n\nThe MASTER_SSL_VERIFY_SERVER_CERT option for CHANGE MASTER enables server\ncertificate verification. This option is disabled by default.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\nSTART SLAVE;\n\nSee Secure Connections Overview: Server Certificate Verification for more\ninformation.\n\nBinary Log Options\n------------------\n\nThese options are related to the binary log position on the primary.\n\nMASTER_LOG_FILE\n---------------\n\nThe MASTER_LOG_FILE option for CHANGE MASTER can be used along with\nMASTER_LOG_POS to specify the coordinates at which the replica\'s I/O thread\nshould begin reading from the primary\'s binary logs the next time the thread\nstarts.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be specified if the\nRELAY_LOG_FILE and RELAY_LOG_POS options were also specified.\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options are effectively ignored if you\nenable GTID mode for replication by setting the MASTER_USE_GTID option to some\nvalue other than no in the statement.\n\nMASTER_LOG_POS\n--------------\n\nThe MASTER_LOG_POS option for CHANGE MASTER can be used along with\nMASTER_LOG_FILE to specify the coordinates at which the replica\'s I/O thread\nshould begin reading from the primary\'s binary logs the next time the thread\nstarts.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be specified if the\nRELAY_LOG_FILE and RELAY_LOG_POS options were also specified.\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options are effectively ignored if you\nenable GTID mode for replication by setting the MASTER_USE_GTID option to some\nvalue other than no in the statement.\n\nRelay Log Options\n-----------------\n\nThese options are related to the relay log position on the replica.\n\nRELAY_LOG_FILE\n--------------\n\nThe RELAY_LOG_FILE option for CHANGE MASTER can be used along with the\nRELAY_LOG_POS option to specify the coordinates at which the replica\'s SQL\nthread should begin reading from the relay log the next time the thread starts.\n\nThe CHANGE MASTER statement usually deletes all relay log files. However, if\nthe RELAY_LOG_FILE and/or RELAY_LOG_POS options are specified, then existing\nrelay log files are kept.\n\nWhen you want to change the relay log position, you only need to stop the\nreplica\'s SQL thread. The replica\'s I/O thread can continue running. The STOP\nSLAVE and START SLAVE statements support the SQL_THREAD option for this\nscenario. For example:\n\nSTOP SLAVE SQL_THREAD;\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\nSTART SLAVE SQL_THREAD;\n\nWhen the value of this option is changed, the metadata about the replica\'s SQL\nthread\'s position in the relay logs will also be changed in the relay-log.info\nfile or the file that is configured by the relay_log_info_file system variable.\n\nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be specified if the\nMASTER_LOG_FILE and MASTER_LOG_POS options were also specified.\n\nRELAY_LOG_POS\n-------------\n\nThe RELAY_LOG_POS option for CHANGE MASTER can be used along with the\nRELAY_LOG_FILE option to specify the coordinates at which the replica\'s SQL\nthread should begin reading from the relay log the next time the thread starts.\n\nThe CHANGE MASTER statement usually deletes all relay log files. However, if\nthe RELAY_LOG_FILE and/or RELAY_LOG_POS options are specified, then existing\nrelay log files are kept.\n\nWhen you want to change the relay log position, you only need to stop the\nreplica\'s SQL thread. The replica\'s I/O thread can continue running. The STOP\nSLAVE and START SLAVE statements support the SQL_THREAD option for this\nscenario. For example:\n\nSTOP SLAVE SQL_THREAD;\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\nSTART SLAVE SQL_THREAD;\n\nWhen the value of this option is changed, the metadata about the replica\'s SQL\nthread\'s position in the relay logs will also be changed in the relay-log.info\nfile or the file that is configured by the relay_log_info_file system variable.\n\nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be specified if the\nMASTER_LOG_FILE and MASTER_LOG_POS options were also specified.\n\nGTID Options\n------------\n\nMASTER_USE_GTID\n---------------\n\nThe MASTER_USE_GTID option for CHANGE MASTER can be used to configure the\nreplica to use the global transaction ID (GTID) when connecting to a primary.\nThe possible values are:\n\n* current_pos - Replicate in GTID mode and use gtid_current_pos as the\nposition to start downloading transactions from the primary. Deprecated from\nMariaDB 10.10. Using to transition to primary can break the replication state\nif the replica executes local transactions due to actively updating\ngtid_current_pos with gtid_binlog_pos and gtid_slave_pos. Use the new, safe,\nMASTER_DEMOTE_TO_SLAVE=<bool> option instead.\n* slave_pos - Replicate in GTID mode and use gtid_slave_pos as the position to\nstart downloading transactions from the primary. From MariaDB 10.5.1,\nreplica_pos is an alias for slave_pos.\n* no - Don\'t replicate in GTID mode.\n\nMASTER_DEMOTE_TO_SLAVE\n----------------------\n\nMariaDB starting with 10.10\n---------------------------\nUsed to transition a primary to become a replica. Replaces the old\nMASTER_USE_GTID=current_pos with a safe alternative by forcing users to set\nUsing_Gtid=Slave_Pos and merging gtid_binlog_pos into gtid_slave_pos once at\nCHANGE MASTER TO time. If gtid_slave_pos is more recent than gtid_binlog_pos\n(as in the case of chain replication), the replication state should be\npreserved.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_USE_GTID = current_pos;\nSTART SLAVE;\n\nOr:\n\nSTOP SLAVE;\nSET GLOBAL gtid_slave_pos=\'0-1-153\';\nCHANGE MASTER TO\n MASTER_USE_GTID = slave_pos;\nSTART SLAVE;\n\nReplication Filter Options\n--------------------------\n\nAlso see Replication filters.\n\nIGNORE_SERVER_IDS\n-----------------\n\nThe IGNORE_SERVER_IDS option for CHANGE MASTER can be used to configure a\nreplica to ignore binary log events that originated from certain servers.\nFiltered binary log events will not get logged to the replica’s relay log, and\nthey will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\nserver_id values. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_SERVER_IDS = (3,5);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_SERVER_IDS = ();\nSTART SLAVE;\n\nDO_DOMAIN_IDS\n-------------\n\nThe DO_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica\nto only apply binary log events if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not get logged to the\nreplica’s relay log, and they will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\ngtid_domain_id values. Duplicate values are automatically ignored. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n DO_DOMAIN_IDS = ();\nSTART SLAVE;\n\nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option cannot both be set\nto non-empty values at the same time. If you want to set the DO_DOMAIN_IDS\noption, and the IGNORE_DOMAIN_IDS option was previously set, then you need to\nclear the value of the IGNORE_DOMAIN_IDS option. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (),\n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nThe DO_DOMAIN_IDS option can only be specified if the replica is replicating\nin GTID mode. Therefore, the MASTER_USE_GTID option must also be set to some\nvalue other than no in order to use this option.\n\nIGNORE_DOMAIN_IDS\n-----------------\n\nThe IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used to configure a\nreplica to ignore binary log events if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not get logged to the\nreplica’s relay log, and they will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\ngtid_domain_id values. Duplicate values are automatically ignored. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = ();\nSTART SLAVE;\n\nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option cannot both be set\nto non-empty values at the same time. If you want to set the IGNORE_DOMAIN_IDS\noption, and the DO_DOMAIN_IDS option was previously set, then you need to\nclear the value of the DO_DOMAIN_IDS option. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n DO_DOMAIN_IDS = (),\n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nThe IGNORE_DOMAIN_IDS option can only be specified if the replica is\nreplicating in GTID mode. Therefore, the MASTER_USE_GTID option must also be\nset to some value other than no in order to use this option.\n\nDelayed Replication Options\n---------------------------\n\nMASTER_DELAY\n------------\n\nThe MASTER_DELAY option for CHANGE MASTER can be used to enable delayed\nreplication. This option specifies the time in seconds (at least) that a\nreplica should lag behind the primary up to a maximum value of 2147483647, or\nabout 68 years. Before executing an event, the replica will first wait, if\nnecessary, until the given time has passed since the event was created on the\nprimary. The result is that the replica will reflect the state of the primary\nsome time back in the past. The default is zero, no delay.\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_DELAY=3600;\nSTART SLAVE;\n\nChanging Option Values\n----------------------\n\nIf you don\'t specify a given option when executing the CHANGE MASTER\nstatement, then the option keeps its old value in most cases. Most of the\ntime, there is no need to specify the options that do not need to change. For\nexample, if the password for the user account that the replica uses to connect\nto its primary has changed, but no other options need to change, then you can\njust change the MASTER_PASSWORD option by executing the following commands:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nThere are some cases where options are implicitly reset, such as when the\nMASTER_HOST and MASTER_PORT options are changed.\n\nOption Persistence\n------------------\n\nThe values of the MASTER_LOG_FILE and MASTER_LOG_POS options (i.e. the binary\nlog position on the primary) and most other options are written to either the\ndefault master.info file or the file that is configured by the\nmaster_info_file option. The replica\'s I/O thread keeps this binary log\nposition updated as it downloads events only when MASTER_USE_GTID option is\nset to NO. Otherwise the file is not updated on a per event basis.\n\nThe master_info_file option can be set either on the command-line or in a\nserver option group in an option file prior to starting up the server. For\nexample:\n\n[mariadb]\n...\nmaster_info_file=/mariadb/myserver1-master.info\n\nThe values of the RELAY_LOG_FILE and RELAY_LOG_POS options (i.e. the relay log\nposition) are written to either the default relay-log.info file or the file\nthat is configured by the relay_log_info_file system variable. The replica\'s\nSQL thread keeps this relay log position updated as it applies events.\n\nThe relay_log_info_file system variable can be set either on the command-line\nor in a server option group in an option file prior to starting up the server.\nFor example:\n\n[mariadb]\n...\nrelay_log_info_file=/mariadb/myserver1-relay-log.info\n\nGTID Persistence\n----------------\n\nIf the replica is replicating binary log events that contain GTIDs, then the\nreplica\'s SQL thread will write every GTID that it applies to the\nmysql.gtid_slave_pos table. This GTID can be inspected and modified through\nthe gtid_slave_pos system variable.\n\nIf the replica has the log_slave_updates system variable enabled and if the\nreplica has the binary log enabled, then every write by the replica\'s SQL\nthread will also go into the replica\'s binary log. This means that GTIDs of\nreplicated transactions would be reflected in the value of the gtid_binlog_pos\nsystem variable.\n\nCreating a Replica from a Backup\n--------------------------------\n\nThe CHANGE MASTER statement is useful for setting up a replica when you have a\nbackup of the primary and you also have the binary log position or GTID\nposition corresponding to the backup.\n\nAfter restoring the backup on the replica, you could execute something like\nthis to use the binary log position:\n\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n') WHERE help_topic_id = 823; -update help_topic set description = CONCAT(description, '\nOr you could execute something like this to use the GTID position:\n\nSET GLOBAL gtid_slave_pos=\'0-1-153\';\nCHANGE MASTER TO\n MASTER_USE_GTID=slave_pos;\nSTART SLAVE;\n\nSee Setting up a Replication Slave with Mariabackup for more information on\nhow to do this with Mariabackup.\n\nExample\n-------\n\nThe following example changes the primary and primary\'s binary log\ncoordinates. This is used when you want to set up the replica to replicate the\nprimary:\n\nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\nSTART SLAVE;\n\nURL: https://mariadb.com/kb/en/change-master-to/') WHERE help_topic_id = 823; +update help_topic set description = CONCAT(description, '\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_KEY string is 511 characters.\n\nMASTER_SSL_CIPHER\n-----------------\n\nThe MASTER_SSL_CIPHER option for CHANGE MASTER defines the list of permitted\nciphers or cipher suites to use for TLS. Besides cipher names, if MariaDB was\ncompiled with OpenSSL, this option could be set to \"SSLv3\" or \"TLSv1.2\" to\nallow all SSLv3 or all TLSv1.2 ciphers. Note that the TLSv1.3 ciphers cannot\nbe excluded when using OpenSSL, even by using this option. See Using TLSv1.3\nfor details. This option implies the MASTER_SSL option.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1,\n MASTER_SSL_CIPHER=\'TLSv1.2\';\nSTART SLAVE;\n\nThe maximum length of MASTER_SSL_CIPHER string is 511 characters.\n\nMASTER_SSL_VERIFY_SERVER_CERT\n-----------------------------\n\nThe MASTER_SSL_VERIFY_SERVER_CERT option for CHANGE MASTER enables server\ncertificate verification. This option is disabled by default.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_SSL_CERT=\'/etc/my.cnf.d/certificates/server-cert.pem\',\n MASTER_SSL_KEY=\'/etc/my.cnf.d/certificates/server-key.pem\',\n MASTER_SSL_CA=\'/etc/my.cnf.d/certificates/ca.pem\',\n MASTER_SSL_VERIFY_SERVER_CERT=1;\nSTART SLAVE;\n\nSee Secure Connections Overview: Server Certificate Verification for more\ninformation.\n\nBinary Log Options\n------------------\n\nThese options are related to the binary log position on the primary.\n\nMASTER_LOG_FILE\n---------------\n\nThe MASTER_LOG_FILE option for CHANGE MASTER can be used along with\nMASTER_LOG_POS to specify the coordinates at which the replica\'s I/O thread\nshould begin reading from the primary\'s binary logs the next time the thread\nstarts.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be specified if the\nRELAY_LOG_FILE and RELAY_LOG_POS options were also specified.\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options are effectively ignored if you\nenable GTID mode for replication by setting the MASTER_USE_GTID option to some\nvalue other than no in the statement.\n\nMASTER_LOG_POS\n--------------\n\nThe MASTER_LOG_POS option for CHANGE MASTER can be used along with\nMASTER_LOG_FILE to specify the coordinates at which the replica\'s I/O thread\nshould begin reading from the primary\'s binary logs the next time the thread\nstarts.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options cannot be specified if the\nRELAY_LOG_FILE and RELAY_LOG_POS options were also specified.\n\nThe MASTER_LOG_FILE and MASTER_LOG_POS options are effectively ignored if you\nenable GTID mode for replication by setting the MASTER_USE_GTID option to some\nvalue other than no in the statement.\n\nRelay Log Options\n-----------------\n\nThese options are related to the relay log position on the replica.\n\nRELAY_LOG_FILE\n--------------\n\nThe RELAY_LOG_FILE option for CHANGE MASTER can be used along with the\nRELAY_LOG_POS option to specify the coordinates at which the replica\'s SQL\nthread should begin reading from the relay log the next time the thread starts.\n\nThe CHANGE MASTER statement usually deletes all relay log files. However, if\nthe RELAY_LOG_FILE and/or RELAY_LOG_POS options are specified, then existing\nrelay log files are kept.\n\nWhen you want to change the relay log position, you only need to stop the\nreplica\'s SQL thread. The replica\'s I/O thread can continue running. The STOP\nSLAVE and START SLAVE statements support the SQL_THREAD option for this\nscenario. For example:\n\nSTOP SLAVE SQL_THREAD;\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\nSTART SLAVE SQL_THREAD;\n\nWhen the value of this option is changed, the metadata about the replica\'s SQL\nthread\'s position in the relay logs will also be changed in the relay-log.info\nfile or the file that is configured by the relay_log_info_file system variable.\n\nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be specified if the\nMASTER_LOG_FILE and MASTER_LOG_POS options were also specified.\n\nRELAY_LOG_POS\n-------------\n\nThe RELAY_LOG_POS option for CHANGE MASTER can be used along with the\nRELAY_LOG_FILE option to specify the coordinates at which the replica\'s SQL\nthread should begin reading from the relay log the next time the thread starts.\n\nThe CHANGE MASTER statement usually deletes all relay log files. However, if\nthe RELAY_LOG_FILE and/or RELAY_LOG_POS options are specified, then existing\nrelay log files are kept.\n\nWhen you want to change the relay log position, you only need to stop the\nreplica\'s SQL thread. The replica\'s I/O thread can continue running. The STOP\nSLAVE and START SLAVE statements support the SQL_THREAD option for this\nscenario. For example:\n\nSTOP SLAVE SQL_THREAD;\nCHANGE MASTER TO\n RELAY_LOG_FILE=\'slave-relay-bin.006\',\n RELAY_LOG_POS=4025;\nSTART SLAVE SQL_THREAD;\n\nWhen the value of this option is changed, the metadata about the replica\'s SQL\nthread\'s position in the relay logs will also be changed in the relay-log.info\nfile or the file that is configured by the relay_log_info_file system variable.\n\nThe RELAY_LOG_FILE and RELAY_LOG_POS options cannot be specified if the\nMASTER_LOG_FILE and MASTER_LOG_POS options were also specified.\n\nGTID Options\n------------\n\nMASTER_USE_GTID\n---------------\n\nThe MASTER_USE_GTID option for CHANGE MASTER can be used to configure the\nreplica to use the global transaction ID (GTID) when connecting to a primary.\nThe possible values are:\n\n* current_pos - Replicate in GTID mode and use gtid_current_pos as the\nposition to start downloading transactions from the primary. Deprecated from\nMariaDB 10.10. Using to transition to primary can break the replication state\nif the replica executes local transactions due to actively updating\ngtid_current_pos with gtid_binlog_pos and gtid_slave_pos. Use the new, safe,\nMASTER_DEMOTE_TO_SLAVE=<bool> option instead.\n* slave_pos - Replicate in GTID mode and use gtid_slave_pos as the position to\nstart downloading transactions from the primary. From MariaDB 10.5.1,\nreplica_pos is an alias for slave_pos.\n* no - Don\'t replicate in GTID mode.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_USE_GTID = current_pos;\nSTART SLAVE;\n\nOr:\n\nSTOP SLAVE;\nSET GLOBAL gtid_slave_pos=\'0-1-153\';\nCHANGE MASTER TO\n MASTER_USE_GTID = slave_pos;\nSTART SLAVE;\n\nMASTER_DEMOTE_TO_SLAVE\n----------------------\n\nMariaDB starting with 10.10\n---------------------------\nUsed to transition a primary to become a replica. Replaces the old\nMASTER_USE_GTID=current_pos with a safe alternative by forcing users to set\nUsing_Gtid=Slave_Pos and merging gtid_binlog_pos into gtid_slave_pos once at\nCHANGE MASTER TO time. If gtid_slave_pos is more recent than gtid_binlog_pos\n(as in the case of chain replication), the replication state should be\npreserved.\n\nFor example:\n\nSTOP SLAVE;\nCHANGE MASTER TO\n MASTER_DEMOTE_TO_SLAVE = 1;\nSTART SLAVE;\n\nReplication Filter Options\n--------------------------\n\nAlso see Replication filters.\n\nIGNORE_SERVER_IDS\n-----------------\n\nThe IGNORE_SERVER_IDS option for CHANGE MASTER can be used to configure a\nreplica to ignore binary log events that originated from certain servers.\nFiltered binary log events will not get logged to the replica’s relay log, and\nthey will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\nserver_id values. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_SERVER_IDS = (3,5);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_SERVER_IDS = ();\nSTART SLAVE;\n\nDO_DOMAIN_IDS\n-------------\n\nThe DO_DOMAIN_IDS option for CHANGE MASTER can be used to configure a replica\nto only apply binary log events if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not get logged to the\nreplica’s relay log, and they will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\ngtid_domain_id values. Duplicate values are automatically ignored. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n DO_DOMAIN_IDS = ();\nSTART SLAVE;\n\nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option cannot both be set\nto non-empty values at the same time. If you want to set the DO_DOMAIN_IDS\noption, and the IGNORE_DOMAIN_IDS option was previously set, then you need to\nclear the value of the IGNORE_DOMAIN_IDS option. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (),\n DO_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nThe DO_DOMAIN_IDS option can only be specified if the replica is replicating\nin GTID mode. Therefore, the MASTER_USE_GTID option must also be set to some\nvalue other than no in order to use this option.\n\nIGNORE_DOMAIN_IDS\n-----------------\n\nThe IGNORE_DOMAIN_IDS option for CHANGE MASTER can be used to configure a\nreplica to ignore binary log events if the transaction\'s GTID is in a specific\ngtid_domain_id value. Filtered binary log events will not get logged to the\nreplica’s relay log, and they will not be applied by the replica.\n\nThe option\'s value can be specified by providing a comma-separated list of\ngtid_domain_id values. Duplicate values are automatically ignored. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nIf you would like to clear a previously set list, then you can set the value\nto an empty list. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n IGNORE_DOMAIN_IDS = ();\nSTART SLAVE;\n\nThe DO_DOMAIN_IDS option and the IGNORE_DOMAIN_IDS option cannot both be set\nto non-empty values at the same time. If you want to set the IGNORE_DOMAIN_IDS\noption, and the DO_DOMAIN_IDS option was previously set, then you need to\nclear the value of the DO_DOMAIN_IDS option. For example:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n DO_DOMAIN_IDS = (),\n IGNORE_DOMAIN_IDS = (1,2);\nSTART SLAVE;\n\nThe IGNORE_DOMAIN_IDS option can only be specified if the replica is\nreplicating in GTID mode. Therefore, the MASTER_USE_GTID option must also be\nset to some value other than no in order to use this option.\n\nDelayed Replication Options\n---------------------------\n\nMASTER_DELAY\n------------\n\nThe MASTER_DELAY option for CHANGE MASTER can be used to enable delayed\nreplication. This option specifies the time in seconds (at least) that a\nreplica should lag behind the primary up to a maximum value of 2147483647, or\nabout 68 years. Before executing an event, the replica will first wait, if\nnecessary, until the given time has passed since the event was created on the\nprimary. The result is that the replica will reflect the state of the primary\nsome time back in the past. The default is zero, no delay.\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_DELAY=3600;\nSTART SLAVE;\n\nChanging Option Values\n----------------------\n\nIf you don\'t specify a given option when executing the CHANGE MASTER\nstatement, then the option keeps its old value in most cases. Most of the\ntime, there is no need to specify the options that do not need to change. For\nexample, if the password for the user account that the replica uses to connect\nto its primary has changed, but no other options need to change, then you can\njust change the MASTER_PASSWORD option by executing the following commands:\n\nSTOP SLAVE;\nCHANGE MASTER TO \n MASTER_PASSWORD=\'new3cret\';\nSTART SLAVE;\n\nThere are some cases where options are implicitly reset, such as when the\nMASTER_HOST and MASTER_PORT options are changed.\n\nOption Persistence\n------------------\n\nThe values of the MASTER_LOG_FILE and MASTER_LOG_POS options (i.e. the binary\nlog position on the primary) and most other options are written to either the\ndefault master.info file or the file that is configured by the\nmaster_info_file option. The replica\'s I/O thread keeps this binary log\nposition updated as it downloads events only when MASTER_USE_GTID option is\nset to NO. Otherwise the file is not updated on a per event basis.\n\nThe master_info_file option can be set either on the command-line or in a\nserver option group in an option file prior to starting up the server. For\nexample:\n\n[mariadb]\n...\nmaster_info_file=/mariadb/myserver1-master.info\n\nThe values of the RELAY_LOG_FILE and RELAY_LOG_POS options (i.e. the relay log\nposition) are written to either the default relay-log.info file or the file\nthat is configured by the relay_log_info_file system variable. The replica\'s\nSQL thread keeps this relay log position updated as it applies events.\n\nThe relay_log_info_file system variable can be set either on the command-line\nor in a server option group in an option file prior to starting up the server.\nFor example:\n\n[mariadb]\n...\nrelay_log_info_file=/mariadb/myserver1-relay-log.info\n\nGTID Persistence\n----------------\n\nIf the replica is replicating binary log events that contain GTIDs, then the\nreplica\'s SQL thread will write every GTID that it applies to the\nmysql.gtid_slave_pos table. This GTID can be inspected and modified through\nthe gtid_slave_pos system variable.\n\nIf the replica has the log_slave_updates system variable enabled and if the\nreplica has the binary log enabled, then every write by the replica\'s SQL\nthread will also go into the replica\'s binary log. This means that GTIDs of\nreplicated transactions would be reflected in the value of the gtid_binlog_pos\nsystem variable.\n\nCreating a Replica from a Backup\n--------------------------------\n\nThe CHANGE MASTER statement is useful for setting up a replica when you have a\nbackup of the primary and you also have the binary log position or GTID\nposition corresponding to the backup.\n\nAfter restoring the backup on the replica, you could execute something like\nthis to use the binary log position:\n\nCHANGE MASTER TO') WHERE help_topic_id = 823; +update help_topic set description = CONCAT(description, '\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4;\nSTART SLAVE;\n\nOr you could execute something like this to use the GTID position:\n\nSET GLOBAL gtid_slave_pos=\'0-1-153\';\nCHANGE MASTER TO\n MASTER_USE_GTID=slave_pos;\nSTART SLAVE;\n\nSee Setting up a Replication Slave with Mariabackup for more information on\nhow to do this with Mariabackup.\n\nExample\n-------\n\nThe following example changes the primary and primary\'s binary log\ncoordinates. This is used when you want to set up the replica to replicate the\nprimary:\n\nCHANGE MASTER TO\n MASTER_HOST=\'master2.mycompany.com\',\n MASTER_USER=\'replication\',\n MASTER_PASSWORD=\'bigs3cret\',\n MASTER_PORT=3306,\n MASTER_LOG_FILE=\'master2-bin.001\',\n MASTER_LOG_POS=4,\n MASTER_CONNECT_RETRY=10;\nSTART SLAVE;\n\nURL: https://mariadb.com/kb/en/change-master-to/') WHERE help_topic_id = 823; insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (824,49,'START SLAVE','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nSTART SLAVE [\"connection_name\"] [thread_type [, thread_type] ... ] [FOR\nCHANNEL \"connection_name\"]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL \n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos [FOR CHANNEL\n\"connection_name\"]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos [FOR CHANNEL\n\"connection_name\"]\nSTART SLAVE [\"connection_name\"] [SQL_THREAD] UNTIL\n MASTER_GTID_POS = <GTID position> [FOR CHANNEL \"connection_name\"]\nSTART ALL SLAVES [thread_type [, thread_type]]\n\nSTART REPLICA [\"connection_name\"] [thread_type [, thread_type] ... ] -- from\n10.5.1\nSTART REPLICA [\"connection_name\"] [SQL_THREAD] UNTIL \n MASTER_LOG_FILE = \'log_name\', MASTER_LOG_POS = log_pos -- from 10.5.1\nSTART REPLICA [\"connection_name\"] [SQL_THREAD] UNTIL\n RELAY_LOG_FILE = \'log_name\', RELAY_LOG_POS = log_pos -- from 10.5.1\nSTART REPLICA [\"connection_name\"] [SQL_THREAD] UNTIL\n MASTER_GTID_POS = <GTID position> -- from 10.5.1\nSTART ALL REPLICAS [thread_type [, thread_type]] -- from 10.5.1\n\nthread_type: IO_THREAD | SQL_THREAD\n\nDescription\n-----------\n\nSTART SLAVE (START REPLICA from MariaDB 10.5.1) with no thread_type options\nstarts both of the replica threads (see replication). The I/O thread reads\nevents from the primary server and stores them in the relay log. The SQL\nthread reads events from the relay log and executes them. START SLAVE requires\nthe SUPER privilege, or, from MariaDB 10.5.2, the REPLICATION SLAVE ADMIN\nprivilege.\n\nIf START SLAVE succeeds in starting the replica threads, it returns without\nany error. However, even in that case, it might be that the replica threads\nstart and then later stop (for example, because they do not manage to connect\nto the primary or read its binary log, or some other problem). START SLAVE\ndoes not warn you about this. You must check the replica\'s error log for error\nmessages generated by the replica threads, or check that they are running\nsatisfactorily with SHOW SLAVE STATUS (SHOW REPLICA STATUS from MariaDB\n10.5.1).\n\nSTART SLAVE UNTIL\n-----------------\n\nSTART SLAVE UNTIL refers to the SQL_THREAD replica position at which the\nSQL_THREAD replication will halt. If SQL_THREAD isn\'t specified both threads\nare started.\n\nSTART SLAVE UNTIL master_gtid_pos=xxx is also supported. See Global\nTransaction ID/START SLAVE UNTIL master_gtid_pos=xxx for more details.\n\nconnection_name\n---------------\n\nIf there is only one nameless primary, or the default primary (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the START SLAVE statement will apply to the\nspecified primary. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after START SLAVE.\n\nSTART ALL SLAVES\n----------------\n\nSTART ALL SLAVES starts all configured replicas (replicas with master_host not\nempty) that were not started before. It will give a note for all started\nconnections. You can check the notes with SHOW WARNINGS.\n\nSTART REPLICA\n-------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSTART REPLICA is an alias for START SLAVE from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/start-replica/','','https://mariadb.com/kb/en/start-replica/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (825,49,'STOP SLAVE','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nSTOP SLAVE [\"connection_name\"] [thread_type [, thread_type] ... ] [FOR CHANNEL\n\"connection_name\"]\n\nSTOP ALL SLAVES [thread_type [, thread_type]]\n\nSTOP REPLICA [\"connection_name\"] [thread_type [, thread_type] ... ] -- from\n10.5.1\n\nSTOP ALL REPLICAS [thread_type [, thread_type]] -- from 10.5.1\n\nthread_type: IO_THREAD | SQL_THREAD\n\nDescription\n-----------\n\nStops the replica threads. STOP SLAVE requires the SUPER privilege, or, from\nMariaDB 10.5.2, the REPLICATION SLAVE ADMIN privilege.\n\nLike START SLAVE, this statement may be used with the IO_THREAD and SQL_THREAD\noptions to name the thread or threads to be stopped. In almost all cases, one\nnever need to use the thread_type options.\n\nSTOP SLAVE waits until any current replication event group affecting one or\nmore non-transactional tables has finished executing (if there is any such\nreplication group), or until the user issues a KILL QUERY or KILL CONNECTION\nstatement.\n\nNote that STOP SLAVE doesn\'t delete the connection permanently. Next time you\nexecute START SLAVE or the MariaDB server restarts, the replica connection is\nrestored with it\'s original arguments. If you want to delete a connection, you\nshould execute RESET SLAVE.\n\nSTOP ALL SLAVES\n---------------\n\nSTOP ALL SLAVES stops all your running replicas. It will give you a note for\nevery stopped connection. You can check the notes with SHOW WARNINGS.\n\nconnection_name\n---------------\n\nThe connection_name option is used for multi-source replication.\n\nIf there is only one nameless master, or the default master (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the STOP SLAVE statement will apply to the\nspecified master. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after STOP SLAVE.\n\nSTOP REPLICA\n------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSTOP REPLICA is an alias for STOP SLAVE from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/stop-replica/','','https://mariadb.com/kb/en/stop-replica/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (826,49,'RESET REPLICA/SLAVE','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nRESET REPLICA [\"connection_name\"] [ALL] [FOR CHANNEL \"connection_name\"] --\nfrom MariaDB 10.5.1 \nRESET SLAVE [\"connection_name\"] [ALL] [FOR CHANNEL \"connection_name\"]\n\nDescription\n-----------\n\nRESET REPLICA/SLAVE makes the replica forget its replication position in the\nmaster\'s binary log. This statement is meant to be used for a clean start. It\ndeletes the master.info and relay-log.info files, all the relay log files, and\nstarts a new relay log file. To use RESET REPLICA/SLAVE, the replica threads\nmust be stopped (use STOP REPLICA/SLAVE if necessary).\n\nNote: All relay log files are deleted, even if they have not been completely\nexecuted by the slave SQL thread. (This is a condition likely to exist on a\nreplication slave if you have issued a STOP REPLICA/SLAVE statement or if the\nslave is highly loaded.)\n\nNote: RESET REPLICA does not reset the global gtid_slave_pos variable. This\nmeans that a replica server configured with CHANGE MASTER TO\nMASTER_USE_GTID=slave_pos will not receive events with GTIDs occurring before\nthe state saved in gtid_slave_pos. If the intent is to reprocess these events,\ngtid_slave_pos must be manually reset, e.g. by executing set global\ngtid_slave_pos=\"\".\n\nConnection information stored in the master.info file is immediately reset\nusing any values specified in the corresponding startup options. This\ninformation includes values such as master host, master port, master user, and\nmaster password. If the replica SQL thread was in the middle of replicating\ntemporary tables when it was stopped, and RESET REPLICA/SLAVE is issued, these\nreplicated temporary tables are deleted on the slave.\n\nThe ALL also resets the PORT, HOST, USER and PASSWORD parameters for the\nslave. If you are using a connection name, it will permanently delete it and\nit will not show up anymore in SHOW ALL REPLICAS/SLAVE STATUS.\n\nconnection_name\n---------------\n\nThe connection_name option is used for multi-source replication.\n\nIf there is only one nameless primary, or the default primary (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the RESET REPLICA/SLAVE statement will apply to\nthe specified primary. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after RESET REPLICA.\n\nRESET REPLICA\n-------------\n\nMariaDB starting with 10.5.1\n----------------------------\nRESET REPLICA is an alias for RESET SLAVE from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/reset-replica/','','https://mariadb.com/kb/en/reset-replica/'); diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index 0381927d70f..a46c49c88b0 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 9f8a0cf604c..c83f2c44a4f 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 28c39090d03..9a1f3920f67 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 6e5666c2dea..1a2ede79a77 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 9aae53ba161..33dc7961089 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 e1efcbf11ad..82d8d4edd71 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 2ac4e256112..67c8a8bca4f 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 @@ error: } -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 9960855a813..88f6695fc72 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 c4819ebaa7d..5a618a5a2a9 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2563,9 +2563,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; @@ -11313,7 +11311,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 e074b46f52f..8f318dcc961 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -8120,7 +8120,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 523c8472784..77c77c83c0f 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() = default; - virtual ~TABLEOP_HOOKS() = default; - - 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 919db4cdeb5..5e255646528 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 dd87d6dce67..0b1503a5b03 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 92adb98d8c7..15d3ae8921b 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 98325fe7498..535a2cf93de 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 1543cb5ca56..5294b91738b 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 93994cd2c0d..23f34dd0d84 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -137,7 +137,6 @@ #define mysqld_charset &my_charset_latin1 - extern "C" { // Because of SCO 3.2V4.2 #include <sys/stat.h> #ifndef __GNU_LIBRARY__ @@ -2290,7 +2289,7 @@ static void activate_tcp_port(uint port, Dynamic_array<MYSQL_SOCKET> *sockets, bool is_extra_port= false) { - struct addrinfo *ai, *a; + struct addrinfo *ai, *a = NULL, *head = NULL; struct addrinfo hints; int error; int arg; @@ -2311,16 +2310,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); @@ -2409,9 +2444,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); @@ -2432,7 +2489,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; } @@ -6552,7 +6614,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, @@ -8083,45 +8145,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, "->"))) - { - sql_print_error("Bad syntax in replicate-rewrite-db: missing '->'"); - 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) + if (cur_rpl_filter->add_rewrite_db(argument)) { - sql_print_error("Bad syntax in replicate-rewrite-db - empty FROM db"); + sql_print_error("Bad syntax in replicate-rewrite-db.Expected syntax is FROM->TO."); 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 efa072272c5..2d9a4842d8c 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 f6980aeb6b1..8e9b9a3748e 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 eee6236ffe7..26bc94c1463 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -1374,21 +1374,49 @@ bool Protocol::store(I_List<i_string>* str_list) { char buf[256]; String tmp(buf, sizeof(buf), &my_charset_bin); - uint32 len; + size_t len= 0; I_List_iterator<i_string> 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<i_string_pair>* str_list) +{ + char buf[256]; + const char *delimiter= ","; + String tmp(buf, sizeof(buf), &my_charset_bin); + size_t delim_len= 0; + I_List_iterator<i_string_pair> 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 683bbd69583..4fdfde3e007 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -99,6 +99,7 @@ public: bool send_result_set_row(List<Item> *row_items); bool store(I_List<i_string> *str_list); + bool store(I_List<i_string_pair> *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 1e1f98c1e3e..982c0c9482d 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) { @@ -521,6 +513,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<i_string> *list, const char* spec) { char *str; @@ -542,6 +598,14 @@ Rpl_filter::add_string_list(I_List<i_string> *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) { DBUG_ENTER("Rpl_filter::add_do_db"); @@ -558,6 +622,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) { free_string_list(&do_db); @@ -665,6 +737,21 @@ Rpl_filter::free_string_list(I_List<i_string> *l) } +void +Rpl_filter::free_string_pair_list(I_List<i_string_pair> *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<i_string_pair>* +Rpl_filter::get_rewrite_db() +{ + return &rewrite_db; +} + + +void +Rpl_filter::db_rewrite_rule_ent_list_to_str(String* str, I_List<i_string_pair>* list) +{ + I_List_iterator<i_string_pair> 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<i_string_pair> 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<i_string>* Rpl_filter::get_do_db() { @@ -816,6 +919,13 @@ Rpl_filter::db_rule_ent_list_to_str(String* str, I_List<i_string>* 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) { db_rule_ent_list_to_str(str, get_do_db()); diff --git a/sql/rpl_filter.h b/sql/rpl_filter.h index f22ec8a0ce4..ee3b9d516b7 100644 --- a/sql/rpl_filter.h +++ b/sql/rpl_filter.h @@ -71,9 +71,11 @@ public: 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 @@ public: 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 @@ public: void get_wild_ignore_table(String* str); bool rewrite_db_is_empty(); + I_List<i_string_pair>* 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<i_string>* get_do_db(); I_List<i_string>* get_ignore_db(); @@ -121,15 +122,17 @@ private: void free_string_array(DYNAMIC_ARRAY *a); void free_string_list(I_List<i_string> *l); + void free_string_pair_list(I_List<i_string_pair> *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<i_string_pair>*); void db_rule_ent_list_to_str(String* s, I_List<i_string>* l); TABLE_RULE_ENT* find_wild(DYNAMIC_ARRAY *a, const char* key, int len); int add_string_list(I_List<i_string> *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 ab2523d960b..3c698f27a19 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 74c65172860..26cec14fd9a 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -9995,9 +9995,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 327948bf0a5..5c8db6f2c56 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2955,6 +2955,9 @@ void show_master_info_get_fields(THD *thd, List<Item> *field_list, 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); field_list->push_back(new (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 d225b018488..a2f7be8a684 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 @@ public: 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<ACL_DB> 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; } @@ -3696,6 +3766,23 @@ exit: } /* + 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 NOTES @@ -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 @@ wsrep_error_label: /* - Find user in ACL + Find user in ACL. Uses to check a definer SYNOPSIS is_acl_user() @@ -4297,8 +4384,8 @@ wsrep_error_label: 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 <LEX_USER> &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 <LEX_USER> &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 <LEX_USER> &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 <LEX_USER> &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 <LEX_USER> &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 <LEX_USER> &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 <LEX_USER> &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 <LEX_USER> &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 <LEX_USER> &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 <LEX_USER> &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 <LEX_USER> &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 { @@ -12054,6 +12178,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 */ @@ -12299,8 +12425,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"); @@ -12311,7 +12436,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; @@ -12339,7 +12464,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); @@ -12813,11 +12938,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 { @@ -12826,18 +12947,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; @@ -12846,6 +12957,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)); @@ -12901,12 +13016,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; @@ -14515,7 +14636,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) @@ -14973,5 +15094,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 b4288b05bfb..fb8dd2c3763 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 8db958b25b0..6625571fb32 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<Item> 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<Item_func_set_user_var> li(thd->lex->set_var_list); + List_iterator<Item_func_set_user_var> 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 @@ err_no_arena: } +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<MAX_DATETIME_FULL_WIDTH+1> 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<Item> &fields, List<Item> &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<Item> &fields, List<Item> &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<Item> &fields, List<Item> &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<Item> &fields, List<Item> &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<Item> &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<Item> &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<Item> &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 8760b5d2e82..e0c6c15a3e2 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -6037,11 +6037,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 88288e3091e..54a213d8553 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5596,6 +5596,27 @@ public: { 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); + } }; @@ -6161,7 +6182,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; @@ -6182,7 +6202,6 @@ public: 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), @@ -6209,8 +6228,8 @@ public: private: TABLE *create_table_from_items(THD *thd, List<Item> *items, - MYSQL_LOCK **lock, - TABLEOP_HOOKS *hooks); + MYSQL_LOCK **lock); + int postlock(THD *thd, TABLE **tables); }; #include <myisam.h> diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 9da1ac5ca77..452a01773e5 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 83ae0132ea1..7c3e87d42e3 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> 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 0e8569aabe5..cfff664f81e 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -512,6 +512,10 @@ public: 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 @@ private: #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 c31d341b3f1..6e042d25805 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; @@ -4159,7 +4169,6 @@ int select_insert::send_data(List<Item> &values) DBUG_RETURN(1); } - table->vers_write= table->versioned(); if (table_list) // Not CREATE ... SELECT { switch (table_list->view_check_option(thd, info.ignore)) { @@ -4171,7 +4180,6 @@ int select_insert::send_data(List<Item> &values) } error= write_record(thd, table, &info, sel_result); - table->vers_write= table->versioned(); table->auto_increment_field_not_null= FALSE; if (likely(!error)) @@ -4484,8 +4492,7 @@ Field *Item::create_field_for_create_select(MEM_ROOT *root, TABLE *table) */ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, - MYSQL_LOCK **lock, - TABLEOP_HOOKS *hooks) + MYSQL_LOCK **lock) { TABLE tmp_table; // Used during 'Create_field()' TABLE_SHARE share; @@ -4508,7 +4515,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *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++)) @@ -4559,21 +4566,21 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *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; } /* @@ -4594,10 +4601,10 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *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"); @@ -4605,7 +4612,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *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()) { @@ -4613,20 +4620,20 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *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 { @@ -4634,8 +4641,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *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 @@ -4644,13 +4651,13 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *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 @@ -4662,7 +4669,6 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *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 @@ -4677,7 +4683,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *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 */ /* @@ -4693,7 +4699,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *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); @@ -4716,71 +4722,52 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, } -int -select_create::prepare(List<Item> &_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<Item> 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<THD*>(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<Item> &_values, SELECT_LEX_UNIT *u) +{ + List<Item> values(_values, thd->mem_root); + MYSQL_LOCK *extra_lock= NULL; + DBUG_ENTER("select_create::prepare"); unit= u; @@ -4796,12 +4783,12 @@ select_create::prepare(List<Item> &_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, @@ -4821,7 +4808,7 @@ select_create::prepare(List<Item> &_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) @@ -5120,8 +5107,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, @@ -5177,8 +5164,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); } @@ -5293,7 +5280,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()) { @@ -5308,7 +5295,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, @@ -5324,8 +5311,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 d4028eaaae0..e98055c7b35 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -6403,7 +6403,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(); @@ -9813,7 +9813,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; @@ -10387,8 +10387,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 @@ -10400,9 +10399,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 92664898718..6ccec9b5f2a 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 <i_string_pair> *list) -{ - i_string_pair *tmp; - while ((tmp= list->get())) - delete tmp; -} - void free_list(I_List <i_string> *list) { diff --git a/sql/sql_list.h b/sql/sql_list.h index a9ab5415d5a..5a57c86ef9d 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -869,7 +869,6 @@ list_copy_and_replace_each_value(List<T> &list, MEM_ROOT *mem_root) it.replace(el->clone(mem_root)); } -void free_list(I_List <i_string_pair> *list); void free_list(I_List <i_string> *list); #endif // INCLUDES_MYSQL_SQL_LIST_H diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c699d3e9732..b5d93e6fd99 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); @@ -6765,10 +6766,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 { @@ -6813,14 +6811,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", @@ -7614,21 +7605,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. @@ -7744,7 +7720,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 @@ -7763,7 +7739,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 d3cf83b6e08..eeb7f832adb 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 6b337eae8d1..1e84471eef2 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1773,7 +1773,7 @@ err: 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 381ac26f3a3..6f4eff4880c 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 5948b8ebc3d..1137e0e1b09 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 a179ab93373..51bef49277e 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 01892a5fe9b..5b5fb8158ca 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -2103,7 +2103,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<Item> &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 295b6017a2c..320f9f4f97c 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<LEX_CSTRING*> 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 { @@ -6450,24 +6447,81 @@ 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<sp_name_len> 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(); @@ -8683,7 +8779,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; @@ -9875,7 +9972,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}, @@ -9890,7 +9987,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 26f652499de..6f3f96d573f 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 @@ without_overlaps_err: } 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"); @@ -9505,7 +9506,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, @@ -10584,7 +10585,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, @@ -10619,7 +10620,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 d29ef532382..067b921eaf3 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 d1c32e7d9d3..066d6b7483d 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 f88f515f0d2..6f96069e46a 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 3776831bdd7..2cda0cbba36 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 033f98fd719..f56ec5c83c9 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 a2b744fc8be..30fba1bcf98 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 @@ loop_out: 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 9baa4e16f4e..0fed9186dd2 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 <lex_user> 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 <user_auth> 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(); } @@ -13621,7 +13621,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(); } @@ -13824,7 +13824,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; } @@ -13933,7 +13933,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; } @@ -14121,7 +14121,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; @@ -14212,7 +14212,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; @@ -14582,7 +14582,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 { @@ -16696,12 +16696,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))) @@ -17148,32 +17148,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 f1466ac7d42..1ed3d61bcf8 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_global<Sys_var_mybool, Sys_readonly( "read_only", "Make all non-temporary tables read-only, with the exception for " - "replication (slave) threads and users with the SUPER privilege", + "replication (slave) threads and users with the 'READ ONLY ADMIN' " + "privilege", GLOBAL_VAR(read_only), CMD_LINE(OPT_ARG), DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_read_only), ON_UPDATE(fix_read_only)); @@ -4761,7 +4781,8 @@ static Sys_var_harows Sys_select_limit( VALID_RANGE(0, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1)); static const char *secure_timestamp_levels[]= {"NO", "SUPER", "REPLICATION", "YES", 0}; -bool Sys_var_timestamp::on_check_access_session(THD *thd) const + +bool is_set_timestamp_forbidden(THD *thd) { switch (opt_secure_timestamp) { case SECTIME_NO: @@ -4779,6 +4800,11 @@ bool Sys_var_timestamp::on_check_access_session(THD *thd) const my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), buf); return true; } + +bool Sys_var_timestamp::on_check_access_session(THD *thd) const +{ + return is_set_timestamp_forbidden(thd); +} static Sys_var_timestamp Sys_timestamp( "timestamp", "Set the time for this client", sys_var::ONLY_SESSION, NO_CMD_LINE, @@ -5139,8 +5165,19 @@ static bool fix_slow_log_file(sys_var *self, THD *thd, enum_var_type type) return fix_log(&opt_slow_logname, opt_log_basename, "-slow.log", global_system_variables.sql_log_slow, reopen_slow_log); } + static Sys_var_charptr_fscs Sys_slow_log_path( - "slow_query_log_file", "Log slow queries to given log file. " + "slow_query_log_file", + "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", + PREALLOCATED GLOBAL_VAR(opt_slow_logname), CMD_LINE(REQUIRED_ARG), + DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG, + ON_CHECK(check_log_path), ON_UPDATE(fix_slow_log_file)); + +static Sys_var_charptr_fscs Sys_log_slow_query_file_name( + "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", PREALLOCATED GLOBAL_VAR(opt_slow_logname), CMD_LINE(REQUIRED_ARG), @@ -5241,6 +5278,16 @@ static Sys_var_mybool Sys_general_log( static Sys_var_mybool Sys_slow_query_log( "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.", + SESSION_VAR(sql_log_slow), CMD_LINE(OPT_ARG), + DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, + ON_CHECK(0), ON_UPDATE(fix_log_state)); + +static Sys_var_mybool Sys_log_slow_query( + "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.", @@ -5265,7 +5312,7 @@ static bool fix_log_state(sys_var *self, THD *thd, enum_var_type type) } else { - DBUG_ASSERT(self == &Sys_slow_query_log); + DBUG_ASSERT(self == &Sys_slow_query_log || self == &Sys_log_slow_query); newvalptr= &global_system_variables.sql_log_slow; oldval= logger.get_slow_log_file_handler()->is_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 " @@ -6902,3 +6962,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 d66b357766c..ec3a97cc454 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -7624,6 +7624,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. @@ -7681,6 +7683,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); @@ -9156,34 +9164,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; } @@ -9192,7 +9191,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 de9b2673d46..eda7f504e4f 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 @@ -1862,7 +1871,7 @@ public: 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 a679304c40a..854c11c1eea 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/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 287a2681bd5..4bb73b76442 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3081,6 +3081,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); } diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 6d652e72ad8..704cdc2ed29 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; } @@ -994,13 +994,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) { @@ -1029,7 +1022,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/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index f42a9b7853f..752ea449f45 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19260,15 +19260,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<const uint*>(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<const uint*>(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, diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index c02180ad9ee..8655cd6fb57 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -657,6 +657,18 @@ public: 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; } diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 44b19aa666b..c18cf1ceb63 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/trx0rseg.h b/storage/innobase/include/trx0rseg.h index 8b7eacbbc18..6e0eb547eb8 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -291,7 +291,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 4d231077b12..2ed9566c215 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 @@ public: 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/os/os0file.cc b/storage/innobase/os/os0file.cc index c7164ccc3ff..d4cfb6207bf 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -83,8 +83,7 @@ private: 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 +104,11 @@ public: } /* Wait for completions of all AIO operations */ + void wait(std::unique_lock<std::mutex> &lk) + { + m_cache.wait(lk); + } + void wait() { m_cache.wait(); @@ -124,6 +128,24 @@ public: { wait(); } + + std::mutex& mutex() + { + return m_cache.mutex(); + } + + void resize(int max_submitted_io, int max_callback_concurrency, std::unique_lock<std::mutex> &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; @@ -3633,6 +3655,58 @@ disable: } +/** +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<std::mutex> lk_read(read_slots->mutex()); + std::unique_lock<std::mutex> 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<int>(n_reader_threads)); + write_slots->task_group().set_max_tasks(static_cast<int>(n_writer_threads)); + return ret; + } + + /* Allocation succeeded, resize the slots*/ + read_slots->resize(max_read_events, static_cast<int>(n_reader_threads), lk_read); + write_slots->resize(max_write_events, static_cast<int>(n_writer_threads), lk_write); + + return 0; +} + void os_aio_free() { srv_thread_pool->disable_aio(); diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 3b21b0315cd..5a71c9f66d2 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -2404,7 +2404,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; diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index cb60da24728..9a795126326 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -323,33 +323,270 @@ 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 */ +ATTRIBUTE_COLD 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; + + if (UNIV_UNLIKELY(mach_read_from_4(TRX_RSEG + TRX_RSEG_FORMAT + + first_rseg_hdr->page.frame))) + trx_rseg_format_upgrade(first_rseg_hdr, &mtr); + + mtr.write<8,mtr_t::MAYBE_NOP>(*first_rseg_hdr, + TRX_RSEG + TRX_RSEG_MAX_TRX_ID + + first_rseg_hdr->page.frame, + trx_sys.get_max_trx_id() - 1); + + /* 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 +774,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 +818,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 +846,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 +868,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 +880,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; } } @@ -1112,15 +1348,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. */ @@ -1217,10 +1461,7 @@ dberr_t srv_start(bool create_new_db) /* 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); - } + if (srv_operation != SRV_OPERATION_RESTORE) { dict_sys.load_sys_tables(); } @@ -1260,8 +1501,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); } @@ -1407,6 +1648,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. diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 4c8c5842e13..867126adc0e 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -333,7 +333,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 d30300d70a7..3fada7d34aa 100644 --- a/storage/innobase/trx/trx0rseg.cc +++ b/storage/innobase/trx/trx0rseg.cc @@ -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 <mysql/service_wsrep.h> @@ -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; @@ -413,6 +414,7 @@ static dberr_t trx_undo_lists_init(trx_rseg_t *rseg, 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++) { @@ -423,11 +425,14 @@ static dberr_t trx_undo_lists_init(trx_rseg_t *rseg, trx_undo_mem_create_at_db_start(rseg, i, page_no); 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; } @@ -526,6 +531,7 @@ static dberr_t trx_rseg_mem_restore(trx_rseg_t *rseg, mtr_t *mtr) purge_sys.purge_queue.push(*rseg); } + trx_sys.set_undo_non_empty(rseg->history_size > 0); return err; } @@ -586,10 +592,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()); err = trx_rseg_mem_restore(&rseg, &mtr); if (rseg.needs_purge > max_trx_id) { @@ -681,29 +701,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 ee27e8f51c1..374a9d724bc 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -291,10 +291,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 837f12a39dd..454afba4321 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -725,6 +725,12 @@ corrupted: return err; } + if (trx_sys.is_undo_empty()) { +func_exit: + purge_sys.clone_oldest_view<true>(); + return DB_SUCCESS; + } + /* Look from the rollback segments if there exist undo logs for transactions. */ const time_t start_time = time(NULL); @@ -786,8 +792,7 @@ corrupted: ib::info() << "Trx id counter is " << trx_sys.get_max_trx_id(); } - purge_sys.clone_oldest_view<true>(); - return DB_SUCCESS; + goto func_exit; } /** Assign a persistent rollback segment in a round-robin fashion, @@ -842,8 +847,7 @@ static void trx_assign_rseg_low(trx_t *trx) 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 = 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 835361eea35..f128567efc9 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/spd_include.h b/storage/spider/spd_include.h index 897721d3c2e..26acaaa86ec 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -87,7 +87,6 @@ #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 diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 5eb97141ffd..46dba6abdc9 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; @@ -6594,17 +6586,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; spd_defaults_file = &my_defaults_file; diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 400d6a590dc..f266b27c871 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; @@ -1636,62 +1628,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); } @@ -1702,25 +1649,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); } diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 42372e3b13c..9858475fdcf 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 cff67fd110f..44ad8d0ae94 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 00000000000..811b274778f --- /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 c89aa6e0b99..00000000000 --- 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 = <secret> -# user= root -# -# where "<secret>" 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 757e9f52f33..6a4635e535e 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 b52fe7c0f67..eb57a8bee37 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 87a0122adce..f0b2b9f6735 100644 --- a/tpool/tpool.h +++ b/tpool/tpool.h @@ -68,8 +68,10 @@ private: 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 @@ public: 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 b49204f2d75..4690a615174 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 @@ public: 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 @@ public: return ele >= &m_base[0] && ele <= &m_base[capacity() - 1]; } - /** Wait until cache is full.*/ - void wait() - { - std::unique_lock<std::mutex> 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 @@ public: { 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<std::mutex> &lk) + { + m_waiters++; + while (!is_full()) + m_cv.wait(lk); + m_waiters--; + } + + /* Wait until cache is full.*/ + void wait() + { + std::unique_lock<std::mutex> 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]; + } }; |